Skip to content

Commit 241cf42

Browse files
committed
feat: add --root-security option to support root-level OpenAPI security in generated schemas
1 parent a35b226 commit 241cf42

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

packages/cli/src/bin.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ describe('CLI binary help output', () => {
117117
--explicit-import-extensions [extension] All import statements will contain an explicit file extension. Ideal for projects using ECMAScript modules. (choices: ".js", ".ts", preset: ".js")
118118
--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 when --plugin openapi-typescript is used.
119119
--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.
120+
--root-security Use root-level OpenAPI security as the default for operations without their own security. Operation-level security overrides it according to OpenAPI semantics.
120121
--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 generate several different API client functions from a single OpenAPI document. (default: null)
121122
--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 format: filepath originalModule:importTypeName:customImportPath
122123
--operation-parameters-type-wrapper <parameters wrappers...> Configure ParametersWrapper types for specific operation patterns. Expected format: pattern type:TypeName import:ImportPath. Can be specified multiple times for different patterns.
@@ -214,6 +215,7 @@ describe('CLI binary help output', () => {
214215
--explicit-import-extensions [extension] All import statements will contain an explicit file extension. Ideal for projects using ECMAScript modules. (choices: ".js", ".ts", preset: ".js")
215216
--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 when --plugin openapi-typescript is used. (default: true)
216217
--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.
218+
--root-security Use root-level OpenAPI security as the default for operations without their own security. Operation-level security overrides it according to OpenAPI semantics.
217219
--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 generate several different API client functions from a single OpenAPI document. (default: null)
218220
--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 format: filepath originalModule:importTypeName:customImportPath
219221
--operation-parameters-type-wrapper <parameters wrappers...> Configure ParametersWrapper types for specific operation patterns. Expected format: pattern type:TypeName import:ImportPath. Can be specified multiple times for different patterns.

packages/openapi-plugin/src/lib/QraftCommand.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ export class QraftCommand extends QraftCommandBase<OpenAPIQraftCommandActionOpti
7171
'Use OpenAPI Operation `endpoint[<index>]` path part (e.g.: "/0/1/2") or `tags` as the base name of the service.',
7272
'endpoint[0]'
7373
)
74-
.option(
75-
'--root-security',
76-
'Use root-level OpenAPI security as the default for operations without their own security. Operation-level security overrides it according to OpenAPI semantics.'
77-
)
7874
.addOption(createRedoclyOption());
7975
}
8076

packages/tanstack-query-react-plugin/src/plugin.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export const plugin: QraftCommandPlugin = {
3939
'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.',
4040
parseBooleanOption
4141
)
42+
.option(
43+
'--root-security',
44+
'Use root-level OpenAPI security as the default for operations without their own security. Operation-level security overrides it according to OpenAPI semantics.'
45+
)
4246
.addOption(
4347
(() => {
4448
const option = new Option(

0 commit comments

Comments
 (0)