From 18487d87ab66c9535bd4ef25ac4716b6089119d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=9A=80=20Jack?= Date: Fri, 11 Aug 2023 16:20:06 +1000 Subject: [PATCH] feat(type-safe-api): generate infinite query hooks for smithy operations with paginated trait Instead of through the "jsonAdd" escape hatch, we now support using the @paginated trait in Smithy to generate useInfiniteQuery hooks in the TypeScript React Hooks library. The escape hatch will still work, since we still support specifying "x-paginated" for the OpenAPI use case. We achieve this by reading traits from the Smithy JSON model generated as part of the openapi projection (the model build task), and injecting them into the OpenAPI spec prior to code generation. --- .../typescript_react_query_hooks.md | 190 +--- .../type-safe-api/scripts/generators/generate | 6 +- .../scripts/generators/pre-process-spec.ts | 58 +- .../src/project/codegen/components/utils.ts | 10 +- .../src/project/codegen/generate.ts | 7 + ...nerated-java-cdk-infrastructure-project.ts | 46 +- ...rated-python-cdk-infrastructure-project.ts | 44 +- ...d-typescript-cdk-infrastructure-project.ts | 50 +- .../typescript-react-query-hooks-library.ts | 21 +- .../runtime/generated-java-runtime-project.ts | 22 +- .../generated-python-runtime-project.ts | 22 +- .../generated-typescript-runtime-project.ts | 21 +- .../project/model/smithy/smithy-definition.ts | 16 +- .../src/project/type-safe-api-project.ts | 19 +- packages/type-safe-api/src/project/types.ts | 14 + .../type-safe-api-project.test.ts.snap | 86 +- .../smithy/simple-pagination/model.json | 1000 +++++++++++++++++ .../smithy/simple-pagination/openapi.json | 235 ++++ .../typescript-react-query-hooks.test.ts.snap | 84 ++ .../typescript-react-query-hooks.test.ts | 48 + 20 files changed, 1683 insertions(+), 316 deletions(-) create mode 100644 packages/type-safe-api/test/resources/smithy/simple-pagination/model.json create mode 100644 packages/type-safe-api/test/resources/smithy/simple-pagination/openapi.json diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/typescript_react_query_hooks.md b/packages/type-safe-api/docs/developer_guides/type-safe-api/typescript_react_query_hooks.md index a90f86df4..7e7d60236 100644 --- a/packages/type-safe-api/docs/developer_guides/type-safe-api/typescript_react_query_hooks.md +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/typescript_react_query_hooks.md @@ -155,139 +155,67 @@ export const MyComponent: FC = () => { ## Paginated Operations -You can generate `useInfiniteQuery` hooks instead of `useQuery` hooks for paginated API operations, by making use of the vendor extension `x-paginated` in your operation in the OpenAPI specification. You must specify both the `inputToken` and `outputToken`, which indicate the properties from the input and output used for pagination. For example in OpenAPI: - -```yaml -paths: - /pets: - get: - x-paginated: - # Input property with the token to request the next page - inputToken: nextToken - # Output property with the token to request the next page - outputToken: nextToken - parameters: - - in: query - name: nextToken - schema: - type: string - required: true - responses: - 200: - description: Successful response - content: - application/json: - schema: - type: object - properties: - nextToken: - type: string -``` - -In Smithy, until [custom vendor extensions can be rendered via traits](https://github.com/awslabs/smithy/pull/1609), you can add the `x-paginated` vendor extension via `smithyBuildOptions` in your `TypeSafeApiProject`, for example: - -=== "TS" - - ```ts - new TypeSafeApiProject({ - model: { - language: ModelLanguage.SMITHY, - options: { - smithy: { - serviceName: { - namespace: 'com.mycompany', - serviceName: 'MyApi', - }, - smithyBuildOptions: { - projections: { - openapi: { - plugins: { - openapi: { - jsonAdd: { - // Add the x-paginated vendor extension to the GET /pets operation - '/paths/~1pets/get/x-paginated': { - inputToken: 'nextToken', - outputToken: 'nextToken', - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - ... - }); - ``` - -=== "JAVA" - - ```java - TypeSafeApiProject.Builder.create() - .model(ModelConfiguration.builder() - .language(ModelLanguage.SMITHY) - .options(ModelOptions.builder() - .smithy(SmithyModelOptions.builder() - .smithyBuildOptions(SmithyBuildOptions.builder() - .projections(Map.of( - "openapi", SmithyProjection.builder() - .plugins(Map.of( - "openapi", Map.of( - "jsonAdd", Map.of( - // Add the x-paginated vendor extension to the GET /pets operation - "/paths/~1pets/get/x-paginated", Map.of( - "inputToken", "nextToken", - "outputToken", "nextToken") - ) - ) - )) - .build() - )) - .build()) - .build()) - .build()) - .build()) - ... - .build()) - .build(); +You can generate `useInfiniteQuery` hooks instead of `useQuery` hooks for paginated API operations by configuring the operation in your model. The configuration requires both an `inputToken` (specifies the input property used to request the next page), and an `outputToken` (specifies the output property in which the pagination token is returned) to be present. + +=== "SMITHY" + + In Smithy, annotate your paginated API operations with the `@paginated` trait, making sure both `inputToken` and `outputToken` are specified: + + ```smithy + @readonly + @http(method: "GET", uri: "/pets") + @paginated(inputToken: "nextToken", outputToken: "nextToken", items: "pets") // <- @paginated trait + operation ListPets { + input := { + // Corresponds to inputToken + @httpQuery("nextToken") + nextToken: String + } + output := { + @required + pets: Pets + + // Corresponds to outputToken + nextToken: String + } + } + + list Pets { + member: Pet + } ``` -=== "PYTHON" - - ```python - TypeSafeApiProject( - model={ - "language": ModelLanguage.SMITHY, - "options": { - "smithy": { - "service_name": { - "namespace": "com.mycompany", - "service_name": "MyApi" - }, - "smithy_build_options": { - "projections": { - "openapi": { - "plugins": { - "openapi": { - "json_add": { - # Add the x-paginated vendor extension to the GET /pets operation - "/paths/~1pets/get/x-paginated": { - "input_token": "nextToken", - "output_token": "nextToken" - } - } - } - } - } - } - } - } - } - }, - ... - ) +=== "OPENAPI" + + In OpenAPI, use the `x-paginaged` vendor extension in your operation, making sure both `inputToken` and `outputToken` are specified: + + ```yaml + paths: + /pets: + get: + x-paginated: + # Input property with the token to request the next page + inputToken: nextToken + # Output property with the token to request the next page + outputToken: nextToken + parameters: + - in: query + name: nextToken + schema: + type: string + required: true + responses: + 200: + description: Successful response + content: + application/json: + schema: + type: object + properties: + nextToken: + type: string + pets: + $ref: "#/components/schemas/Pets" ``` ## Custom QueryClient diff --git a/packages/type-safe-api/scripts/generators/generate b/packages/type-safe-api/scripts/generators/generate index 453180a02..983e4be98 100755 --- a/packages/type-safe-api/scripts/generators/generate +++ b/packages/type-safe-api/scripts/generators/generate @@ -12,6 +12,7 @@ openapi_normalizer='' src_dir='src' extra_vendor_extensions='' generate_alias_as_model='' +smithy_json_path='' while [[ "$#" -gt 0 ]]; do case $1 in --spec-path) spec_path="$2"; shift;; --output-path) output_path="$2"; shift;; @@ -21,6 +22,7 @@ while [[ "$#" -gt 0 ]]; do case $1 in --openapi-normalizer) openapi_normalizer="$2"; shift;; --src-dir) src_dir="$2"; shift;; --extra-vendor-extensions) extra_vendor_extensions="$2"; shift;; + --smithy-json-path) smithy_json_path="$2"; shift;; --generate-alias-as-model) generate_alias_as_model='true'; ;; esac; shift; done @@ -53,11 +55,11 @@ install_packages \ openapi-types@12.1.0 # Pre-process the spec to add any extra vendor extensions used for code generation only. -# This allows for custom parameters to be passed to the code generation templates. +# This allows for custom parameters to be passed to the code generation templates, and smithy traits to be accessed during codegen log "preprocess spec :: $spec_path" processed_spec_path="$tmp_dir/.preprocessed-api.json" cp $script_dir/pre-process-spec.ts . -run_command ts-node pre-process-spec.ts --specPath="$working_dir/$spec_path" --outputSpecPath="$processed_spec_path" --extraVendorExtensions="$extra_vendor_extensions" +run_command ts-node pre-process-spec.ts --specPath="$working_dir/$spec_path" --outputSpecPath="$processed_spec_path" --extraVendorExtensions="$extra_vendor_extensions" ${smithy_json_path:+"--smithyJsonPath=$working_dir/$smithy_json_path"} # Support a special placeholder of {{src}} in config.yaml to ensure our custom templates get written to the correct folder sed 's|{{src}}|'"$src_dir"'|g' config.yaml > config.final.yaml diff --git a/packages/type-safe-api/scripts/generators/pre-process-spec.ts b/packages/type-safe-api/scripts/generators/pre-process-spec.ts index 36aaa3407..f22bf301f 100644 --- a/packages/type-safe-api/scripts/generators/pre-process-spec.ts +++ b/packages/type-safe-api/scripts/generators/pre-process-spec.ts @@ -5,11 +5,23 @@ import * as path from "path"; import SwaggerParser from "@apidevtools/swagger-parser"; import { parse } from "ts-command-line-args"; +// Smithy HTTP trait is used to map Smithy operations to their location in the spec +const SMITHY_HTTP_TRAIT_ID = "smithy.api#http"; + +// Maps traits to specific vendor extensions which we also support specifying in OpenAPI +const TRAIT_TO_SUPPORTED_OPENAPI_VENDOR_EXTENSION: { [key: string]: string } = { + "smithy.api#paginated": "x-paginated", +}; + interface Arguments { /** * Path to the spec to preprocess */ readonly specPath: string; + /** + * Path to the smithy json model + */ + readonly smithyJsonPath?: string; /** * JSON string containing extra vendor extensions to add to the spec */ @@ -20,14 +32,58 @@ interface Arguments { readonly outputSpecPath: string; } +interface SmithyOperationDetails { + readonly id: string; + readonly method: string; + readonly path: string; + readonly traits: { [key: string]: any }; +} + void (async () => { const args = parse({ specPath: { type: String }, + smithyJsonPath: { type: String, optional: true }, extraVendorExtensions: { type: String, optional: true }, outputSpecPath: { type: String }, }); - const spec = await SwaggerParser.bundle(args.specPath); + const spec = (await SwaggerParser.bundle(args.specPath)) as any; + + if (args.smithyJsonPath) { + // Read the operations out of the Smithy model + const smithyModel = JSON.parse( + fs.readFileSync(args.smithyJsonPath, "utf-8") + ); + const operations: SmithyOperationDetails[] = Object.entries( + smithyModel.shapes + ) + .filter( + ([, shape]: [string, any]) => + shape.type === "operation" && + shape.traits && + SMITHY_HTTP_TRAIT_ID in shape.traits + ) + .map(([id, shape]: [string, any]) => ({ + id, + method: shape.traits[SMITHY_HTTP_TRAIT_ID].method?.toLowerCase(), + path: shape.traits[SMITHY_HTTP_TRAIT_ID].uri, + traits: shape.traits, + })); + + // Apply all operation-level traits as vendor extensions to the relevant operation in the spec + operations.forEach((operation) => { + if (spec.paths?.[operation.path]?.[operation.method]) { + Object.entries(operation.traits).forEach(([traitId, value]) => { + // By default, we use x- for the vendor extension, but for extensions we support + // directly from OpenAPI we apply a mapping (rather than repeat ourselves in the mustache templates). + const vendorExtension = + TRAIT_TO_SUPPORTED_OPENAPI_VENDOR_EXTENSION[traitId] ?? + `x-${traitId}`; + spec.paths[operation.path][operation.method][vendorExtension] = value; + }); + } + }); + } const processedSpec = { ...spec, diff --git a/packages/type-safe-api/src/project/codegen/components/utils.ts b/packages/type-safe-api/src/project/codegen/components/utils.ts index a191a28eb..6e99f5c09 100644 --- a/packages/type-safe-api/src/project/codegen/components/utils.ts +++ b/packages/type-safe-api/src/project/codegen/components/utils.ts @@ -79,6 +79,10 @@ export interface GenerationOptions { * @default true */ readonly generateAliasAsModel?: boolean; + /** + * The path to the json smithy model file, if available + */ + readonly smithyJsonPath?: string; } /** @@ -131,10 +135,14 @@ export const buildInvokeOpenApiGeneratorCommandArgs = ( const generateAliasAsModel = options.generateAliasAsModel ?? true ? " --generate-alias-as-model" : ""; + const smithyJsonPath = options.smithyJsonPath + ? ` --smithy-json-path ${options.smithyJsonPath}` + : ""; + const specPath = options.specPath; const outputPath = "."; - return `--generator ${options.generator} --spec-path ${specPath} --output-path ${outputPath} --generator-dir ${options.generatorDirectory} --src-dir ${srcDir}${additionalProperties}${normalizers}${extensions}${generateAliasAsModel}`; + return `--generator ${options.generator} --spec-path ${specPath} --output-path ${outputPath} --generator-dir ${options.generatorDirectory} --src-dir ${srcDir}${smithyJsonPath}${additionalProperties}${normalizers}${extensions}${generateAliasAsModel}`; }; /** diff --git a/packages/type-safe-api/src/project/codegen/generate.ts b/packages/type-safe-api/src/project/codegen/generate.ts index 45656c850..2e8dd4c9b 100644 --- a/packages/type-safe-api/src/project/codegen/generate.ts +++ b/packages/type-safe-api/src/project/codegen/generate.ts @@ -60,6 +60,10 @@ export interface GenerateProjectsOptions { * We use the parsed spec such that refs are resolved to support multi-file specs */ readonly parsedSpecPath: string; + /** + * Path to the Smithy json model, if applicable + */ + readonly smithyJsonModelPath?: string; } /** @@ -140,6 +144,7 @@ const generateRuntimeProject = ( outdir: path.join(options.generatedCodeDir, language), specPath: options.parsedSpecPath, parent: options.parent, + smithyJsonModelPath: options.smithyJsonModelPath, }; switch (language) { @@ -213,6 +218,7 @@ export const generateInfraProject = ( outdir: path.join(options.generatedCodeDir, language), specPath: options.parsedSpecPath, parent: options.parent, + smithyJsonModelPath: options.smithyJsonModelPath, }; switch (language) { @@ -314,6 +320,7 @@ const generateLibraryProject = ( outdir: path.join(options.generatedCodeDir, library), specPath: options.parsedSpecPath, parent: options.parent, + smithyJsonModelPath: options.smithyJsonModelPath, }; switch (library) { diff --git a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-java-cdk-infrastructure-project.ts b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-java-cdk-infrastructure-project.ts index 9ddc9cbde..847b82b23 100644 --- a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-java-cdk-infrastructure-project.ts +++ b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-java-cdk-infrastructure-project.ts @@ -4,8 +4,8 @@ import * as path from "path"; import { DependencyType } from "projen"; import { JavaProject } from "projen/lib/java"; import { + CodeGenerationSourceOptions, GeneratedJavaInfrastructureOptions, - MockResponseDataGenerationOptions, } from "../../../types"; import { OpenApiGeneratorIgnoreFile } from "../../components/open-api-generator-ignore-file"; import { OpenApiToolsJsonFile } from "../../components/open-api-tools-json-file"; @@ -20,11 +20,8 @@ import { import { GeneratedJavaRuntimeProject } from "../../runtime/generated-java-runtime-project"; export interface GeneratedJavaCdkInfrastructureProjectOptions - extends GeneratedJavaInfrastructureOptions { - /** - * OpenAPI spec path, relative to the project outdir - */ - readonly specPath: string; + extends GeneratedJavaInfrastructureOptions, + CodeGenerationSourceOptions { /** * The generated java types */ @@ -33,16 +30,10 @@ export interface GeneratedJavaCdkInfrastructureProjectOptions export class GeneratedJavaCdkInfrastructureProject extends JavaProject { /** - * Path to the openapi specification - * @private - */ - private readonly specPath: string; - - /** - * The generated java types + * Options configured for the project * @private */ - private readonly generatedJavaTypes: GeneratedJavaRuntimeProject; + private readonly options: GeneratedJavaCdkInfrastructureProjectOptions; /** * Source directory @@ -56,21 +47,13 @@ export class GeneratedJavaCdkInfrastructureProject extends JavaProject { */ private readonly packageName: string; - /** - * Mock data generator options - * @private - */ - private readonly mockDataOptions?: MockResponseDataGenerationOptions; - constructor(options: GeneratedJavaCdkInfrastructureProjectOptions) { super({ ...options, sample: false, junit: false, }); - this.specPath = options.specPath; - this.generatedJavaTypes = options.generatedJavaTypes; - this.mockDataOptions = options.mockDataOptions; + this.options = options; this.packageName = `${this.pom.groupId}.${this.name}.infra`; this.srcDir = path.join( "src", @@ -133,8 +116,10 @@ export class GeneratedJavaCdkInfrastructureProject extends JavaProject { ); // Copy the parsed spec into the resources directory so that it's included in the jar generateTask.exec("mkdir -p src/main/resources"); - generateTask.exec(`cp -f ${this.specPath} src/main/resources/.api.json`); - if (!this.mockDataOptions?.disable) { + generateTask.exec( + `cp -f ${this.options.specPath} src/main/resources/.api.json` + ); + if (!this.options.mockDataOptions?.disable) { generateTask.exec(this.buildGenerateMockDataCommand()); } @@ -147,7 +132,8 @@ export class GeneratedJavaCdkInfrastructureProject extends JavaProject { public buildGenerateCommandArgs = () => { return buildInvokeOpenApiGeneratorCommandArgs({ generator: "java", - specPath: this.specPath, + specPath: this.options.specPath, + smithyJsonPath: this.options.smithyJsonModelPath, generatorDirectory: OtherGenerators.JAVA_CDK_INFRASTRUCTURE, srcDir: this.srcDir, normalizers: { @@ -155,9 +141,9 @@ export class GeneratedJavaCdkInfrastructureProject extends JavaProject { }, extraVendorExtensions: { "x-infrastructure-package": this.packageName, - "x-runtime-package": this.generatedJavaTypes.packageName, + "x-runtime-package": this.options.generatedJavaTypes.packageName, // Enable mock integration generation by default - "x-enable-mock-integrations": !this.mockDataOptions?.disable, + "x-enable-mock-integrations": !this.options.mockDataOptions?.disable, }, // Do not generate map/list types. Generator will use built in HashMap, ArrayList instead generateAliasAsModel: false, @@ -166,10 +152,10 @@ export class GeneratedJavaCdkInfrastructureProject extends JavaProject { public buildGenerateMockDataCommand = (): string => { return buildInvokeMockDataGeneratorCommand({ - specPath: this.specPath, + specPath: this.options.specPath, // Write the mocks to the resources directory outputSubDir: "src/main/resources", - ...this.mockDataOptions, + ...this.options.mockDataOptions, }); }; } diff --git a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-python-cdk-infrastructure-project.ts b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-python-cdk-infrastructure-project.ts index ab3a21c5b..67010e0bb 100644 --- a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-python-cdk-infrastructure-project.ts +++ b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-python-cdk-infrastructure-project.ts @@ -4,8 +4,8 @@ import * as path from "path"; import { DependencyType } from "projen"; import { PythonProject } from "projen/lib/python"; import { + CodeGenerationSourceOptions, GeneratedPythonInfrastructureOptions, - MockResponseDataGenerationOptions, } from "../../../types"; import { OpenApiGeneratorIgnoreFile } from "../../components/open-api-generator-ignore-file"; import { OpenApiToolsJsonFile } from "../../components/open-api-tools-json-file"; @@ -20,11 +20,8 @@ import { import { GeneratedPythonRuntimeProject } from "../../runtime/generated-python-runtime-project"; export interface GeneratedPythonCdkInfrastructureProjectOptions - extends GeneratedPythonInfrastructureOptions { - /** - * OpenAPI spec path, relative to the project outdir - */ - readonly specPath: string; + extends GeneratedPythonInfrastructureOptions, + CodeGenerationSourceOptions { /** * The generated python types */ @@ -33,22 +30,10 @@ export interface GeneratedPythonCdkInfrastructureProjectOptions export class GeneratedPythonCdkInfrastructureProject extends PythonProject { /** - * Path to the openapi specification - * @private - */ - private readonly specPath: string; - - /** - * The generated python types - * @private - */ - private readonly generatedPythonTypes: GeneratedPythonRuntimeProject; - - /** - * Mock data generator options + * Options configured for the project * @private */ - private readonly mockDataOptions?: MockResponseDataGenerationOptions; + private readonly options: GeneratedPythonCdkInfrastructureProjectOptions; constructor(options: GeneratedPythonCdkInfrastructureProjectOptions) { super({ @@ -62,9 +47,7 @@ export class GeneratedPythonCdkInfrastructureProject extends PythonProject { }, ...options, }); - this.specPath = options.specPath; - this.generatedPythonTypes = options.generatedPythonTypes; - this.mockDataOptions = options.mockDataOptions; + this.options = options; [ "aws_prototyping_sdk.type_safe_api@^0", @@ -103,7 +86,7 @@ export class GeneratedPythonCdkInfrastructureProject extends PythonProject { this.buildGenerateCommandArgs() ) ); - if (!this.mockDataOptions?.disable) { + if (!this.options.mockDataOptions?.disable) { generateTask.exec(this.buildGenerateMockDataCommand()); } @@ -127,7 +110,8 @@ export class GeneratedPythonCdkInfrastructureProject extends PythonProject { public buildGenerateCommandArgs = () => { return buildInvokeOpenApiGeneratorCommandArgs({ generator: "python", - specPath: this.specPath, + specPath: this.options.specPath, + smithyJsonPath: this.options.smithyJsonModelPath, generatorDirectory: OtherGenerators.PYTHON_CDK_INFRASTRUCTURE, // Tell the generator where python source files live srcDir: this.moduleName, @@ -135,19 +119,19 @@ export class GeneratedPythonCdkInfrastructureProject extends PythonProject { KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, }, extraVendorExtensions: { - "x-runtime-module-name": this.generatedPythonTypes.moduleName, + "x-runtime-module-name": this.options.generatedPythonTypes.moduleName, // Spec path relative to the source directory - "x-relative-spec-path": path.join("..", this.specPath), + "x-relative-spec-path": path.join("..", this.options.specPath), // Enable mock integration generation by default - "x-enable-mock-integrations": !this.mockDataOptions?.disable, + "x-enable-mock-integrations": !this.options.mockDataOptions?.disable, }, }); }; public buildGenerateMockDataCommand = () => { return buildInvokeMockDataGeneratorCommand({ - specPath: this.specPath, - ...this.mockDataOptions, + specPath: this.options.specPath, + ...this.options.mockDataOptions, }); }; } diff --git a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project.ts b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project.ts index db5a8aa07..2243df2e0 100644 --- a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project.ts +++ b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project.ts @@ -5,8 +5,8 @@ import { DependencyType, IgnoreFile } from "projen"; import { NodePackageManager } from "projen/lib/javascript"; import { TypeScriptProject } from "projen/lib/typescript"; import { + CodeGenerationSourceOptions, GeneratedTypeScriptInfrastructureOptions, - MockResponseDataGenerationOptions, } from "../../../types"; import { OpenApiGeneratorIgnoreFile } from "../../components/open-api-generator-ignore-file"; import { OpenApiToolsJsonFile } from "../../components/open-api-tools-json-file"; @@ -21,11 +21,8 @@ import { import { GeneratedTypescriptRuntimeProject } from "../../runtime/generated-typescript-runtime-project"; export interface GeneratedTypescriptCdkInfrastructureProjectOptions - extends GeneratedTypeScriptInfrastructureOptions { - /** - * OpenAPI spec path, relative to the project outdir - */ - readonly specPath: string; + extends GeneratedTypeScriptInfrastructureOptions, + CodeGenerationSourceOptions { /** * Generated typescript types project */ @@ -39,22 +36,10 @@ export interface GeneratedTypescriptCdkInfrastructureProjectOptions export class GeneratedTypescriptCdkInfrastructureProject extends TypeScriptProject { /** - * Path to the openapi specification - * @private - */ - private readonly specPath: string; - - /** - * The generated typescript types + * Options configured for the project * @private */ - private readonly generatedTypescriptTypes: GeneratedTypescriptRuntimeProject; - - /** - * Mock data generator options - * @private - */ - private readonly mockDataOptions?: MockResponseDataGenerationOptions; + private readonly options: GeneratedTypescriptCdkInfrastructureProjectOptions; /** * Path to the packaged copy of the openapi specification @@ -81,9 +66,7 @@ export class GeneratedTypescriptCdkInfrastructureProject extends TypeScriptProje }, npmignoreEnabled: false, }); - this.specPath = options.specPath; - this.generatedTypescriptTypes = options.generatedTypescriptTypes; - this.mockDataOptions = options.mockDataOptions; + this.options = options; this.addDeps( ...[ @@ -134,13 +117,15 @@ export class GeneratedTypescriptCdkInfrastructureProject extends TypeScriptProje this.buildGenerateCommandArgs() ) ); - if (!this.mockDataOptions?.disable) { + if (!this.options.mockDataOptions?.disable) { generateTask.exec(this.buildGenerateMockDataCommand()); } // Copy the api spec to within the package generateTask.exec(`mkdir -p ${path.dirname(this.packagedSpecPath)}`); - generateTask.exec(`cp -f ${this.specPath} ${this.packagedSpecPath}`); + generateTask.exec( + `cp -f ${this.options.specPath} ${this.packagedSpecPath}` + ); this.gitignore.addPatterns(`/${this.packagedSpecPath}`); this.preCompileTask.spawn(generateTask); @@ -157,7 +142,7 @@ export class GeneratedTypescriptCdkInfrastructureProject extends TypeScriptProje this.tasks .tryFind("install") ?.prependExec( - `${this.package.packageManager} link ${this.generatedTypescriptTypes.package.packageName}` + `${this.package.packageManager} link ${this.options.generatedTypescriptTypes.package.packageName}` ); break; case NodePackageManager.PNPM: @@ -166,7 +151,7 @@ export class GeneratedTypescriptCdkInfrastructureProject extends TypeScriptProje ?.prependExec( `${this.package.packageManager} link /${path.relative( this.outdir, - this.generatedTypescriptTypes.outdir + this.options.generatedTypescriptTypes.outdir )}` ); break; @@ -181,7 +166,8 @@ export class GeneratedTypescriptCdkInfrastructureProject extends TypeScriptProje public buildGenerateCommandArgs = () => { return buildInvokeOpenApiGeneratorCommandArgs({ generator: "typescript-fetch", - specPath: this.specPath, + specPath: this.options.specPath, + smithyJsonPath: this.options.smithyJsonModelPath, generatorDirectory: OtherGenerators.TYPESCRIPT_CDK_INFRASTRUCTURE, srcDir: this.srcdir, normalizers: { @@ -189,19 +175,19 @@ export class GeneratedTypescriptCdkInfrastructureProject extends TypeScriptProje }, extraVendorExtensions: { "x-runtime-package-name": - this.generatedTypescriptTypes.package.packageName, + this.options.generatedTypescriptTypes.package.packageName, // Spec path relative to the source directory "x-relative-spec-path": path.join("..", this.packagedSpecPath), // Enable mock integration generation by default - "x-enable-mock-integrations": !this.mockDataOptions?.disable, + "x-enable-mock-integrations": !this.options.mockDataOptions?.disable, }, }); }; public buildGenerateMockDataCommand = () => { return buildInvokeMockDataGeneratorCommand({ - specPath: this.specPath, - ...this.mockDataOptions, + specPath: this.options.specPath, + ...this.options.mockDataOptions, }); }; } diff --git a/packages/type-safe-api/src/project/codegen/library/typescript-react-query-hooks-library.ts b/packages/type-safe-api/src/project/codegen/library/typescript-react-query-hooks-library.ts index 1cedc7bf2..e0046decc 100644 --- a/packages/type-safe-api/src/project/codegen/library/typescript-react-query-hooks-library.ts +++ b/packages/type-safe-api/src/project/codegen/library/typescript-react-query-hooks-library.ts @@ -4,7 +4,10 @@ import { NodePackageUtils } from "@aws-prototyping-sdk/nx-monorepo"; import { NodePackageManager, TypeScriptJsxMode } from "projen/lib/javascript"; import { TypeScriptProject } from "projen/lib/typescript"; import { Library } from "../../languages"; -import { GeneratedTypeScriptReactQueryHooksOptions } from "../../types"; +import { + CodeGenerationSourceOptions, + GeneratedTypeScriptReactQueryHooksOptions, +} from "../../types"; import { OpenApiGeneratorHandlebarsIgnoreFile } from "../components/open-api-generator-handlebars-ignore-file"; import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; @@ -19,11 +22,8 @@ import { * Configuration for the generated typescript client project */ export interface GeneratedTypescriptReactQueryHooksProjectOptions - extends GeneratedTypeScriptReactQueryHooksOptions { - /** - * The path to the OpenAPI specification, relative to this project's outdir - */ - readonly specPath: string; + extends GeneratedTypeScriptReactQueryHooksOptions, + CodeGenerationSourceOptions { /** * Whether this project is parented by an nx-monorepo or not */ @@ -45,10 +45,10 @@ export class TypescriptReactQueryHooksLibrary extends TypeScriptProject { ]; /** - * Path to the openapi specification + * Options configured for the project * @private */ - private readonly specPath: string; + private readonly options: GeneratedTypescriptReactQueryHooksProjectOptions; constructor(options: GeneratedTypescriptReactQueryHooksProjectOptions) { super({ @@ -79,7 +79,7 @@ export class TypescriptReactQueryHooksLibrary extends TypeScriptProject { npmignoreEnabled: false, }); - this.specPath = options.specPath; + this.options = options; // Disable strict peer dependencies for pnpm as the default typescript project dependencies have type mismatches // (ts-jest@27 and @types/jest@28) @@ -156,7 +156,8 @@ export class TypescriptReactQueryHooksLibrary extends TypeScriptProject { public buildGenerateCommandArgs = () => { return buildInvokeOpenApiGeneratorCommandArgs({ generator: "typescript-fetch", - specPath: this.specPath, + specPath: this.options.specPath, + smithyJsonPath: this.options.smithyJsonModelPath, generatorDirectory: Library.TYPESCRIPT_REACT_QUERY_HOOKS, additionalProperties: { npmName: this.package.packageName, diff --git a/packages/type-safe-api/src/project/codegen/runtime/generated-java-runtime-project.ts b/packages/type-safe-api/src/project/codegen/runtime/generated-java-runtime-project.ts index 0fea7c37c..dcacbd53a 100644 --- a/packages/type-safe-api/src/project/codegen/runtime/generated-java-runtime-project.ts +++ b/packages/type-safe-api/src/project/codegen/runtime/generated-java-runtime-project.ts @@ -3,7 +3,10 @@ SPDX-License-Identifier: Apache-2.0 */ import * as path from "path"; import { JavaProject } from "projen/lib/java"; import { Language } from "../../languages"; -import { GeneratedJavaRuntimeOptions } from "../../types"; +import { + CodeGenerationSourceOptions, + GeneratedJavaRuntimeOptions, +} from "../../types"; import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; import { @@ -17,12 +20,8 @@ import { * Configuration for the generated java runtime project */ export interface GeneratedJavaTypesProjectOptions - extends GeneratedJavaRuntimeOptions { - /** - * The path to the OpenAPI specification, relative to this project's outdir - */ - readonly specPath: string; -} + extends GeneratedJavaRuntimeOptions, + CodeGenerationSourceOptions {} const DEPENDENCIES: string[] = [ // Required for open api generated code @@ -79,10 +78,10 @@ export class GeneratedJavaRuntimeProject extends JavaProject { public readonly packageName: string; /** - * Path to the openapi specification + * Options configured for the project * @private */ - private readonly specPath: string; + private readonly options: GeneratedJavaTypesProjectOptions; constructor(options: GeneratedJavaTypesProjectOptions) { super({ @@ -90,7 +89,7 @@ export class GeneratedJavaRuntimeProject extends JavaProject { junit: false, ...options, }); - this.specPath = options.specPath; + this.options = options; // Ignore files that we will control via projen const ignoreFile = new OpenApiGeneratorIgnoreFile(this); @@ -134,7 +133,8 @@ export class GeneratedJavaRuntimeProject extends JavaProject { public buildGenerateCommandArgs = () => { return buildInvokeOpenApiGeneratorCommandArgs({ generator: "java", - specPath: this.specPath, + specPath: this.options.specPath, + smithyJsonPath: this.options.smithyJsonModelPath, generatorDirectory: Language.JAVA, additionalProperties: { useSingleRequestParameter: "true", diff --git a/packages/type-safe-api/src/project/codegen/runtime/generated-python-runtime-project.ts b/packages/type-safe-api/src/project/codegen/runtime/generated-python-runtime-project.ts index 67bfc9879..9e6687ea5 100644 --- a/packages/type-safe-api/src/project/codegen/runtime/generated-python-runtime-project.ts +++ b/packages/type-safe-api/src/project/codegen/runtime/generated-python-runtime-project.ts @@ -2,7 +2,10 @@ SPDX-License-Identifier: Apache-2.0 */ import { PythonProject } from "projen/lib/python"; import { Language } from "../../languages"; -import { GeneratedPythonRuntimeOptions } from "../../types"; +import { + CodeGenerationSourceOptions, + GeneratedPythonRuntimeOptions, +} from "../../types"; import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; import { @@ -16,12 +19,8 @@ import { * Configuration for the generated python types project */ export interface GeneratedPythonTypesProjectOptions - extends GeneratedPythonRuntimeOptions { - /** - * The path to the OpenAPI specification, relative to this project's outdir - */ - readonly specPath: string; -} + extends GeneratedPythonRuntimeOptions, + CodeGenerationSourceOptions {} /** * Python project containing types generated using OpenAPI Generator CLI @@ -45,10 +44,10 @@ export class GeneratedPythonRuntimeProject extends PythonProject { ]; /** - * Path to the openapi specification + * Options configured for the project * @private */ - private readonly specPath: string; + private readonly options: GeneratedPythonTypesProjectOptions; constructor(options: GeneratedPythonTypesProjectOptions) { super({ @@ -62,7 +61,7 @@ export class GeneratedPythonRuntimeProject extends PythonProject { }, ...options, }); - this.specPath = options.specPath; + this.options = options; // Add dependencies required by the client [ @@ -118,7 +117,8 @@ export class GeneratedPythonRuntimeProject extends PythonProject { public buildGenerateCommandArgs = () => { return buildInvokeOpenApiGeneratorCommandArgs({ generator: "python", - specPath: this.specPath, + specPath: this.options.specPath, + smithyJsonPath: this.options.smithyJsonModelPath, generatorDirectory: Language.PYTHON, additionalProperties: { packageName: this.moduleName, diff --git a/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-project.ts b/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-project.ts index c90031ece..339947ebd 100644 --- a/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-project.ts +++ b/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-project.ts @@ -5,7 +5,10 @@ import { IgnoreFile } from "projen"; import { NodePackageManager } from "projen/lib/javascript"; import { TypeScriptProject } from "projen/lib/typescript"; import { Language } from "../../languages"; -import { GeneratedTypeScriptRuntimeOptions } from "../../types"; +import { + CodeGenerationSourceOptions, + GeneratedTypeScriptRuntimeOptions, +} from "../../types"; import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; import { @@ -19,11 +22,8 @@ import { * Configuration for the generated typescript client project */ export interface GeneratedTypescriptTypesProjectOptions - extends GeneratedTypeScriptRuntimeOptions { - /** - * The path to the OpenAPI specification, relative to this project's outdir - */ - readonly specPath: string; + extends GeneratedTypeScriptRuntimeOptions, + CodeGenerationSourceOptions { /** * Whether this project is parented by an nx-monorepo or not */ @@ -45,10 +45,10 @@ export class GeneratedTypescriptRuntimeProject extends TypeScriptProject { ]; /** - * Path to the openapi specification + * Options configured for the project * @private */ - private readonly specPath: string; + private readonly options: GeneratedTypescriptTypesProjectOptions; constructor(options: GeneratedTypescriptTypesProjectOptions) { super({ @@ -78,7 +78,7 @@ export class GeneratedTypescriptRuntimeProject extends TypeScriptProject { npmignoreEnabled: false, }); - this.specPath = options.specPath; + this.options = options; // Disable strict peer dependencies for pnpm as the default typescript project dependencies have type mismatches // (ts-jest@27 and @types/jest@28) @@ -150,7 +150,8 @@ export class GeneratedTypescriptRuntimeProject extends TypeScriptProject { public buildGenerateCommandArgs = () => { return buildInvokeOpenApiGeneratorCommandArgs({ generator: "typescript-fetch", - specPath: this.specPath, + specPath: this.options.specPath, + smithyJsonPath: this.options.smithyJsonModelPath, generatorDirectory: Language.TYPESCRIPT, additionalProperties: { npmName: this.package.packageName, diff --git a/packages/type-safe-api/src/project/model/smithy/smithy-definition.ts b/packages/type-safe-api/src/project/model/smithy/smithy-definition.ts index a92257dd9..e7ed54dee 100644 --- a/packages/type-safe-api/src/project/model/smithy/smithy-definition.ts +++ b/packages/type-safe-api/src/project/model/smithy/smithy-definition.ts @@ -30,6 +30,10 @@ export class SmithyDefinition extends Component { * Path to the generated OpenAPI specification, relative to the project outdir */ public readonly openApiSpecificationPath: string; + /** + * Path to the json Smithy model, relative to the project outdir + */ + public readonly smithyJsonModelPath: string; /** * Name of the gradle project */ @@ -227,14 +231,22 @@ structure NotAuthorizedError { }, }); - this.openApiSpecificationPath = path.join( + const projectionOutputPath = path.join( "build", "smithyprojections", this.gradleProjectName, - "openapi", + "openapi" + ); + this.openApiSpecificationPath = path.join( + projectionOutputPath, "openapi", `${serviceName}.openapi.json` ); + this.smithyJsonModelPath = path.join( + projectionOutputPath, + "model", + "model.json" + ); // Copy the gradle files during build if they don't exist. We don't overwrite to allow users to BYO gradle wrapper // and set `ignoreGradleWrapper: false`. diff --git a/packages/type-safe-api/src/project/type-safe-api-project.ts b/packages/type-safe-api/src/project/type-safe-api-project.ts index bae9af0e4..fd1881bd5 100644 --- a/packages/type-safe-api/src/project/type-safe-api-project.ts +++ b/packages/type-safe-api/src/project/type-safe-api-project.ts @@ -189,6 +189,9 @@ export class TypeSafeApiProject extends Project { modelDir, this.model.parsedSpecFile ); + const smithyJsonModelPathRelativeToProjectRoot = this.model.smithy + ? path.join(modelDir, this.model.smithy.smithyJsonModelPath) + : undefined; // Ensure we always generate a runtime project for the infrastructure language, regardless of what was specified by // the user @@ -210,12 +213,16 @@ export class TypeSafeApiProject extends Project { parentPackageName: this.name, generatedCodeDir: runtimeDirRelativeToParent, isWithinMonorepo: isNxWorkspace, - // Spec path relative to each generated client dir + // Spec path relative to each generated runtime dir parsedSpecPath: path.join( "..", "..", parsedSpecPathRelativeToProjectRoot ), + // Smithy model path relative to each generated runtime dir + smithyJsonModelPath: smithyJsonModelPathRelativeToProjectRoot + ? path.join("..", "..", smithyJsonModelPathRelativeToProjectRoot) + : undefined, typescriptOptions: { // Try to infer monorepo default release branch, otherwise default to mainline unless overridden defaultReleaseBranch: nxWorkspace?.affected?.defaultBase ?? "mainline", @@ -280,12 +287,16 @@ export class TypeSafeApiProject extends Project { parentPackageName: this.name, generatedCodeDir: libraryDirRelativeToParent, isWithinMonorepo: isNxWorkspace, - // Spec path relative to each generated client dir + // Spec path relative to each generated library dir parsedSpecPath: path.join( "..", "..", parsedSpecPathRelativeToProjectRoot ), + // Smithy model path relative to each generated library dir + smithyJsonModelPath: smithyJsonModelPathRelativeToProjectRoot + ? path.join("..", "..", smithyJsonModelPathRelativeToProjectRoot) + : undefined, typescriptReactQueryHooksOptions: { // Try to infer monorepo default release branch, otherwise default to mainline unless overridden defaultReleaseBranch: nxWorkspace?.affected.defaultBase ?? "mainline", @@ -348,6 +359,10 @@ export class TypeSafeApiProject extends Project { "..", parsedSpecPathRelativeToProjectRoot ), + // Smithy model path relative to each generated infra package dir + smithyJsonModelPath: smithyJsonModelPathRelativeToProjectRoot + ? path.join("..", "..", smithyJsonModelPathRelativeToProjectRoot) + : undefined, typescriptOptions: { // Try to infer monorepo default release branch, otherwise default to mainline unless overridden defaultReleaseBranch: nxWorkspace?.affected.defaultBase ?? "mainline", diff --git a/packages/type-safe-api/src/project/types.ts b/packages/type-safe-api/src/project/types.ts index b569299c8..6827c383a 100644 --- a/packages/type-safe-api/src/project/types.ts +++ b/packages/type-safe-api/src/project/types.ts @@ -373,3 +373,17 @@ export interface SmithyServiceName { */ readonly serviceName: string; } + +/** + * Options for the source files used for code generation + */ +export interface CodeGenerationSourceOptions { + /** + * Path to the OpenAPI specification + */ + readonly specPath: string; + /** + * Path to the Smithy json model if applicable + */ + readonly smithyJsonModelPath?: string; +} diff --git a/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap b/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap index 9e5965ea2..945295098 100644 --- a/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap +++ b/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap @@ -22264,7 +22264,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-react-query-hooks-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-react-query-hooks-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-react-query-hooks-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -22978,7 +22978,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-react-query-hooks --src-dir src --additional-properties "npmName=smithy-typescript-react-query-hooks-typescript-react-query-hooks,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-react-query-hooks --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-react-query-hooks-model/openapi/model/model.json --additional-properties "npmName=smithy-typescript-react-query-hooks-typescript-react-query-hooks,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -23933,7 +23933,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-typescript-react-query-hooks-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-react-query-hooks-model/openapi/model/model.json --additional-properties "npmName=smithy-typescript-react-query-hooks-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -25183,7 +25183,7 @@ src "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java-cdk-infrastructure --src-dir src/main/java/com/generated/api/smithyjavajavainfra/infra --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-infrastructure-package":"com.generated.api.smithyjavajavainfra.infra","x-runtime-package":"com.generated.api.smithyjavajavaruntime.runtime","x-enable-mock-integrations":true}'", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java-cdk-infrastructure --src-dir src/main/java/com/generated/api/smithyjavajavainfra/infra --smithy-json-path ../../model/build/smithyprojections/smithy-java-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-infrastructure-package":"com.generated.api.smithyjavajavainfra.infra","x-runtime-package":"com.generated.api.smithyjavajavaruntime.runtime","x-enable-mock-integrations":true}'", }, { "exec": "mkdir -p src/main/resources", @@ -26092,7 +26092,7 @@ src/main/AndroidManifest.xml "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithyjavajavaruntime/runtime --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-java-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithyjavajavaruntime.runtime,apiPackage=com.generated.api.smithyjavajavaruntime.runtime.api,modelPackage=com.generated.api.smithyjavajavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithyjavajavaruntime/runtime --smithy-json-path ../../model/build/smithyprojections/smithy-java-model/openapi/model/model.json --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-java-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithyjavajavaruntime.runtime,apiPackage=com.generated.api.smithyjavajavaruntime.runtime.api,modelPackage=com.generated.api.smithyjavajavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", }, ], }, @@ -26532,7 +26532,7 @@ setup.cfg "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_java_python_runtime --additional-properties "packageName=smithy_java_python_runtime,projectName=smithy-java-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_java_python_runtime --smithy-json-path ../../model/build/smithyprojections/smithy-java-model/openapi/model/model.json --additional-properties "packageName=smithy_java_python_runtime,projectName=smithy-java-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -26811,7 +26811,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-java-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-java-model/openapi/model/model.json --additional-properties "npmName=smithy-java-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -29226,7 +29226,7 @@ src "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java-cdk-infrastructure --src-dir src/main/java/com/generated/api/smithyjavajavainfra/infra --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-infrastructure-package":"com.generated.api.smithyjavajavainfra.infra","x-runtime-package":"com.generated.api.smithyjavajavaruntime.runtime","x-enable-mock-integrations":true}'", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java-cdk-infrastructure --src-dir src/main/java/com/generated/api/smithyjavajavainfra/infra --smithy-json-path ../../model/build/smithyprojections/smithy-java-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-infrastructure-package":"com.generated.api.smithyjavajavainfra.infra","x-runtime-package":"com.generated.api.smithyjavajavaruntime.runtime","x-enable-mock-integrations":true}'", }, { "exec": "mkdir -p src/main/resources", @@ -30247,7 +30247,7 @@ src/main/AndroidManifest.xml "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithyjavajavaruntime/runtime --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-java-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithyjavajavaruntime.runtime,apiPackage=com.generated.api.smithyjavajavaruntime.runtime.api,modelPackage=com.generated.api.smithyjavajavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithyjavajavaruntime/runtime --smithy-json-path ../../model/build/smithyprojections/smithy-java-model/openapi/model/model.json --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-java-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithyjavajavaruntime.runtime,apiPackage=com.generated.api.smithyjavajavaruntime.runtime.api,modelPackage=com.generated.api.smithyjavajavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", }, ], }, @@ -30750,7 +30750,7 @@ setup.cfg "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_java_python_runtime --additional-properties "packageName=smithy_java_python_runtime,projectName=smithy-java-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_java_python_runtime --smithy-json-path ../../model/build/smithyprojections/smithy-java-model/openapi/model/model.json --additional-properties "packageName=smithy_java_python_runtime,projectName=smithy-java-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -31121,7 +31121,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-java-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-java-model/openapi/model/model.json --additional-properties "npmName=smithy-java-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -32471,7 +32471,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-npm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-npm-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-npm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -33520,7 +33520,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-npm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-npm-model/openapi/model/model.json --additional-properties "npmName=smithy-npm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -35873,7 +35873,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-npm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-npm-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-npm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -37029,7 +37029,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-npm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-npm-model/openapi/model/model.json --additional-properties "npmName=smithy-npm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -38383,7 +38383,7 @@ resolution-mode=highest "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-pnpm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-pnpm-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-pnpm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -39433,7 +39433,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-pnpm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-pnpm-model/openapi/model/model.json --additional-properties "npmName=smithy-pnpm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -41796,7 +41796,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-pnpm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-pnpm-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-pnpm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -42953,7 +42953,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-pnpm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-pnpm-model/openapi/model/model.json --additional-properties "npmName=smithy-pnpm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -44335,7 +44335,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python-cdk-infrastructure --src-dir smithy_python_python_infra --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-module-name":"smithy_python_python_runtime","x-relative-spec-path":"../../../model/.api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python-cdk-infrastructure --src-dir smithy_python_python_infra --smithy-json-path ../../model/build/smithyprojections/smithy-python-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-module-name":"smithy_python_python_runtime","x-relative-spec-path":"../../../model/.api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -45177,7 +45177,7 @@ src/main/AndroidManifest.xml "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithypythonjavaruntime/runtime --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-python-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithypythonjavaruntime.runtime,apiPackage=com.generated.api.smithypythonjavaruntime.runtime.api,modelPackage=com.generated.api.smithypythonjavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithypythonjavaruntime/runtime --smithy-json-path ../../model/build/smithyprojections/smithy-python-model/openapi/model/model.json --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-python-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithypythonjavaruntime.runtime,apiPackage=com.generated.api.smithypythonjavaruntime.runtime.api,modelPackage=com.generated.api.smithypythonjavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", }, ], }, @@ -45617,7 +45617,7 @@ setup.cfg "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_python_python_runtime --additional-properties "packageName=smithy_python_python_runtime,projectName=smithy-python-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_python_python_runtime --smithy-json-path ../../model/build/smithyprojections/smithy-python-model/openapi/model/model.json --additional-properties "packageName=smithy_python_python_runtime,projectName=smithy-python-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -45896,7 +45896,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-python-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-python-model/openapi/model/model.json --additional-properties "npmName=smithy-python-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -48274,7 +48274,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python-cdk-infrastructure --src-dir smithy_python_python_infra --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-module-name":"smithy_python_python_runtime","x-relative-spec-path":"../../../model/.api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python-cdk-infrastructure --src-dir smithy_python_python_infra --smithy-json-path ../../model/build/smithyprojections/smithy-python-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-module-name":"smithy_python_python_runtime","x-relative-spec-path":"../../../model/.api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -49237,7 +49237,7 @@ src/main/AndroidManifest.xml "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithypythonjavaruntime/runtime --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-python-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithypythonjavaruntime.runtime,apiPackage=com.generated.api.smithypythonjavaruntime.runtime.api,modelPackage=com.generated.api.smithypythonjavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithypythonjavaruntime/runtime --smithy-json-path ../../model/build/smithyprojections/smithy-python-model/openapi/model/model.json --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-python-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithypythonjavaruntime.runtime,apiPackage=com.generated.api.smithypythonjavaruntime.runtime.api,modelPackage=com.generated.api.smithypythonjavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", }, ], }, @@ -49740,7 +49740,7 @@ setup.cfg "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_python_python_runtime --additional-properties "packageName=smithy_python_python_runtime,projectName=smithy-python-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_python_python_runtime --smithy-json-path ../../model/build/smithyprojections/smithy-python-model/openapi/model/model.json --additional-properties "packageName=smithy_python_python_runtime,projectName=smithy-python-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -50111,7 +50111,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-python-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-python-model/openapi/model/model.json --additional-properties "npmName=smithy-python-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -51469,7 +51469,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -52636,7 +52636,7 @@ src/main/AndroidManifest.xml "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithytypescriptjavaruntime/runtime --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-typescript-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithytypescriptjavaruntime.runtime,apiPackage=com.generated.api.smithytypescriptjavaruntime.runtime.api,modelPackage=com.generated.api.smithytypescriptjavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithytypescriptjavaruntime/runtime --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-model/openapi/model/model.json --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-typescript-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithytypescriptjavaruntime.runtime,apiPackage=com.generated.api.smithytypescriptjavaruntime.runtime.api,modelPackage=com.generated.api.smithytypescriptjavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", }, ], }, @@ -53076,7 +53076,7 @@ setup.cfg "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_typescript_python_runtime --additional-properties "packageName=smithy_typescript_python_runtime,projectName=smithy-typescript-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_typescript_python_runtime --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-model/openapi/model/model.json --additional-properties "packageName=smithy_typescript_python_runtime,projectName=smithy-typescript-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -53355,7 +53355,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-typescript-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-model/openapi/model/model.json --additional-properties "npmName=smithy-typescript-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -55720,7 +55720,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -56995,7 +56995,7 @@ src/main/AndroidManifest.xml "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithytypescriptjavaruntime/runtime --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-typescript-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithytypescriptjavaruntime.runtime,apiPackage=com.generated.api.smithytypescriptjavaruntime.runtime.api,modelPackage=com.generated.api.smithytypescriptjavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator java --spec-path ../../model/.api.json --output-path . --generator-dir java --src-dir src/main/java/com/generated/api/smithytypescriptjavaruntime/runtime --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-model/openapi/model/model.json --additional-properties "useSingleRequestParameter=true,groupId=com.generated.api,artifactId=smithy-typescript-java-runtime,artifactVersion=0.0.0,invokerPackage=com.generated.api.smithytypescriptjavaruntime.runtime,apiPackage=com.generated.api.smithytypescriptjavaruntime.runtime.api,modelPackage=com.generated.api.smithytypescriptjavaruntime.runtime.model,hideGenerationTimestamp=true,additionalModelTypeAnnotations=@lombok.AllArgsConstructor\\ @lombok.experimental.SuperBuilder" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"", }, ], }, @@ -57498,7 +57498,7 @@ setup.cfg "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_typescript_python_runtime --additional-properties "packageName=smithy_typescript_python_runtime,projectName=smithy-typescript-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator python --spec-path ../../model/.api.json --output-path . --generator-dir python --src-dir smithy_typescript_python_runtime --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-model/openapi/model/model.json --additional-properties "packageName=smithy_typescript_python_runtime,projectName=smithy-typescript-python-runtime" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -57869,7 +57869,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-typescript-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-typescript-model/openapi/model/model.json --additional-properties "npmName=smithy-typescript-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -59219,7 +59219,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-yarn-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -60268,7 +60268,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-yarn-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-yarn-model/openapi/model/model.json --additional-properties "npmName=smithy-yarn-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -62622,7 +62622,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-yarn-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -63778,7 +63778,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-yarn-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-yarn-model/openapi/model/model.json --additional-properties "npmName=smithy-yarn-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -65128,7 +65128,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn2-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-yarn2-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn2-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -66177,7 +66177,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-yarn2-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-yarn2-model/openapi/model/model.json --additional-properties "npmName=smithy-yarn2-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, @@ -68535,7 +68535,7 @@ mocks "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn2-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-cdk-infrastructure --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-yarn2-model/openapi/model/model.json --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn2-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true}' --generate-alias-as-model", }, { "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate-mock-data --spec-path ../../model/.api.json --output-path .", @@ -69691,7 +69691,7 @@ tsconfig.esm.json "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 clean-openapi-generated-code --code-path .", }, { - "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --additional-properties "npmName=smithy-yarn2-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws-prototyping-sdk/type-safe-api@0.0.0 generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript --src-dir src --smithy-json-path ../../model/build/smithyprojections/smithy-yarn2-model/openapi/model/model.json --additional-properties "npmName=smithy-yarn2-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", }, ], }, diff --git a/packages/type-safe-api/test/resources/smithy/simple-pagination/model.json b/packages/type-safe-api/test/resources/smithy/simple-pagination/model.json new file mode 100644 index 000000000..346178408 --- /dev/null +++ b/packages/type-safe-api/test/resources/smithy/simple-pagination/model.json @@ -0,0 +1,1000 @@ +{ + "smithy": "2.0", + "shapes": { + "aws.api#ArnNamespace": { + "type": "string", + "traits": { + "smithy.api#documentation": "A string representing a service's ARN namespace.", + "smithy.api#pattern": "^[a-z0-9.\\-]{1,63}$", + "smithy.api#private": {} + } + }, + "aws.api#CloudFormationName": { + "type": "string", + "traits": { + "smithy.api#documentation": "A string representing a CloudFormation service name.", + "smithy.api#pattern": "^[A-Z][A-Za-z0-9]+$", + "smithy.api#private": {} + } + }, + "aws.api#TagOperationReference": { + "type": "string", + "traits": { + "smithy.api#documentation": "Points to an operation designated for a tagging APi", + "smithy.api#idRef": { + "failWhenMissing": true, + "selector": "resource > operation" + } + } + }, + "aws.api#TaggableApiConfig": { + "type": "structure", + "members": { + "tagApi": { + "target": "aws.api#TagOperationReference", + "traits": { + "smithy.api#documentation": "The `tagApi` property is a string value that references a non-instance\nor create operation that creates or updates tags on the resource.", + "smithy.api#required": {} + } + }, + "untagApi": { + "target": "aws.api#TagOperationReference", + "traits": { + "smithy.api#documentation": "The `untagApi` property is a string value that references a non-instance\noperation that removes tags on the resource.", + "smithy.api#required": {} + } + }, + "listTagsApi": { + "target": "aws.api#TagOperationReference", + "traits": { + "smithy.api#documentation": "The `listTagsApi` property is a string value that references a non-\ninstance operation which gets the current tags on the resource.", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "Structure representing the configuration of resource specific tagging APIs" + } + }, + "aws.api#arn": { + "type": "structure", + "members": { + "template": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "Defines the ARN template. The provided string contains URI-template\nstyle label placeholders that contain the name of one of the identifiers\ndefined in the `identifiers` property of the resource. These labels can\nbe substituted at runtime with the actual identifiers of the resource.\nEvery identifier name of the resource MUST have corresponding label of\nthe same name. Note that percent-encoding **is not** performed on these\nplaceholder values; they are to be replaced literally. For relative ARN\ntemplates that have not set `absolute` to `true`, the template string\ncontains only the resource part of the ARN (for example,\n`foo/{MyResourceId}`). Relative ARNs MUST NOT start with \"/\".", + "smithy.api#required": {} + } + }, + "absolute": { + "target": "smithy.api#Boolean", + "traits": { + "smithy.api#documentation": "Set to true to indicate that the ARN template contains a fully-formed\nARN that does not need to be merged with the service. This type of ARN\nMUST be used when the identifier of a resource is an ARN or is based on\nthe ARN identifier of a parent resource." + } + }, + "noRegion": { + "target": "smithy.api#Boolean", + "traits": { + "smithy.api#documentation": "Set to true to specify that the ARN does not contain a region. If not\nset, or if set to false, the resolved ARN will contain a placeholder\nfor the region. This can only be set to true if `absolute` is not set\nor is false." + } + }, + "noAccount": { + "target": "smithy.api#Boolean", + "traits": { + "smithy.api#documentation": "Set to true to specify that the ARN does not contain an account ID. If\nnot set, or if set to false, the resolved ARN will contain a placeholder\nfor the customer account ID. This can only be set to true if absolute\nis not set or is false." + } + } + }, + "traits": { + "smithy.api#documentation": "Specifies an ARN template for the resource.", + "smithy.api#externalDocumentation": { + "Reference": "https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html" + }, + "smithy.api#trait": { + "selector": "resource" + } + } + }, + "aws.api#arnReference": { + "type": "structure", + "members": { + "type": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The AWS CloudFormation resource type contained in the ARN." + } + }, + "resource": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "An absolute shape ID that references the Smithy resource type contained\nin the ARN (e.g., `com.foo#SomeResource`). The targeted resource is not\nrequired to be found in the model, allowing for external shapes to be\nreferenced without needing to take on an additional dependency. If the\nshape is found in the model, it MUST target a resource shape, and the\nresource MUST be found within the closure of the referenced service\nshape." + } + }, + "service": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The Smithy service absolute shape ID that is referenced by the ARN. The\ntargeted service is not required to be found in the model, allowing for\nexternal shapes to be referenced without needing to take on an\nadditional dependency." + } + } + }, + "traits": { + "smithy.api#documentation": "Marks a string as containing an ARN.", + "smithy.api#trait": { + "selector": "string" + } + } + }, + "aws.api#clientDiscoveredEndpoint": { + "type": "structure", + "members": { + "required": { + "target": "smithy.api#Boolean", + "traits": { + "smithy.api#documentation": "This field denotes whether or not this operation requires the use of a\nspecific endpoint. If this field is false, the standard regional\nendpoint for a service can handle this request. The client will start\nsending requests to the standard regional endpoint while working to\ndiscover a more specific endpoint.", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "Indicates that the target operation should use the client's endpoint\ndiscovery logic.", + "smithy.api#trait": { + "selector": "operation" + } + } + }, + "aws.api#clientEndpointDiscovery": { + "type": "structure", + "members": { + "operation": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "Indicates the operation that clients should use to discover endpoints\nfor the service.", + "smithy.api#idRef": { + "failWhenMissing": true, + "selector": "operation" + }, + "smithy.api#required": {} + } + }, + "error": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "Indicates the error that tells clients that the endpoint they are using\nis no longer valid. This error MUST be bound to any operation bound to\nthe service which is marked with the aws.api#clientDiscoveredEndpoint\ntrait.", + "smithy.api#idRef": { + "failWhenMissing": true, + "selector": "structure[trait|error]" + }, + "smithy.api#recommended": {} + } + } + }, + "traits": { + "smithy.api#documentation": "Configures endpoint discovery for the service.", + "smithy.api#trait": { + "selector": "service" + } + } + }, + "aws.api#clientEndpointDiscoveryId": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#documentation": "Indicates members of the operation input which should be use to discover\nendpoints.", + "smithy.api#trait": { + "selector": "operation[trait|aws.api#clientDiscoveredEndpoint] -[input]->\nstructure > :test(member[trait|required] > string)" + } + } + }, + "aws.api#controlPlane": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#documentation": "Defines a service, resource, or operation as operating on the control plane.", + "smithy.api#trait": { + "selector": ":test(service, resource, operation)", + "conflicts": [ + "aws.api#dataPlane" + ] + } + } + }, + "aws.api#data": { + "type": "enum", + "members": { + "CUSTOMER_CONTENT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "Customer content means any software (including machine images), data,\ntext, audio, video or images that customers or any customer end user\ntransfers to AWS for processing, storage or hosting by AWS services in\nconnection with the customer’s accounts and any computational results\nthat customers or any customer end user derive from the foregoing\nthrough their use of AWS services.", + "smithy.api#enumValue": "content" + } + }, + "CUSTOMER_ACCOUNT_INFORMATION": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "Account information means information about customers that customers\nprovide to AWS in connection with the creation or administration of\ncustomers’ accounts.", + "smithy.api#enumValue": "account" + } + }, + "SERVICE_ATTRIBUTES": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "Service Attributes means service usage data related to a customer’s\naccount, such as resource identifiers, metadata tags, security and\naccess roles, rules, usage policies, permissions, usage statistics,\nlogging data, and analytics.", + "smithy.api#enumValue": "usage" + } + }, + "TAG_DATA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "Designates metadata tags applied to AWS resources.", + "smithy.api#enumValue": "tagging" + } + }, + "PERMISSIONS_DATA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "Designates security and access roles, rules, usage policies, and\npermissions.", + "smithy.api#enumValue": "permissions" + } + } + }, + "traits": { + "smithy.api#documentation": "Designates the target as containing data of a known classification level.", + "smithy.api#trait": { + "selector": ":test(simpleType, list, structure, union, member)" + } + } + }, + "aws.api#dataPlane": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#documentation": "Defines a service, resource, or operation as operating on the data plane.", + "smithy.api#trait": { + "selector": ":test(service, resource, operation)", + "conflicts": [ + "aws.api#controlPlane" + ] + } + } + }, + "aws.api#service": { + "type": "structure", + "members": { + "sdkId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The `sdkId` property is a required string value that specifies the AWS\nSDK service ID (e.g., \"API Gateway\"). This value is used for generating\nclient names in SDKs and for linking between services.", + "smithy.api#required": {} + } + }, + "arnNamespace": { + "target": "aws.api#ArnNamespace", + "traits": { + "smithy.api#documentation": "The `arnNamespace` property is a string value that defines the ARN service\nnamespace of the service (e.g., \"apigateway\"). This value is used in\nARNs assigned to resources in the service. If not set, this value\ndefaults to the lowercase name of the service shape." + } + }, + "cloudFormationName": { + "target": "aws.api#CloudFormationName", + "traits": { + "smithy.api#documentation": "The `cloudFormationName` property is a string value that specifies the\nAWS CloudFormation service name (e.g., `ApiGateway`). When not set,\nthis value defaults to the name of the service shape. This value is\npart of the CloudFormation resource type name that is automatically\nassigned to resources in the service (e.g., `AWS::::resourceName`)." + } + }, + "cloudTrailEventSource": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The `cloudTrailEventSource` property is a string value that defines the\nAWS customer-facing eventSource property contained in CloudTrail event\nrecords emitted by the service. If not specified, this value defaults\nto the `arnNamespace` plus `.amazonaws.com`." + } + }, + "endpointPrefix": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The `endpointPrefix` property is a string value that identifies which\nendpoint in a given region should be used to connect to the service.\nFor example, most services in the AWS standard partition have endpoints\nwhich follow the format: `{endpointPrefix}.{region}.amazonaws.com`. A\nservice with the endpoint prefix example in the region us-west-2 might\nhave the endpoint example.us-west-2.amazonaws.com.\n\nThis value is not unique across services and is subject to change.\nTherefore, it MUST NOT be used for client naming or for any other\npurpose that requires a static, unique identifier. sdkId should be used\nfor those purposes. Additionally, this value can be used to attempt to\nresolve endpoints." + } + } + }, + "traits": { + "smithy.api#documentation": "An AWS service is defined using the `aws.api#service` trait. This trait\nprovides information about the service like the name used to generate AWS\nSDK client classes and the namespace used in ARNs.", + "smithy.api#trait": { + "selector": "service" + } + } + }, + "aws.api#tagEnabled": { + "type": "structure", + "members": { + "disableDefaultOperations": { + "target": "smithy.api#Boolean", + "traits": { + "smithy.api#documentation": "The `disableDefaultOperations` property is a boolean value that specifies\nif the service does not have the standard tag operations supporting all\nresources on the service. Default value is `false`" + } + } + }, + "traits": { + "smithy.api#documentation": "Annotates a service as having tagging on 1 or more resources and associated\nAPIs to perform CRUD operations on those tags", + "smithy.api#trait": { + "selector": "service" + }, + "smithy.api#unstable": {} + } + }, + "aws.api#taggable": { + "type": "structure", + "members": { + "property": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The `property` property is a string value that identifies which\nresource property represents tags for the resource." + } + }, + "apiConfig": { + "target": "aws.api#TaggableApiConfig", + "traits": { + "smithy.api#documentation": "Specifies configuration for resource specific tagging APIs if the\nresource has them." + } + }, + "disableSystemTags": { + "target": "smithy.api#Boolean", + "traits": { + "smithy.api#documentation": "Flag indicating if the resource is not able to carry AWS system level.\nUsed by service principals. Default value is `false`" + } + } + }, + "traits": { + "smithy.api#documentation": "Indicates a resource supports CRUD operations for tags. Either through\nresource lifecycle or instance operations or tagging operations on the\nservice.", + "smithy.api#trait": { + "selector": "resource" + }, + "smithy.api#unstable": {} + } + }, + "aws.auth#StringList": { + "type": "list", + "member": { + "target": "smithy.api#String" + }, + "traits": { + "smithy.api#private": {} + } + }, + "aws.auth#cognitoUserPools": { + "type": "structure", + "members": { + "providerArns": { + "target": "aws.auth#StringList", + "traits": { + "smithy.api#documentation": "A list of the Amazon Cognito user pool ARNs. Each element is of this\nformat: `arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}`.", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#authDefinition": {}, + "smithy.api#documentation": "Configures an Amazon Cognito User Pools auth scheme.", + "smithy.api#internal": {}, + "smithy.api#tags": [ + "internal" + ], + "smithy.api#trait": { + "selector": "service" + } + } + }, + "aws.auth#sigv4": { + "type": "structure", + "members": { + "name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The signature version 4 service signing name to use in the credential\nscope when signing requests. This value SHOULD match the `arnNamespace`\nproperty of the `aws.api#service-trait`.", + "smithy.api#externalDocumentation": { + "Reference": "https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html" + }, + "smithy.api#length": { + "min": 1 + }, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#authDefinition": { + "traits": [ + "aws.auth#unsignedPayload" + ] + }, + "smithy.api#documentation": "Signature Version 4 is the process to add authentication information to\nAWS requests sent by HTTP. For security, most requests to AWS must be\nsigned with an access key, which consists of an access key ID and secret\naccess key. These two keys are commonly referred to as your security\ncredentials.", + "smithy.api#externalDocumentation": { + "Reference": "https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html" + }, + "smithy.api#trait": { + "selector": "service" + } + } + }, + "aws.auth#unsignedPayload": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#documentation": "Indicates that the request payload of a signed request is not to be used\nas part of the signature.", + "smithy.api#trait": { + "selector": "operation" + } + } + }, + "aws.customizations#s3UnwrappedXmlOutput": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#documentation": "Indicates the response body from S3 is not wrapped in the\naws-restxml-protocol operation-level XML node. Intended to only be used by\nAWS S3.", + "smithy.api#trait": { + "selector": "operation" + } + } + }, + "aws.protocols#ChecksumAlgorithm": { + "type": "enum", + "members": { + "CRC32C": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "CRC32C", + "smithy.api#enumValue": "CRC32C" + } + }, + "CRC32": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "CRC32", + "smithy.api#enumValue": "CRC32" + } + }, + "SHA1": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "SHA1", + "smithy.api#enumValue": "SHA1" + } + }, + "SHA256": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#documentation": "SHA256", + "smithy.api#enumValue": "SHA256" + } + } + }, + "traits": { + "smithy.api#private": {} + } + }, + "aws.protocols#ChecksumAlgorithmSet": { + "type": "list", + "member": { + "target": "aws.protocols#ChecksumAlgorithm" + }, + "traits": { + "smithy.api#length": { + "min": 1 + }, + "smithy.api#private": {}, + "smithy.api#uniqueItems": {} + } + }, + "aws.protocols#HttpConfiguration": { + "type": "structure", + "members": { + "http": { + "target": "aws.protocols#StringList", + "traits": { + "smithy.api#documentation": "The priority ordered list of supported HTTP protocol versions." + } + }, + "eventStreamHttp": { + "target": "aws.protocols#StringList", + "traits": { + "smithy.api#documentation": "The priority ordered list of supported HTTP protocol versions that\nare required when using event streams with the service. If not set,\nthis value defaults to the value of the `http` member. Any entry in\n`eventStreamHttp` MUST also appear in `http`." + } + } + }, + "traits": { + "smithy.api#documentation": "Contains HTTP protocol configuration for HTTP-based protocols.", + "smithy.api#mixin": { + "localTraits": [ + "smithy.api#private" + ] + }, + "smithy.api#private": {} + } + }, + "aws.protocols#StringList": { + "type": "list", + "member": { + "target": "smithy.api#String" + }, + "traits": { + "smithy.api#private": {} + } + }, + "aws.protocols#awsJson1_0": { + "type": "structure", + "mixins": [ + { + "target": "aws.protocols#HttpConfiguration" + } + ], + "members": {}, + "traits": { + "smithy.api#documentation": "An RPC-based protocol that sends JSON payloads. This protocol does not use\nHTTP binding traits.", + "smithy.api#protocolDefinition": { + "traits": [ + "smithy.api#timestampFormat", + "smithy.api#cors", + "smithy.api#endpoint", + "smithy.api#hostLabel" + ] + }, + "smithy.api#trait": { + "selector": "service" + } + } + }, + "aws.protocols#awsJson1_1": { + "type": "structure", + "mixins": [ + { + "target": "aws.protocols#HttpConfiguration" + } + ], + "members": {}, + "traits": { + "smithy.api#documentation": "An RPC-based protocol that sends JSON payloads. This protocol does not use\nHTTP binding traits.", + "smithy.api#protocolDefinition": { + "traits": [ + "smithy.api#timestampFormat", + "smithy.api#cors", + "smithy.api#endpoint", + "smithy.api#hostLabel" + ] + }, + "smithy.api#trait": { + "selector": "service" + } + } + }, + "aws.protocols#awsQuery": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#deprecated": {}, + "smithy.api#documentation": "An RPC-based protocol that sends 'POST' requests in the body as\n`x-www-form-urlencoded` strings and responses in XML documents. This\nprotocol does not use HTTP binding traits.", + "smithy.api#protocolDefinition": { + "noInlineDocumentSupport": true, + "traits": [ + "aws.protocols#awsQueryError", + "smithy.api#xmlAttribute", + "smithy.api#xmlFlattened", + "smithy.api#xmlName", + "smithy.api#xmlNamespace", + "smithy.api#timestampFormat", + "smithy.api#cors", + "smithy.api#endpoint", + "smithy.api#hostLabel" + ] + }, + "smithy.api#trait": { + "selector": "service [trait|xmlNamespace]" + } + } + }, + "aws.protocols#awsQueryCompatible": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#documentation": "Enable backward compatibility when migrating from awsQuery to awsJson protocol", + "smithy.api#trait": { + "selector": "service [trait|aws.protocols#awsJson1_0]" + } + } + }, + "aws.protocols#awsQueryError": { + "type": "structure", + "members": { + "code": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The value used to distinguish this error shape during serialization.", + "smithy.api#required": {} + } + }, + "httpResponseCode": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "The HTTP response code used on a response containing this error shape.", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "Provides the value in the 'Code' distinguishing field and HTTP response\ncode for an operation error.", + "smithy.api#trait": { + "selector": "structure [trait|error]", + "breakingChanges": [ + { + "change": "any" + } + ] + } + } + }, + "aws.protocols#ec2Query": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#deprecated": {}, + "smithy.api#documentation": "An RPC-based protocol that sends 'POST' requests in the body as Amazon EC2\nformatted `x-www-form-urlencoded` strings and responses in XML documents.\nThis protocol does not use HTTP binding traits.", + "smithy.api#protocolDefinition": { + "noInlineDocumentSupport": true, + "traits": [ + "aws.protocols#ec2QueryName", + "smithy.api#xmlAttribute", + "smithy.api#xmlFlattened", + "smithy.api#xmlName", + "smithy.api#xmlNamespace", + "smithy.api#timestampFormat", + "smithy.api#cors", + "smithy.api#endpoint", + "smithy.api#hostLabel" + ] + }, + "smithy.api#trait": { + "selector": "service [trait|xmlNamespace]" + } + } + }, + "aws.protocols#ec2QueryName": { + "type": "string", + "traits": { + "smithy.api#documentation": "Indicates the serialized name of a structure member when that structure is\nserialized for the input of an EC2 operation.", + "smithy.api#pattern": "^[a-zA-Z_][a-zA-Z_0-9-]*$", + "smithy.api#trait": { + "selector": "structure > member" + } + } + }, + "aws.protocols#httpChecksum": { + "type": "structure", + "members": { + "requestAlgorithmMember": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "Defines a top-level operation input member that is used to configure\nrequest checksum behavior." + } + }, + "requestChecksumRequired": { + "target": "smithy.api#Boolean", + "traits": { + "smithy.api#documentation": "Indicates an operation requires a checksum in its HTTP request." + } + }, + "requestValidationModeMember": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "Defines a top-level operation input member used to opt-in to response\nchecksum validation." + } + }, + "responseAlgorithms": { + "target": "aws.protocols#ChecksumAlgorithmSet", + "traits": { + "smithy.api#documentation": "Defines the checksum algorithms clients should look for when performing\nHTTP response checksum validation." + } + } + }, + "traits": { + "smithy.api#documentation": "Indicates that an operation supports checksum validation.", + "smithy.api#trait": { + "selector": "operation" + }, + "smithy.api#unstable": {} + } + }, + "aws.protocols#restJson1": { + "type": "structure", + "mixins": [ + { + "target": "aws.protocols#HttpConfiguration" + } + ], + "members": {}, + "traits": { + "smithy.api#documentation": "A RESTful protocol that sends JSON in structured payloads.", + "smithy.api#protocolDefinition": { + "traits": [ + "smithy.api#cors", + "smithy.api#endpoint", + "smithy.api#hostLabel", + "smithy.api#http", + "smithy.api#httpError", + "smithy.api#httpHeader", + "smithy.api#httpLabel", + "smithy.api#httpPayload", + "smithy.api#httpPrefixHeaders", + "smithy.api#httpQuery", + "smithy.api#httpQueryParams", + "smithy.api#httpResponseCode", + "smithy.api#jsonName", + "smithy.api#timestampFormat" + ] + }, + "smithy.api#trait": { + "selector": "service" + } + } + }, + "aws.protocols#restXml": { + "type": "structure", + "mixins": [ + { + "target": "aws.protocols#HttpConfiguration" + } + ], + "members": { + "noErrorWrapping": { + "target": "smithy.api#Boolean", + "traits": { + "smithy.api#deprecated": {}, + "smithy.api#documentation": "Disables the serialization wrapping of error properties in an 'Error'\nXML element." + } + } + }, + "traits": { + "smithy.api#deprecated": {}, + "smithy.api#documentation": "A RESTful protocol that sends XML in structured payloads.", + "smithy.api#protocolDefinition": { + "noInlineDocumentSupport": true, + "traits": [ + "smithy.api#cors", + "smithy.api#endpoint", + "smithy.api#hostLabel", + "smithy.api#http", + "smithy.api#httpError", + "smithy.api#httpHeader", + "smithy.api#httpLabel", + "smithy.api#httpPayload", + "smithy.api#httpPrefixHeaders", + "smithy.api#httpQuery", + "smithy.api#httpQueryParams", + "smithy.api#httpResponseCode", + "smithy.api#xmlAttribute", + "smithy.api#xmlFlattened", + "smithy.api#xmlName", + "smithy.api#xmlNamespace" + ] + }, + "smithy.api#trait": { + "selector": "service" + } + } + }, + "com.aws#BadRequestError": { + "type": "structure", + "members": { + "message": { + "target": "com.aws#ErrorMessage", + "traits": { + "smithy.api#documentation": "Message with details about the error", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "An error at the fault of the client sending invalid input", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.aws#ErrorMessage": { + "type": "string", + "traits": { + "smithy.api#documentation": "An error message" + } + }, + "com.aws#InternalFailureError": { + "type": "structure", + "members": { + "message": { + "target": "com.aws#ErrorMessage", + "traits": { + "smithy.api#documentation": "Message with details about the error", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "An internal failure at the fault of the server", + "smithy.api#error": "server", + "smithy.api#httpError": 500 + } + }, + "com.aws#ListHellos": { + "type": "operation", + "input": { + "target": "com.aws#ListHellosInput" + }, + "output": { + "target": "com.aws#ListHellosOutput" + }, + "errors": [ + { + "target": "com.aws#NotFoundError" + } + ], + "traits": { + "smithy.api#http": { + "method": "GET", + "uri": "/hello/{foo}" + }, + "smithy.api#paginated": { + "inputToken": "nextToken", + "outputToken": "outNextToken", + "items": "messages" + }, + "smithy.api#readonly": {} + } + }, + "com.aws#ListHellosInput": { + "type": "structure", + "members": { + "foo": { + "target": "smithy.api#String", + "traits": { + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + }, + "nextToken": { + "target": "smithy.api#String", + "traits": { + "smithy.api#httpQuery": "nextToken" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.aws#ListHellosOutput": { + "type": "structure", + "members": { + "messages": { + "target": "com.aws#Messages", + "traits": { + "smithy.api#required": {} + } + }, + "outNextToken": { + "target": "smithy.api#String" + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.aws#Messages": { + "type": "list", + "member": { + "target": "smithy.api#String" + } + }, + "com.aws#MyService": { + "type": "service", + "version": "1.0", + "operations": [ + { + "target": "com.aws#ListHellos" + }, + { + "target": "com.aws#SayHello" + } + ], + "errors": [ + { + "target": "com.aws#BadRequestError" + }, + { + "target": "com.aws#InternalFailureError" + }, + { + "target": "com.aws#NotAuthorizedError" + } + ], + "traits": { + "aws.protocols#restJson1": {}, + "smithy.api#documentation": "A sample smithy api" + } + }, + "com.aws#NotAuthorizedError": { + "type": "structure", + "members": { + "message": { + "target": "com.aws#ErrorMessage", + "traits": { + "smithy.api#documentation": "Message with details about the error", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "An error due to the client not being authorized to access the resource", + "smithy.api#error": "client", + "smithy.api#httpError": 403 + } + }, + "com.aws#NotFoundError": { + "type": "structure", + "members": { + "message": { + "target": "com.aws#ErrorMessage", + "traits": { + "smithy.api#documentation": "Message with details about the error", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "An error due to the client attempting to access a missing resource", + "smithy.api#error": "client", + "smithy.api#httpError": 404 + } + }, + "com.aws#SayHello": { + "type": "operation", + "input": { + "target": "com.aws#SayHelloInput" + }, + "output": { + "target": "com.aws#SayHelloOutput" + }, + "errors": [ + { + "target": "com.aws#NotFoundError" + } + ], + "traits": { + "smithy.api#http": { + "method": "GET", + "uri": "/hello" + }, + "smithy.api#readonly": {} + } + }, + "com.aws#SayHelloInput": { + "type": "structure", + "members": { + "name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#httpQuery": "name", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.aws#SayHelloOutput": { + "type": "structure", + "members": { + "message": { + "target": "smithy.api#String", + "traits": { + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + } + } +} diff --git a/packages/type-safe-api/test/resources/smithy/simple-pagination/openapi.json b/packages/type-safe-api/test/resources/smithy/simple-pagination/openapi.json new file mode 100644 index 000000000..568a4ad38 --- /dev/null +++ b/packages/type-safe-api/test/resources/smithy/simple-pagination/openapi.json @@ -0,0 +1,235 @@ +{ + "openapi": "3.0.2", + "info": { + "title": "MyService", + "version": "1.0", + "description": "A sample smithy api" + }, + "paths": { + "/hello": { + "get": { + "operationId": "SayHello", + "parameters": [ + { + "name": "name", + "in": "query", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "SayHello 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SayHelloResponseContent" + } + } + } + }, + "400": { + "description": "BadRequestError 400 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestErrorResponseContent" + } + } + } + }, + "403": { + "description": "NotAuthorizedError 403 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotAuthorizedErrorResponseContent" + } + } + } + }, + "404": { + "description": "NotFoundError 404 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundErrorResponseContent" + } + } + } + }, + "500": { + "description": "InternalFailureError 500 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalFailureErrorResponseContent" + } + } + } + } + } + } + }, + "/hello/{foo}": { + "get": { + "operationId": "ListHellos", + "parameters": [ + { + "name": "foo", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "nextToken", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "ListHellos 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListHellosResponseContent" + } + } + } + }, + "400": { + "description": "BadRequestError 400 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestErrorResponseContent" + } + } + } + }, + "403": { + "description": "NotAuthorizedError 403 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotAuthorizedErrorResponseContent" + } + } + } + }, + "404": { + "description": "NotFoundError 404 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundErrorResponseContent" + } + } + } + }, + "500": { + "description": "InternalFailureError 500 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalFailureErrorResponseContent" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "BadRequestErrorResponseContent": { + "type": "object", + "description": "An error at the fault of the client sending invalid input", + "properties": { + "message": { + "type": "string", + "description": "Message with details about the error" + } + }, + "required": [ + "message" + ] + }, + "InternalFailureErrorResponseContent": { + "type": "object", + "description": "An internal failure at the fault of the server", + "properties": { + "message": { + "type": "string", + "description": "Message with details about the error" + } + }, + "required": [ + "message" + ] + }, + "ListHellosResponseContent": { + "type": "object", + "properties": { + "messages": { + "type": "array", + "items": { + "type": "string" + } + }, + "outNextToken": { + "type": "string" + } + }, + "required": [ + "messages" + ] + }, + "NotAuthorizedErrorResponseContent": { + "type": "object", + "description": "An error due to the client not being authorized to access the resource", + "properties": { + "message": { + "type": "string", + "description": "Message with details about the error" + } + }, + "required": [ + "message" + ] + }, + "NotFoundErrorResponseContent": { + "type": "object", + "description": "An error due to the client attempting to access a missing resource", + "properties": { + "message": { + "type": "string", + "description": "Message with details about the error" + } + }, + "required": [ + "message" + ] + }, + "SayHelloResponseContent": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } +} diff --git a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap index d042a5671..825412e30 100644 --- a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap @@ -1,5 +1,89 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Typescript React Query Hooks Code Generation Script Unit Tests Generates Paginated Hooks With Smithy @paginated trait 1`] = ` +"// Import models +import type { + BadRequestErrorResponseContent, + InternalFailureErrorResponseContent, + ListHellosResponseContent, + NotAuthorizedErrorResponseContent, + NotFoundErrorResponseContent, + SayHelloResponseContent, + +} from '../models'; + +// Import request parameter interfaces +import { + ListHellosRequest, + SayHelloRequest, + + +} from '..'; + +import { ResponseError } from '../runtime'; +import { DefaultApi } from './DefaultApi'; +import { DefaultApiDefaultContext } from "./DefaultApiClientProvider"; + +import { + useQuery, + UseQueryResult, + UseQueryOptions, + useInfiniteQuery, + UseInfiniteQueryResult, + UseInfiniteQueryOptions, + useMutation, + UseMutationOptions, + UseMutationResult +} from "@tanstack/react-query"; +import { createContext, useContext } from "react"; + +/** + * Context for the API client used by the hooks. + */ +export const DefaultApiClientContext = createContext(undefined); + +const NO_API_ERROR = new Error(\`DefaultApi client missing. Please ensure you have instantiated the DefaultApiClientProvider with a client instance.\`); + + +/** + * useInfiniteQuery hook for the ListHellos operation + */ +export const useListHellos = ( + params: ListHellosRequest, + options?: Omit, 'queryKey' | 'queryFn' | 'getNextPageParam'> +): UseInfiniteQueryResult => { + const api = useContext(DefaultApiClientContext); + if (!api) { + throw NO_API_ERROR; + } + return useInfiniteQuery(["listHellos", params], ({ pageParam }) => api.listHellos({ ...params, nextToken: pageParam }), { + getNextPageParam: (response) => response.outNextToken, + context: DefaultApiDefaultContext, + ...options as any, + }); +}; + +/** + * useQuery hook for the SayHello operation + */ +export const useSayHello = ( + params: SayHelloRequest, + options?: Omit, 'queryKey' | 'queryFn'> +): UseQueryResult => { + const api = useContext(DefaultApiClientContext); + if (!api) { + throw NO_API_ERROR; + } + return useQuery(["sayHello", params], () => api.sayHello(params), { + context: DefaultApiDefaultContext, + ...options, + }); +}; + + +" +`; + exports[`Typescript React Query Hooks Code Generation Script Unit Tests Generates With multiple-tags.yaml 1`] = ` { ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". diff --git a/packages/type-safe-api/test/scripts/generators/typescript-react-query-hooks.test.ts b/packages/type-safe-api/test/scripts/generators/typescript-react-query-hooks.test.ts index f2374fdd0..0c2509533 100644 --- a/packages/type-safe-api/test/scripts/generators/typescript-react-query-hooks.test.ts +++ b/packages/type-safe-api/test/scripts/generators/typescript-react-query-hooks.test.ts @@ -48,4 +48,52 @@ describe("Typescript React Query Hooks Code Generation Script Unit Tests", () => ).toMatchSnapshot(); } ); + + it("Generates Paginated Hooks With Smithy @paginated trait", () => { + const resourcePath = path.resolve( + __dirname, + "../../resources/smithy/simple-pagination" + ); + const specPath = path.join(resourcePath, "openapi.json"); + const smithyJsonModelPath = path.join(resourcePath, "model.json"); + + const snapshot = withTmpDirSnapshot( + os.tmpdir(), + (outdir) => { + exec(`cp ${specPath} ${outdir}/openapi.json`, { + cwd: path.resolve(__dirname), + }); + exec(`cp ${smithyJsonModelPath} ${outdir}/model.json`, { + cwd: path.resolve(__dirname), + }); + const project = new TypescriptReactQueryHooksLibrary({ + name: "test", + defaultReleaseBranch: "main", + outdir, + specPath: "openapi.json", + smithyJsonModelPath: "model.json", + }); + // Synth the project so that the generate command honours the .openapi-generator-ignore-handlebars file + project.synth(); + exec( + `${path.resolve( + __dirname, + "../../../scripts/generators/generate" + )} ${project.buildGenerateCommandArgs()}`, + { + cwd: outdir, + } + ); + }, + { + excludeGlobs: [ + ...TypescriptReactQueryHooksLibrary.openApiIgnorePatterns, + ".projen/*", + "spec.yaml", + ], + } + ); + + expect(snapshot["src/apis/DefaultApiHooks.ts"]).toMatchSnapshot(); + }); });