@povio/openapi-codegen-cli 0.6.6 → 0.7.0

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/README.md CHANGED
@@ -29,26 +29,27 @@ yarn openapi-codegen generate --input http://localhost:3001/docs-json --standalo
29
29
  #### Generate command (generates Zod schemas, API definitions and React queries)
30
30
 
31
31
  ```sh
32
- --input Path/URL to OpenAPI/Swagger document as JSON/YAML
33
- --output Output path (default: 'output')
34
- --prettier Run the Prettier command on the output after code generation (default: true)
35
- --verbose Show log messages during execution
36
-
37
- --splitByTags Split output into directories based on tags in OpenAPI operations (default: true)
38
- --defaultTag (Requires `splitByTags`) Default tag name for code shared across multiple tags (default: 'Common')
39
- --excludeTags (Requires `splitByTags`) Comma-separated list of tags to exclude from the output
40
-
41
- --tsNamespaces Include Typescript namespaces inside generated files (default: true)
42
- --importPath Import path (default: 'ts', possible values: 'ts' | 'relative' | 'absolute')
43
- --removeOperationPrefixEndingWith Remove prefixes that end with the specified value from operation names (default: 'Controller_')
44
- --extractEnums Extract enums as separate Zod schemas (default: true)
45
- --replaceOptionalWithNullish Replace all `.optional()` zod chains wtih `.nullish()`
46
-
47
- --axiosRequestConfig Adds Axios request config parameter to queries (default: false)
48
- --infiniteQueries Generates infinite queries for API definitions that support pagination (default: false)
49
-
50
- --standalone Add any missing classes or types—e.g., REST client class, React Query type extensions, etc. (default: false)
51
- --baseUrl (Requires `standalone`) Base URL for the REST client; falls back to the one defined in the OpenAPI spec
32
+ --input Path/URL to OpenAPI JSON/YAML document
33
+ --output Output directory path (default: 'output')
34
+ --prettier Format the generated code using Prettier (default: true)
35
+ --verbose Display detailed log messages during execution (default: false)
36
+
37
+ --splitByTags Organize output into separate folders based on OpenAPI operation tags (default: true)
38
+ --defaultTag (Requires `--splitByTags`) Default tag for shared code across multiple tags (default: 'Common')
39
+ --excludeTags (Requires `--splitByTags`) Comma-separated list of tags to exclude from generation
40
+
41
+ --tsNamespaces Wrap generated files in TypeScript namespaces (default: true)
42
+ --importPath Module import style for generated files (default: 'ts'; options: 'ts' | 'relative' | 'absolute')
43
+ --removeOperationPrefixEndingWith Remove operation name prefixes that end with the specified string (Default: 'Controller_')
44
+ --extractEnums Extract enums into separate Zod schemas (default: true)
45
+ --replaceOptionalWithNullish Replace `.optional()` chains with `.nullish()` in generated Zod schemas (default: false)
46
+
47
+ --axiosRequestConfig Include Axios request config parameters in query hooks (default: false)
48
+ --infiniteQueries Generate infinite queries for paginated API endpoints (default: false)
49
+ --invalidateQueryOptions Add query invalidation options to mutation hooks (default: true)
50
+
51
+ --standalone Generate any missing supporting classes/types, e.g., REST client class, React Query type extensions, etc. (default: false)
52
+ --baseUrl (Requires `--standalone`) Base URL for the REST client; falls back to the OpenAPI spec if not provided
52
53
  ```
53
54
 
54
55
  #### Check command (checks if OpenAPI spec is compliant)
@@ -57,9 +58,9 @@ yarn openapi-codegen generate --input http://localhost:3001/docs-json --standalo
57
58
  --input Path/URL to OpenAPI/Swagger document as JSON/YAML
58
59
  --verbose Show log messages during execution
59
60
 
60
- --splitByTags Split output into directories based on tags in OpenAPI operations (default: true)
61
- --defaultTag Default tag name for code shared across multiple tags (default: 'Common')
62
- --excludeTags Comma-separated list of tags to exclude from the output
61
+ --splitByTags Organize output into separate folders based on OpenAPI operation tags (default: true)
62
+ --defaultTag (Requires `--splitByTags`) Default tag for shared code across multiple tags (default: 'Common')
63
+ --excludeTags (Requires `--splitByTags`) Comma-separated list of tags to exclude from generation
63
64
  ```
64
65
 
65
66
  ## Development
@@ -3,5 +3,5 @@ export type GenerateParams = {
3
3
  excludeTags: string;
4
4
  prettier: boolean;
5
5
  verbose: boolean;
6
- } & Pick<GenerateOptions, "input" | "output" | "tsNamespaces" | "splitByTags" | "defaultTag" | "removeOperationPrefixEndingWith" | "importPath" | "extractEnums" | "standalone" | "baseUrl" | "replaceOptionalWithNullish" | "infiniteQueries" | "axiosRequestConfig">;
6
+ } & Pick<GenerateOptions, "input" | "output" | "tsNamespaces" | "splitByTags" | "defaultTag" | "removeOperationPrefixEndingWith" | "importPath" | "extractEnums" | "standalone" | "baseUrl" | "replaceOptionalWithNullish" | "infiniteQueries" | "axiosRequestConfig" | "invalidateQueryOptions">;
7
7
  export declare function generate({ input, excludeTags, prettier, verbose, ...params }: GenerateParams): Promise<void>;
@@ -16,3 +16,9 @@ export declare enum StandaloneAssetEnum {
16
16
  }
17
17
  export declare const STANDALONE_ASSETS: Record<StandaloneAssetEnum, GenerateFile>;
18
18
  export declare const STANDALONE_APP_REST_CLIENT_FILE: GenerateFile;
19
+ export declare const INVALIDATE_QUERIES: {
20
+ optionsType: string;
21
+ functionName: string;
22
+ };
23
+ export declare const INVALIDATE_QUERY_OPTIONS_FILE: GenerateFile;
24
+ export declare const QUERY_MODULES_FILE: GenerateFile;
@@ -14,3 +14,4 @@ export declare const INFINITE_QUERY_RESPONSE_PARAMS: {
14
14
  totalItemsName: string;
15
15
  limitParamName: string;
16
16
  };
17
+ export declare const QUERIES_MODULE_NAME = "moduleName";
@@ -0,0 +1,2 @@
1
+ import { GenerateTypeParams } from "../types/generate";
2
+ export declare function generateQueryModules({ resolver, data }: Omit<GenerateTypeParams, "tag">): string;
@@ -1,6 +1,6 @@
1
1
  import { SchemaResolver } from "src/generators/core/SchemaResolver.class";
2
2
  import { Endpoint } from "../../types/endpoint";
3
- import { Import } from "../../types/generate";
3
+ import { GenerateType, Import } from "../../types/generate";
4
4
  import { GenerateOptions } from "../../types/options";
5
5
  export declare function getModelsImports({ resolver, tag, zodSchemas, zodSchemasAsTypes, }: {
6
6
  resolver: SchemaResolver;
@@ -13,10 +13,13 @@ export declare function getEndpointsImports({ tag, endpoints, options, }: {
13
13
  endpoints: Endpoint[];
14
14
  options: GenerateOptions;
15
15
  }): Import[];
16
- export declare function getAclImports({ tags, entityName, getAliasEntityName, options, }: {
16
+ export declare function getEntityImports({ tags, entityName, getAliasEntityName, type, sameDir, options, }: {
17
17
  tags: string[];
18
18
  entityName: string;
19
19
  getAliasEntityName?: (tag: string) => string;
20
+ type: GenerateType;
21
+ sameDir?: boolean;
20
22
  options: GenerateOptions;
21
23
  }): Import[];
22
- export declare function getImportPath(options: Pick<GenerateOptions, "output" | "importPath">): string;
24
+ export declare function getImportPath(options: Pick<GenerateOptions, "output" | "importPath">, sameDir?: boolean): string;
25
+ export declare function mergeImports(options: GenerateOptions, ...importArrs: Import[][]): Import[];
@@ -1,3 +1,5 @@
1
1
  import { Endpoint } from "../../types/endpoint";
2
2
  export declare const getQueryName: (endpoint: Endpoint) => string;
3
3
  export declare const getInfiniteQueryName: (endpoint: Endpoint) => string;
4
+ export declare const getTagModuleName: (tag: string) => string;
5
+ export declare const getTagKeys: (tag: string) => string;
@@ -16,4 +16,5 @@ export declare const getNamespaceName: ({ type, tag, options, }: {
16
16
  }) => string;
17
17
  export declare function getAppRestClientImportPath(options: GenerateOptions): string;
18
18
  export declare function getQueryTypesImportPath(options: GenerateOptions): string;
19
+ export declare function getInvalidateQueriesImportPath(options: GenerateOptions): string;
19
20
  export {};