@povio/openapi-codegen-cli 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"
@@ -9,9 +9,11 @@
9
9
  export namespace {{namespace}} {
10
10
  {{/if}}
11
11
  {{#each zodSchemasData as | zodSchema |}}
12
+ {{! Js docs }}
13
+ {{{genModelJsDocs @key zodSchema ../tag}}}
12
14
  {{! Zod schema export }}
13
- {{#if zodSchema.isCircular}}// TODO: Fix type inference {{/if}}
14
- export const {{@key}}{{#if zodSchema.isCircular}}: z.ZodType<unknown>{{/if}} = {{{zodSchema.code}}};
15
+ export const {{@key}}{{#if zodSchema.isCircular}}: z.ZodType<unknown> // TODO: Fix type inference {{/if}}
16
+ = {{{zodSchema.code}}};
15
17
  {{! Zod schema infered type export }}
16
18
  export type {{zodInferedType @key}} = z.infer<typeof {{@key}}>;
17
19
  {{#if zodSchema.isEnum}}export const {{zodInferedType @key}} = {{@key}}.enum;{{/if}}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * {{name}}
3
+ * @type { {{zodSchemaType zodSchema}} }{{#if (zodSchemaDescription zodSchema)}}
4
+ * @description {{{zodSchemaDescription zodSchema}}}{{/if}}
5
+ {{#if (zodSchemaPropertyDescriptions zodSchema tag)}}{{#each (zodSchemaPropertyDescriptions zodSchema tag) as | property |}} * @property { {{property.type}} } {{@key}} {{{addAsteriskAfterNewLine property.description}}}
6
+ {{/each}}{{/if}} */
@@ -0,0 +1,10 @@
1
+ /**
2
+ * {{#if (isQuery endpoint)}}Query{{else}}Mutation{{/if}} `{{queryName endpoint}}`{{#if endpoint.summary}}
3
+ * @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
4
+ * @description {{addAsteriskAfterNewLine endpoint.description}}{{/if}}{{#if endpoint.acl}}
5
+ * @permission Requires `{{abilityFunctionName endpoint}}` ability {{/if}}
6
+ {{#if (endpointParams endpoint)}}{{#each (endpointParams endpoint) as | endpointParam |}} * @param { {{endpointParam.type}} } {{#if (isQuery ../endpoint)}}object{{else}}mutation{{/if}}.{{endpointParam.name}} {{{endpointParamDescription endpointParam}}}
7
+ {{/each}}{{/if}} * @param {{#if (isQuery endpoint)}}{ AppQueryOptions } options Query options{{else}}{ AppMutationOptions } options Mutation options{{/if}}
8
+ * @returns { {{#if (isQuery endpoint)}}UseQueryResult{{else}}UseMutationResult{{/if}}<{{{importedZodSchemaInferedType endpoint.response}}}> } {{endpoint.responseDescription}}
9
+ * @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
10
+ */
@@ -1,12 +1,6 @@
1
- /**
2
- * Mutation `{{queryName endpoint}}`{{#if endpoint.summary}}
3
- * @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
4
- * @description {{addAsteriskAfterNewLine endpoint.description}}{{/if}}{{#if endpoint.acl}}
5
- * @permission Requires `{{abilityFunctionName endpoint}}` ability {{/if}}
6
- {{#if (endpointParams endpoint)}}{{#each (endpointParams endpoint) as | endpointParam |}} * @param { {{endpointParam.type}} } mutation.{{endpointParam.name}} {{{endpointParamDescription endpointParam}}}
7
- {{/each}}{{/if}} * @param { AppMutationOptions } options Mutation options
8
- * @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
9
- */
1
+ {{! Js docs }}
2
+ {{{genQueryJsDocs endpoint}}}
3
+ {{! Mutation definition}}
10
4
  export const {{queryName endpoint}} = (options?: AppMutationOptions<typeof {{importedEndpointName endpoint}}, { {{{genEndpointParams endpoint}}} }>) => {
11
5
  {{#if queryEndpoints}} const queryClient = useQueryClient();{{/if}}
12
6
 
@@ -14,6 +8,7 @@ export const {{queryName endpoint}} = (options?: AppMutationOptions<typeof {{imp
14
8
  mutationFn: ({{#if (endpointParams endpoint)}} { {{{endpointArgs endpoint}}} } {{/if}}) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}),
15
9
  ...options, {{#if queryEndpoints}}
16
10
  onSuccess: (...args) => {
11
+ {{! Invalidation }}
17
12
  if (options?.enableInvalidateAll) {
18
13
  queryClient.invalidateQueries({ queryKey: keys.all });
19
14
  }
@@ -1,12 +1,6 @@
1
- /**
2
- * Query `{{queryName endpoint}}`{{#if endpoint.summary}}
3
- * @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
4
- * @description {{addAsteriskAfterNewLine endpoint.description}}{{/if}}{{#if endpoint.acl}}
5
- * @permission Requires `{{abilityFunctionName endpoint}}` ability {{/if}}
6
- {{#if (endpointParams endpoint)}}{{#each (endpointParams endpoint) as | endpointParam |}} * @param { {{endpointParam.type}} } object.{{endpointParam.name}} {{{endpointParamDescription endpointParam}}}
7
- {{/each}}{{/if}} * @param { AppQueryOptions } options Query options
8
- * @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
9
- */
1
+ {{! Js docs }}
2
+ {{{genQueryJsDocs endpoint}}}
3
+ {{! Query definition}}
10
4
  export const {{queryName endpoint}} = <TData>({{#if (endpointParams endpoint)}}{ {{{endpointArgs endpoint}}} }: { {{{genEndpointParams endpoint}}} }, {{/if}}options?: AppQueryOptions<typeof {{importedEndpointName endpoint}}, TData>) => {
11
5
  return {{queryHook}}({
12
6
  queryKey: keys.{{endpointName endpoint}}({{#if (endpointParams endpoint)}}{{{endpointArgs endpoint}}}{{/if}}),
@@ -1,3 +0,0 @@
1
- import { GenerateOptions } from "src/generators/types/options";
2
- export declare function getAppRestClientImportPath(options: GenerateOptions): string;
3
- export declare function getQueryTypesImportPath(options: GenerateOptions): string;