@openapi-qraft/cli 2.6.3 → 2.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +47 -35
  3. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @openapi-qraft/cli
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 339250c: Global `x-openapi-qraft` configuration has been added to the Redocly config support.
8
+
9
+ This feature has been implemented to allow specifying `x-openapi-qraft` options at the global level in the Redocly
10
+ configuration, rather than repeating the same options for each API client.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [9c1c611]
15
+ - Updated dependencies [c990dc0]
16
+ - @openapi-qraft/tanstack-query-react-plugin@2.7.0
17
+ - @openapi-qraft/plugin@2.7.0
18
+ - @openapi-qraft/openapi-typescript-plugin@1.2.21
19
+
20
+ ## 2.6.4
21
+
22
+ ### Patch Changes
23
+
24
+ - @openapi-qraft/plugin@2.6.4
25
+ - @openapi-qraft/tanstack-query-react-plugin@2.6.4
26
+ - @openapi-qraft/openapi-typescript-plugin@1.2.20
27
+
3
28
  ## 2.6.3
4
29
 
5
30
  ### Patch Changes
package/README.md CHANGED
@@ -24,43 +24,55 @@ Usage: openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript [
24
24
  Generate a type-safe TanStack Query client for React from an OpenAPI Document.
25
25
 
26
26
  Arguments:
27
- input Input OpenAPI Document file path, URL (json, yml) (default: null)
27
+ input Input OpenAPI Document file path, URL (json, yml) (default: null)
28
28
 
29
29
  Options:
30
- -o, --output-dir <path> Output directory for generated services
31
- -rm, --clean Clean output directory before generating services
32
- --filter-services <glob-patterns...> Filter services to be generated using glob patterns. Example: "/user/**,/post/**". For more details, see the NPM `micromatch` package documentation.
33
- --operation-predefined-parameters <patterns...> Predefined parameters for services. The specified service parameters will be optional. Example: "/**:header.x-monite-version,query.x-api-key" or "get /**:header.x-monite-entity-id"
34
- --operation-name-modifier <patterns...> Modifies operation names using a pattern. Use the `==>` operator to separate the regular expression (left) and the substitution string (right). For example: "post /**:[A-Za-z]+Id ==> createOne"
35
- --postfix-services <string> Postfix to be added to the generated service name (eg: Service)
36
- --service-name-base <endpoint[<index>] | tags> Use OpenAPI Operation `endpoint[<index>]` path part (e.g.: "/0/1/2") or `tags` as the base name of the service. (default: "endpoint[0]")
37
- --file-header <string> Header to be added to the generated file (eg: /* eslint-disable */)
38
- --redocly [config] Use the Redocly configuration to generate multiple API clients
39
- If the [config] parameter is not specified, the default Redocly configuration will be used: [redocly.yaml | redocly.yml | .redocly.yaml | .redocly.yml].
40
- For more information about this option, use the command: --redocly-help
41
- Examples: "openapi-qraft --redocly", "openapi-qraft my-api@v1 external-api --redocly", "openapi-qraft --redocly
42
- ./my-redocly-config.yaml"
43
- --openapi-types-import-path <path> Path to schema types file (.d.ts), e.g.: "../schema.d.ts"
44
- --explicit-import-extensions [extension] All import statements will contain an explicit file extension. Ideal for projects using ECMAScript modules. (choices: ".js", ".ts", preset: ".js")
45
- --export-openapi-types [bool] Add an export statement of the generated OpenAPI document types from the `./index.ts' file. Useful for sharing types within your project. (default: true)
46
- --queryable-write-operations [bool] Enable generation of query hooks (useQuery, useSuspenseQuery, etc.) for writable HTTP methods like POST, PUT, PATCH. By default, only mutation hooks are generated for writable operations.
47
- --openapi-types-file-name <path> OpenAPI Schema types file name, e.g.: "schema.d.ts" (default: "schema.ts")
48
- --enum Export true TS enums instead of unions
49
- --enum-values Export enum values as arrays.
50
- --dedupe-enums Dedupe enum types when `--enum` is set
51
- -t, --export-type Export top-level `type` instead of `interface`
52
- --immutable Generate readonly types
53
- --additional-properties Treat schema objects as if `additionalProperties: true` is set
54
- --empty-objects-unknown Generate `unknown` instead of `Record<string, never>` for empty objects
55
- --default-non-nullable Set to `false` to ignore default values when generating non-nullable types
56
- --properties-required-by-default Treat schema objects as if `required` is set to all properties by default
57
- --array-length Generate tuples using array minItems / maxItems
58
- --path-params-as-types Convert paths to template literal types
59
- --alphabetize Sort object keys alphabetically
60
- --exclude-deprecated Exclude deprecated types
61
- --no-blob-from-binary If this option is enabled, binary format fields will not be converted to Blob types, preserving the native representation
62
- --explicit-component-exports Enabling this option will export API components as separate type aliases, alongside `components` interface
63
- -h, --help display help for command
30
+ -o, --output-dir <path> Output directory for generated services
31
+ -rm, --clean Clean output directory before generating services
32
+ --filter-services <glob-patterns...> Filter services to be generated using glob patterns. Example: "/user/**,/post/**". For more details, see the NPM `micromatch` package documentation.
33
+ --operation-predefined-parameters <patterns...> Predefined parameters for services. The specified service parameters will be optional. Example: "/**:header.x-monite-version,query.x-api-key" or
34
+ "get /**:header.x-monite-entity-id"
35
+ --operation-name-modifier <patterns...> Modifies operation names using a pattern. Use the `==>` operator to separate the regular expression (left) and the substitution string (right). For
36
+ example: "post /**:[A-Za-z]+Id ==> createOne"
37
+ --postfix-services <string> Postfix to be added to the generated service name (eg: Service)
38
+ --service-name-base <endpoint[<index>] | tags> Use OpenAPI Operation `endpoint[<index>]` path part (e.g.: "/0/1/2") or `tags` as the base name of the service. (default: "endpoint[0]")
39
+ --file-header <string> Header to be added to the generated file (eg: /* eslint-disable */)
40
+ --redocly [config] Use the Redocly configuration to generate multiple API clients
41
+ If the [config] parameter is not specified, the default Redocly configuration will be used: [redocly.yaml | redocly.yml | .redocly.yaml |
42
+ .redocly.yml].
43
+ For more information about this option, use the command: --redocly-help
44
+ Examples:
45
+ $ bin --redocly
46
+ $ bin my-api --redocly
47
+ $ bin my-api@v1 my-api@v2 --redocly
48
+ $ bin --redocly ./my-redocly-config.yaml
49
+ --openapi-types-import-path <path> Path to schema types file (.d.ts), e.g.: "../schema.d.ts"
50
+ --explicit-import-extensions [extension] All import statements will contain an explicit file extension. Ideal for projects using ECMAScript modules. (choices: ".js", ".ts", preset: ".js")
51
+ --export-openapi-types [bool] Add an export statement of the generated OpenAPI document types from the `./index.ts' file. Useful for sharing types within your project. Default:
52
+ true when --plugin openapi-typescript is used. (default: true)
53
+ --queryable-write-operations [bool] Enable generation of query hooks (useQuery, useSuspenseQuery, etc.) for writable HTTP methods like POST, PUT, PATCH. By default, only mutation hooks
54
+ are generated for writable operations.
55
+ --create-api-client-fn <functionName> [options...] Configure API client creation function. Allows specifying the function name, included services, and callbacks. Can be specified multiple times to
56
+ generate several different API client functions from a single OpenAPI document. (default: null)
57
+ --override-import-type <pathname overrides...> Override import paths for specific types in generated files. This allows using custom type implementations instead of the default ones. Expected
58
+ format: filepath originalModule:importTypeName:customImportPath
59
+ --openapi-types-file-name <path> OpenAPI Schema types file name, e.g.: "schema.d.ts" (default: "schema.ts")
60
+ --enum Export true TS enums instead of unions
61
+ --enum-values Export enum values as arrays.
62
+ --dedupe-enums Dedupe enum types when `--enum` is set
63
+ -t, --export-type Export top-level `type` instead of `interface`
64
+ --immutable Generate readonly types
65
+ --additional-properties Treat schema objects as if `additionalProperties: true` is set
66
+ --empty-objects-unknown Generate `unknown` instead of `Record<string, never>` for empty objects
67
+ --default-non-nullable Set to `false` to ignore default values when generating non-nullable types
68
+ --properties-required-by-default Treat schema objects as if `required` is set to all properties by default
69
+ --array-length Generate tuples using array minItems / maxItems
70
+ --path-params-as-types Convert paths to template literal types
71
+ --alphabetize Sort object keys alphabetically
72
+ --exclude-deprecated Exclude deprecated types
73
+ --no-blob-from-binary If this option is enabled, binary format fields will not be converted to Blob types, preserving the native representation
74
+ --explicit-component-exports Enabling this option will export API components as separate type aliases, alongside `components` interface
75
+ -h, --help display help for command
64
76
  ```
65
77
 
66
78
  ## Usage example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openapi-qraft/cli",
3
- "version": "2.6.3",
3
+ "version": "2.7.0",
4
4
  "description": "CLI for generating typed TanStack Query React Hooks and services from OpenAPI Document, improving type safety in React apps",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.build.json",
@@ -15,9 +15,9 @@
15
15
  "openapi-qraft": "./bin.mjs"
16
16
  },
17
17
  "dependencies": {
18
- "@openapi-qraft/openapi-typescript-plugin": "1.2.19",
19
- "@openapi-qraft/plugin": "2.6.3",
20
- "@openapi-qraft/tanstack-query-react-plugin": "2.6.3",
18
+ "@openapi-qraft/openapi-typescript-plugin": "1.2.21",
19
+ "@openapi-qraft/plugin": "2.7.0",
20
+ "@openapi-qraft/tanstack-query-react-plugin": "2.7.0",
21
21
  "commander": "^11.1.0"
22
22
  },
23
23
  "devDependencies": {