diff --git a/CI/samples.ci/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml b/CI/samples.ci/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml similarity index 96% rename from CI/samples.ci/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml rename to CI/samples.ci/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml index 1abcc68a8706..35c073c7dcaf 100644 --- a/CI/samples.ci/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml +++ b/CI/samples.ci/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml @@ -1,7 +1,7 @@ 4.0.0 org.openapitools - TypeScriptFetchBuildNamespaceParameterInterfacesPestoreClientTests + TypeScriptFetchBuildPrefixParameterInterfacesPestoreClientTests pom 1.0-SNAPSHOT TS Fetch Petstore Client (with namespacing for parameter interfaces) diff --git a/bin/openapi3/typescript-fetch-petstore-all.sh b/bin/openapi3/typescript-fetch-petstore-all.sh index 4e823fde8a81..c052045b1068 100755 --- a/bin/openapi3/typescript-fetch-petstore-all.sh +++ b/bin/openapi3/typescript-fetch-petstore-all.sh @@ -4,4 +4,4 @@ ./bin/openapi3/typescript-fetch-petstore-with-npm-version.sh ./bin/openapi3/typescript-fetch-petstore-interfaces.sh ./bin/openapi3/typescript-fetch-petstore.sh -./bin/openapi3/typescript-fetch-petstore-namespace-parameter-interfaces.sh +./bin/openapi3/typescript-fetch-petstore-prefix-parameter-interfaces.sh diff --git a/bin/openapi3/typescript-fetch-petstore-namespace-parameter-interfaces.sh b/bin/openapi3/typescript-fetch-petstore-prefix-parameter-interfaces.sh similarity index 87% rename from bin/openapi3/typescript-fetch-petstore-namespace-parameter-interfaces.sh rename to bin/openapi3/typescript-fetch-petstore-prefix-parameter-interfaces.sh index 7580e6f76578..b4f24da65321 100755 --- a/bin/openapi3/typescript-fetch-petstore-namespace-parameter-interfaces.sh +++ b/bin/openapi3/typescript-fetch-petstore-prefix-parameter-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces --additional-properties namespaceParameterInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore-all.sh b/bin/typescript-fetch-petstore-all.sh index fce74ed51be6..33fe0bc0a480 100755 --- a/bin/typescript-fetch-petstore-all.sh +++ b/bin/typescript-fetch-petstore-all.sh @@ -5,4 +5,4 @@ ./bin/typescript-fetch-petstore-interfaces.sh ./bin/typescript-fetch-petstore.sh ./bin/typescript-fetch-petstore-multiple-parameters.sh -./bin/typescript-fetch-petstore-namespace-parameter-interfaces.sh +./bin/typescript-fetch-petstore-prefix-parameter-interfaces.sh diff --git a/bin/typescript-fetch-petstore-namespace-parameter-interfaces.json b/bin/typescript-fetch-petstore-prefix-parameter-interfaces.json similarity index 80% rename from bin/typescript-fetch-petstore-namespace-parameter-interfaces.json rename to bin/typescript-fetch-petstore-prefix-parameter-interfaces.json index 9097f0beb3f1..5694785550cc 100644 --- a/bin/typescript-fetch-petstore-namespace-parameter-interfaces.json +++ b/bin/typescript-fetch-petstore-prefix-parameter-interfaces.json @@ -3,5 +3,5 @@ "npmVersion": "1.0.0", "npmRepository" : "https://skimdb.npmjs.com/registry", "snapshot" : false, - "namespaceParameterInterfaces": true + "prefixParameterInterfaces": true } diff --git a/bin/typescript-fetch-petstore-namespace-parameter-interfaces.sh b/bin/typescript-fetch-petstore-prefix-parameter-interfaces.sh similarity index 72% rename from bin/typescript-fetch-petstore-namespace-parameter-interfaces.sh rename to bin/typescript-fetch-petstore-prefix-parameter-interfaces.sh index 8b60a9dc3636..9ba84b2cc47d 100755 --- a/bin/typescript-fetch-petstore-namespace-parameter-interfaces.sh +++ b/bin/typescript-fetch-petstore-prefix-parameter-interfaces.sh @@ -27,8 +27,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-namespace-parameter-interfaces.json -o samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-prefix-parameter-interfaces.json -o samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces $@" java $JAVA_OPTS -jar $executable $ags -cp CI/samples.ci/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml +cp CI/samples.ci/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml diff --git a/bin/windows/typescript-fetch-petstore-all.bat b/bin/windows/typescript-fetch-petstore-all.bat index 01a9a692884e..bc26345767f2 100644 --- a/bin/windows/typescript-fetch-petstore-all.bat +++ b/bin/windows/typescript-fetch-petstore-all.bat @@ -5,4 +5,4 @@ call bin\windows\typescript-fetch-petstore-target-es6.bat call bin\windows\typescript-fetch-petstore-with-npm-version.bat call bin\windows\typescript-fetch-petstore-interfaces.bat call bin\windows\typescript-fetch-petstore-multiple-parameters.bat -call bin\windows\typescript-fetch-petstore-namespace-parameter-interfaces.bat +call bin\windows\typescript-fetch-petstore-prefix-parameter-interfaces.bat diff --git a/bin/windows/typescript-fetch-petstore-namespace-parameter-interfaces.bat b/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat similarity index 73% rename from bin/windows/typescript-fetch-petstore-namespace-parameter-interfaces.bat rename to bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat index 7a55a63820b4..2b271e1a2a5a 100644 --- a/bin/windows/typescript-fetch-petstore-namespace-parameter-interfaces.bat +++ b/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat @@ -7,6 +7,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\namespace-parameter-interfaces --additional-properties namespaceParameterInterfaces=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md index 6aea46a3a6de..70b94d6094b3 100644 --- a/docs/generators/typescript-fetch.md +++ b/docs/generators/typescript-fetch.md @@ -19,4 +19,4 @@ sidebar_label: typescript-fetch |npmRepository|Use this property to set an url your private npmRepo in the package.json| |null| |withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false| |useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true| -|namespaceParameterInterfaces|Setting this property to true will generate parameter interface declarations within a dedicated namespace to avoid name conflicts.| |false| +|prefixParameterInterfaces|Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 5024f3aab3e6..3e21ef9f8649 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -33,11 +33,11 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege public static final String NPM_REPOSITORY = "npmRepository"; public static final String WITH_INTERFACES = "withInterfaces"; public static final String USE_SINGLE_REQUEST_PARAMETER = "useSingleRequestParameter"; - public static final String NAMESPACE_PARAMETER_INTERFACES = "namespaceParameterInterfaces"; + public static final String PREFIX_PARAMETER_INTERFACES = "prefixParameterInterfaces"; protected String npmRepository = null; private boolean useSingleRequestParameter = true; - private boolean namespaceParameterInterfaces = false; + private boolean prefixParameterInterfaces = false; protected boolean addedApiIndex = false; protected boolean addedModelIndex = false; @@ -61,7 +61,7 @@ public TypeScriptFetchClientCodegen() { this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString())); - this.cliOptions.add(new CliOption(NAMESPACE_PARAMETER_INTERFACES, "Setting this property to true will generate parameter interface declarations within a dedicated namespace to avoid name conflicts.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); + this.cliOptions.add(new CliOption(PREFIX_PARAMETER_INTERFACES, "Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); } @Override @@ -97,10 +97,10 @@ public void processOpts() { } writePropertyBack(USE_SINGLE_REQUEST_PARAMETER, getUseSingleRequestParameter()); - if (additionalProperties.containsKey(NAMESPACE_PARAMETER_INTERFACES)) { - this.setNamespaceParameterInterfaces(convertPropertyToBoolean(NAMESPACE_PARAMETER_INTERFACES)); + if (additionalProperties.containsKey(PREFIX_PARAMETER_INTERFACES)) { + this.setPrefixParameterInterfaces(convertPropertyToBoolean(PREFIX_PARAMETER_INTERFACES)); } - writePropertyBack(NAMESPACE_PARAMETER_INTERFACES, getNamespaceParameterInterfaces()); + writePropertyBack(PREFIX_PARAMETER_INTERFACES, getPrefixParameterInterfaces()); if (additionalProperties.containsKey(NPM_NAME)) { addNpmPackageGeneration(); @@ -216,7 +216,7 @@ public Map postProcessOperationsWithModels(Map o this.addOperationModelImportInfomation(operations); this.updateOperationParameterEnumInformation(operations); this.addOperationObjectResponseInformation(operations); - this.addOperationNamespaceParameterInterfacesInformation(operations); + this.addOperationPrefixParameterInterfacesInformation(operations); return operations; } @@ -263,20 +263,9 @@ private void addOperationObjectResponseInformation(Map operation } } - private void addOperationNamespaceParameterInterfacesInformation(Map operations) { + private void addOperationPrefixParameterInterfacesInformation(Map operations) { Map _operations = (Map) operations.get("operations"); - List operationList = (List) _operations.get("operation"); - if (!operationList.isEmpty() && getNamespaceParameterInterfaces()) { - operations.put("namespaceParameterInterfaces", true); - operations.put("paramIfaceIndent", " "); - operations.put("paramIfaceSuffix", ""); - operations.put("paramIfaceNsPrefix", operationList.get(0).baseName + "Requests."); - } else { - operations.put("namespaceParameterInterfaces", false); - operations.put("paramIfaceIndent", ""); - operations.put("paramIfaceSuffix", "Request"); - operations.put("paramIfaceNsPrefix", ""); - } + operations.put("prefixParameterInterfaces", getPrefixParameterInterfaces()); } private void addExtraReservedWords() { @@ -315,11 +304,11 @@ private void setUseSingleRequestParameter(boolean useSingleRequestParameter) { this.useSingleRequestParameter = useSingleRequestParameter; } - private boolean getNamespaceParameterInterfaces() { - return namespaceParameterInterfaces; + private boolean getPrefixParameterInterfaces() { + return prefixParameterInterfaces; } - private void setNamespaceParameterInterfaces(boolean namespaceParameterInterfaces) { - this.namespaceParameterInterfaces = namespaceParameterInterfaces; + private void setPrefixParameterInterfaces(boolean prefixParameterInterfaces) { + this.prefixParameterInterfaces = prefixParameterInterfaces; } } diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 759051e7d2b3..75568642d938 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -13,31 +13,16 @@ import { {{/imports.0}} {{#operations}} -{{#namespaceParameterInterfaces}} -{{#operation.0}} -/** - * Generated request parameter interface declarations (in namespace to avoid collisions). - */ -export namespace {{baseName}}Requests { - -{{/operation.0}} -{{/namespaceParameterInterfaces}} {{#operation}} {{#allParams.0}} -{{paramIfaceIndent}}export interface {{operationIdCamelCase}}{{paramIfaceSuffix}} { +export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request { {{#allParams}} -{{paramIfaceIndent}} {{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; + {{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; {{/allParams}} -{{paramIfaceIndent}}} +} {{/allParams.0}} {{/operation}} -{{#namespaceParameterInterfaces}} -{{#operation.0}} -} - -{{/operation.0}} -{{/namespaceParameterInterfaces}} {{/operations}} {{#operations}} /** @@ -54,7 +39,7 @@ export class {{classname}} extends runtime.BaseAPI { * {{&summary}} {{/summary}} */ - async {{nickname}}Raw({{#allParams.0}}requestParameters: {{paramIfaceNsPrefix}}{{operationIdCamelCase}}{{paramIfaceSuffix}}{{/allParams.0}}): Promise> { + async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise> { {{#allParams}} {{#required}} if (requestParameters.{{paramName}} === null || requestParameters.{{paramName}} === undefined) { @@ -264,7 +249,7 @@ export class {{classname}} extends runtime.BaseAPI { } {{/useSingleRequestParameter}} {{#useSingleRequestParameter}} - async {{nickname}}({{#allParams.0}}requestParameters: {{paramIfaceNsPrefix}}{{operationIdCamelCase}}{{paramIfaceSuffix}}{{/allParams.0}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> { + async {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> { {{#returnType}} const response = await this.{{nickname}}Raw({{#allParams.0}}requestParameters{{/allParams.0}}); return await response.value(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java index 455d4d7c3a4e..4df8c608e259 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java @@ -52,7 +52,7 @@ public Map createOptions() { .put(TypeScriptFetchClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) .put(TypeScriptFetchClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString()) .put(TypeScriptFetchClientCodegen.USE_SINGLE_REQUEST_PARAMETER, Boolean.FALSE.toString()) - .put(TypeScriptFetchClientCodegen.NAMESPACE_PARAMETER_INTERFACES, Boolean.FALSE.toString()) + .put(TypeScriptFetchClientCodegen.PREFIX_PARAMETER_INTERFACES, Boolean.FALSE.toString()) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .build(); diff --git a/pom.xml b/pom.xml index 50baaca48f05..04c18fd46300 100644 --- a/pom.xml +++ b/pom.xml @@ -844,7 +844,7 @@ - typescript-fetch-client-builds-namespace-parameter-interfaces + typescript-fetch-client-builds-prefix-parameter-interfaces env @@ -852,7 +852,7 @@ - samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces + samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/.gitignore b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.gitignore similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/.gitignore rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.gitignore diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/.npmignore b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.npmignore similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/.npmignore rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.npmignore diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/.openapi-generator-ignore b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/.openapi-generator-ignore rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.openapi-generator-ignore diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/.openapi-generator/VERSION b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/.openapi-generator/VERSION rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.openapi-generator/VERSION diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/README.md b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/README.md similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/README.md rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/README.md diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/package.json b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/package.json similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/package.json rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/package.json diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml similarity index 96% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml index 1abcc68a8706..35c073c7dcaf 100644 --- a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml @@ -1,7 +1,7 @@ 4.0.0 org.openapitools - TypeScriptFetchBuildNamespaceParameterInterfacesPestoreClientTests + TypeScriptFetchBuildPrefixParameterInterfacesPestoreClientTests pom 1.0-SNAPSHOT TS Fetch Petstore Client (with namespacing for parameter interfaces) diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts similarity index 84% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/PetApi.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts index 6c0127bcddec..60dc1750c8ac 100644 --- a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts @@ -22,48 +22,41 @@ import { PetToJSON, } from '../models'; -/** - * Generated request parameter interface declarations (in namespace to avoid collisions). - */ -export namespace PetRequests { - - export interface AddPet { - body: Pet; - } - - export interface DeletePet { - petId: number; - apiKey?: string; - } +export interface PetApiAddPetRequest { + body: Pet; +} - export interface FindPetsByStatus { - status: Array; - } +export interface PetApiDeletePetRequest { + petId: number; + apiKey?: string; +} - export interface FindPetsByTags { - tags: Array; - } +export interface PetApiFindPetsByStatusRequest { + status: Array; +} - export interface GetPetById { - petId: number; - } +export interface PetApiFindPetsByTagsRequest { + tags: Array; +} - export interface UpdatePet { - body: Pet; - } +export interface PetApiGetPetByIdRequest { + petId: number; +} - export interface UpdatePetWithForm { - petId: number; - name?: string; - status?: string; - } +export interface PetApiUpdatePetRequest { + body: Pet; +} - export interface UploadFile { - petId: number; - additionalMetadata?: string; - file?: Blob; - } +export interface PetApiUpdatePetWithFormRequest { + petId: number; + name?: string; + status?: string; +} +export interface PetApiUploadFileRequest { + petId: number; + additionalMetadata?: string; + file?: Blob; } /** @@ -74,7 +67,7 @@ export class PetApi extends runtime.BaseAPI { /** * Add a new pet to the store */ - async addPetRaw(requestParameters: PetRequests.AddPet): Promise> { + async addPetRaw(requestParameters: PetApiAddPetRequest): Promise> { if (requestParameters.body === null || requestParameters.body === undefined) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); } @@ -108,14 +101,14 @@ export class PetApi extends runtime.BaseAPI { /** * Add a new pet to the store */ - async addPet(requestParameters: PetRequests.AddPet): Promise { + async addPet(requestParameters: PetApiAddPetRequest): Promise { await this.addPetRaw(requestParameters); } /** * Deletes a pet */ - async deletePetRaw(requestParameters: PetRequests.DeletePet): Promise> { + async deletePetRaw(requestParameters: PetApiDeletePetRequest): Promise> { if (requestParameters.petId === null || requestParameters.petId === undefined) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -150,7 +143,7 @@ export class PetApi extends runtime.BaseAPI { /** * Deletes a pet */ - async deletePet(requestParameters: PetRequests.DeletePet): Promise { + async deletePet(requestParameters: PetApiDeletePetRequest): Promise { await this.deletePetRaw(requestParameters); } @@ -158,7 +151,7 @@ export class PetApi extends runtime.BaseAPI { * Multiple status values can be provided with comma separated strings * Finds Pets by status */ - async findPetsByStatusRaw(requestParameters: PetRequests.FindPetsByStatus): Promise>> { + async findPetsByStatusRaw(requestParameters: PetApiFindPetsByStatusRequest): Promise>> { if (requestParameters.status === null || requestParameters.status === undefined) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -194,7 +187,7 @@ export class PetApi extends runtime.BaseAPI { * Multiple status values can be provided with comma separated strings * Finds Pets by status */ - async findPetsByStatus(requestParameters: PetRequests.FindPetsByStatus): Promise> { + async findPetsByStatus(requestParameters: PetApiFindPetsByStatusRequest): Promise> { const response = await this.findPetsByStatusRaw(requestParameters); return await response.value(); } @@ -203,7 +196,7 @@ export class PetApi extends runtime.BaseAPI { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags */ - async findPetsByTagsRaw(requestParameters: PetRequests.FindPetsByTags): Promise>> { + async findPetsByTagsRaw(requestParameters: PetApiFindPetsByTagsRequest): Promise>> { if (requestParameters.tags === null || requestParameters.tags === undefined) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -239,7 +232,7 @@ export class PetApi extends runtime.BaseAPI { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags */ - async findPetsByTags(requestParameters: PetRequests.FindPetsByTags): Promise> { + async findPetsByTags(requestParameters: PetApiFindPetsByTagsRequest): Promise> { const response = await this.findPetsByTagsRaw(requestParameters); return await response.value(); } @@ -248,7 +241,7 @@ export class PetApi extends runtime.BaseAPI { * Returns a single pet * Find pet by ID */ - async getPetByIdRaw(requestParameters: PetRequests.GetPetById): Promise> { + async getPetByIdRaw(requestParameters: PetApiGetPetByIdRequest): Promise> { if (requestParameters.petId === null || requestParameters.petId === undefined) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -275,7 +268,7 @@ export class PetApi extends runtime.BaseAPI { * Returns a single pet * Find pet by ID */ - async getPetById(requestParameters: PetRequests.GetPetById): Promise { + async getPetById(requestParameters: PetApiGetPetByIdRequest): Promise { const response = await this.getPetByIdRaw(requestParameters); return await response.value(); } @@ -283,7 +276,7 @@ export class PetApi extends runtime.BaseAPI { /** * Update an existing pet */ - async updatePetRaw(requestParameters: PetRequests.UpdatePet): Promise> { + async updatePetRaw(requestParameters: PetApiUpdatePetRequest): Promise> { if (requestParameters.body === null || requestParameters.body === undefined) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -317,14 +310,14 @@ export class PetApi extends runtime.BaseAPI { /** * Update an existing pet */ - async updatePet(requestParameters: PetRequests.UpdatePet): Promise { + async updatePet(requestParameters: PetApiUpdatePetRequest): Promise { await this.updatePetRaw(requestParameters); } /** * Updates a pet in the store with form data */ - async updatePetWithFormRaw(requestParameters: PetRequests.UpdatePetWithForm): Promise> { + async updatePetWithFormRaw(requestParameters: PetApiUpdatePetWithFormRequest): Promise> { if (requestParameters.petId === null || requestParameters.petId === undefined) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -365,14 +358,14 @@ export class PetApi extends runtime.BaseAPI { /** * Updates a pet in the store with form data */ - async updatePetWithForm(requestParameters: PetRequests.UpdatePetWithForm): Promise { + async updatePetWithForm(requestParameters: PetApiUpdatePetWithFormRequest): Promise { await this.updatePetWithFormRaw(requestParameters); } /** * uploads an image */ - async uploadFileRaw(requestParameters: PetRequests.UploadFile): Promise> { + async uploadFileRaw(requestParameters: PetApiUploadFileRequest): Promise> { if (requestParameters.petId === null || requestParameters.petId === undefined) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } @@ -413,7 +406,7 @@ export class PetApi extends runtime.BaseAPI { /** * uploads an image */ - async uploadFile(requestParameters: PetRequests.UploadFile): Promise { + async uploadFile(requestParameters: PetApiUploadFileRequest): Promise { const response = await this.uploadFileRaw(requestParameters); return await response.value(); } diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts similarity index 84% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/StoreApi.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts index 7715de670fcd..74848a98eaae 100644 --- a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts @@ -19,23 +19,16 @@ import { OrderToJSON, } from '../models'; -/** - * Generated request parameter interface declarations (in namespace to avoid collisions). - */ -export namespace StoreRequests { - - export interface DeleteOrder { - orderId: string; - } - - export interface GetOrderById { - orderId: number; - } +export interface StoreApiDeleteOrderRequest { + orderId: string; +} - export interface PlaceOrder { - body: Order; - } +export interface StoreApiGetOrderByIdRequest { + orderId: number; +} +export interface StoreApiPlaceOrderRequest { + body: Order; } /** @@ -47,7 +40,7 @@ export class StoreApi extends runtime.BaseAPI { * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID */ - async deleteOrderRaw(requestParameters: StoreRequests.DeleteOrder): Promise> { + async deleteOrderRaw(requestParameters: StoreApiDeleteOrderRequest): Promise> { if (requestParameters.orderId === null || requestParameters.orderId === undefined) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -70,7 +63,7 @@ export class StoreApi extends runtime.BaseAPI { * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID */ - async deleteOrder(requestParameters: StoreRequests.DeleteOrder): Promise { + async deleteOrder(requestParameters: StoreApiDeleteOrderRequest): Promise { await this.deleteOrderRaw(requestParameters); } @@ -110,7 +103,7 @@ export class StoreApi extends runtime.BaseAPI { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * Find purchase order by ID */ - async getOrderByIdRaw(requestParameters: StoreRequests.GetOrderById): Promise> { + async getOrderByIdRaw(requestParameters: StoreApiGetOrderByIdRequest): Promise> { if (requestParameters.orderId === null || requestParameters.orderId === undefined) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -133,7 +126,7 @@ export class StoreApi extends runtime.BaseAPI { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * Find purchase order by ID */ - async getOrderById(requestParameters: StoreRequests.GetOrderById): Promise { + async getOrderById(requestParameters: StoreApiGetOrderByIdRequest): Promise { const response = await this.getOrderByIdRaw(requestParameters); return await response.value(); } @@ -141,7 +134,7 @@ export class StoreApi extends runtime.BaseAPI { /** * Place an order for a pet */ - async placeOrderRaw(requestParameters: StoreRequests.PlaceOrder): Promise> { + async placeOrderRaw(requestParameters: StoreApiPlaceOrderRequest): Promise> { if (requestParameters.body === null || requestParameters.body === undefined) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } @@ -166,7 +159,7 @@ export class StoreApi extends runtime.BaseAPI { /** * Place an order for a pet */ - async placeOrder(requestParameters: StoreRequests.PlaceOrder): Promise { + async placeOrder(requestParameters: StoreApiPlaceOrderRequest): Promise { const response = await this.placeOrderRaw(requestParameters); return await response.value(); } diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts similarity index 80% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/UserApi.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts index 29f2def4ef65..ed4f39ed0c9c 100644 --- a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts @@ -19,41 +19,34 @@ import { UserToJSON, } from '../models'; -/** - * Generated request parameter interface declarations (in namespace to avoid collisions). - */ -export namespace UserRequests { - - export interface CreateUser { - body: User; - } - - export interface CreateUsersWithArrayInput { - body: Array; - } +export interface UserApiCreateUserRequest { + body: User; +} - export interface CreateUsersWithListInput { - body: Array; - } +export interface UserApiCreateUsersWithArrayInputRequest { + body: Array; +} - export interface DeleteUser { - username: string; - } +export interface UserApiCreateUsersWithListInputRequest { + body: Array; +} - export interface GetUserByName { - username: string; - } +export interface UserApiDeleteUserRequest { + username: string; +} - export interface LoginUser { - username: string; - password: string; - } +export interface UserApiGetUserByNameRequest { + username: string; +} - export interface UpdateUser { - username: string; - body: User; - } +export interface UserApiLoginUserRequest { + username: string; + password: string; +} +export interface UserApiUpdateUserRequest { + username: string; + body: User; } /** @@ -65,7 +58,7 @@ export class UserApi extends runtime.BaseAPI { * This can only be done by the logged in user. * Create user */ - async createUserRaw(requestParameters: UserRequests.CreateUser): Promise> { + async createUserRaw(requestParameters: UserApiCreateUserRequest): Promise> { if (requestParameters.body === null || requestParameters.body === undefined) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -91,14 +84,14 @@ export class UserApi extends runtime.BaseAPI { * This can only be done by the logged in user. * Create user */ - async createUser(requestParameters: UserRequests.CreateUser): Promise { + async createUser(requestParameters: UserApiCreateUserRequest): Promise { await this.createUserRaw(requestParameters); } /** * Creates list of users with given input array */ - async createUsersWithArrayInputRaw(requestParameters: UserRequests.CreateUsersWithArrayInput): Promise> { + async createUsersWithArrayInputRaw(requestParameters: UserApiCreateUsersWithArrayInputRequest): Promise> { if (requestParameters.body === null || requestParameters.body === undefined) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -123,14 +116,14 @@ export class UserApi extends runtime.BaseAPI { /** * Creates list of users with given input array */ - async createUsersWithArrayInput(requestParameters: UserRequests.CreateUsersWithArrayInput): Promise { + async createUsersWithArrayInput(requestParameters: UserApiCreateUsersWithArrayInputRequest): Promise { await this.createUsersWithArrayInputRaw(requestParameters); } /** * Creates list of users with given input array */ - async createUsersWithListInputRaw(requestParameters: UserRequests.CreateUsersWithListInput): Promise> { + async createUsersWithListInputRaw(requestParameters: UserApiCreateUsersWithListInputRequest): Promise> { if (requestParameters.body === null || requestParameters.body === undefined) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -155,7 +148,7 @@ export class UserApi extends runtime.BaseAPI { /** * Creates list of users with given input array */ - async createUsersWithListInput(requestParameters: UserRequests.CreateUsersWithListInput): Promise { + async createUsersWithListInput(requestParameters: UserApiCreateUsersWithListInputRequest): Promise { await this.createUsersWithListInputRaw(requestParameters); } @@ -163,7 +156,7 @@ export class UserApi extends runtime.BaseAPI { * This can only be done by the logged in user. * Delete user */ - async deleteUserRaw(requestParameters: UserRequests.DeleteUser): Promise> { + async deleteUserRaw(requestParameters: UserApiDeleteUserRequest): Promise> { if (requestParameters.username === null || requestParameters.username === undefined) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -186,14 +179,14 @@ export class UserApi extends runtime.BaseAPI { * This can only be done by the logged in user. * Delete user */ - async deleteUser(requestParameters: UserRequests.DeleteUser): Promise { + async deleteUser(requestParameters: UserApiDeleteUserRequest): Promise { await this.deleteUserRaw(requestParameters); } /** * Get user by user name */ - async getUserByNameRaw(requestParameters: UserRequests.GetUserByName): Promise> { + async getUserByNameRaw(requestParameters: UserApiGetUserByNameRequest): Promise> { if (requestParameters.username === null || requestParameters.username === undefined) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -215,7 +208,7 @@ export class UserApi extends runtime.BaseAPI { /** * Get user by user name */ - async getUserByName(requestParameters: UserRequests.GetUserByName): Promise { + async getUserByName(requestParameters: UserApiGetUserByNameRequest): Promise { const response = await this.getUserByNameRaw(requestParameters); return await response.value(); } @@ -223,7 +216,7 @@ export class UserApi extends runtime.BaseAPI { /** * Logs user into the system */ - async loginUserRaw(requestParameters: UserRequests.LoginUser): Promise> { + async loginUserRaw(requestParameters: UserApiLoginUserRequest): Promise> { if (requestParameters.username === null || requestParameters.username === undefined) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } @@ -257,7 +250,7 @@ export class UserApi extends runtime.BaseAPI { /** * Logs user into the system */ - async loginUser(requestParameters: UserRequests.LoginUser): Promise { + async loginUser(requestParameters: UserApiLoginUserRequest): Promise { const response = await this.loginUserRaw(requestParameters); return await response.value(); } @@ -291,7 +284,7 @@ export class UserApi extends runtime.BaseAPI { * This can only be done by the logged in user. * Updated user */ - async updateUserRaw(requestParameters: UserRequests.UpdateUser): Promise> { + async updateUserRaw(requestParameters: UserApiUpdateUserRequest): Promise> { if (requestParameters.username === null || requestParameters.username === undefined) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } @@ -321,7 +314,7 @@ export class UserApi extends runtime.BaseAPI { * This can only be done by the logged in user. * Updated user */ - async updateUser(requestParameters: UserRequests.UpdateUser): Promise { + async updateUser(requestParameters: UserApiUpdateUserRequest): Promise { await this.updateUserRaw(requestParameters); } diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/index.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/apis/index.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/index.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/index.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/Category.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/ModelApiResponse.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/Order.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/Pet.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/Tag.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/User.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/index.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/models/index.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/src/runtime.ts rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts diff --git a/samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.json similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/tsconfig.json rename to samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.json