diff --git a/docs/generators/typescript-nestjs.md b/docs/generators/typescript-nestjs.md
index 2055133b6b89..47037f98f6b0 100644
--- a/docs/generators/typescript-nestjs.md
+++ b/docs/generators/typescript-nestjs.md
@@ -116,9 +116,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
float
for
formParams
+from
function
goto
headerParams
+headers
if
implements
import
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java
index 520d69e2d62d..770167b0e765 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java
@@ -17,6 +17,8 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema;
+import io.swagger.v3.oas.models.parameters.Parameter;
+import io.swagger.v3.oas.models.parameters.RequestBody;
import lombok.Getter;
import lombok.Setter;
import org.openapitools.codegen.*;
@@ -88,6 +90,8 @@ public TypeScriptNestjsClientCodegen() {
apiPackage = "api";
modelPackage = "model";
+ reservedWords.addAll(Arrays.asList("from", "headers"));
+
this.cliOptions.add(new CliOption(NPM_REPOSITORY,
"Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(CliOption.newBoolean(WITH_INTERFACES,
@@ -265,6 +269,34 @@ private boolean isLanguageGenericType(String type) {
return false;
}
+ @Override
+ public List fromRequestBodyToFormParameters(RequestBody body, Set imports) {
+ List superParams = super.fromRequestBodyToFormParameters(body, imports);
+ List extendedParams = new ArrayList();
+ for (CodegenParameter cp : superParams) {
+ extendedParams.add(new ExtendedCodegenParameter(cp));
+ }
+ return extendedParams;
+ }
+
+ @Override
+ public ExtendedCodegenParameter fromParameter(Parameter parameter, Set imports) {
+ CodegenParameter cp = super.fromParameter(parameter, imports);
+ return new ExtendedCodegenParameter(cp);
+ }
+
+ @Override
+ public CodegenParameter fromFormProperty(String name, Schema propertySchema, Set imports) {
+ CodegenParameter cp = super.fromFormProperty(name, propertySchema, imports);
+ return new ExtendedCodegenParameter(cp);
+ }
+
+ @Override
+ public CodegenParameter fromRequestBody(RequestBody body, Set imports, String bodyParameterName) {
+ CodegenParameter cp = super.fromRequestBody(body, imports, bodyParameterName);
+ return new ExtendedCodegenParameter(cp);
+ }
+
@Override
public void postProcessParameter(CodegenParameter parameter) {
super.postProcessParameter(parameter);
@@ -327,6 +359,12 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap operations, L
// Overwrite path to TypeScript template string, after applying everything we just did.
op.path = pathBuffer.toString();
+
+ for (CodegenParameter cpParam : op.allParams) {
+ ExtendedCodegenParameter param = (ExtendedCodegenParameter) cpParam;
+
+ param.hasSanitizedName = !param.baseName.equals(param.paramName);
+ }
}
operations.put("hasSomeFormParams", hasSomeFormParams);
@@ -482,6 +520,126 @@ public String removeModelPrefixSuffix(String name) {
return result;
}
+ public class ExtendedCodegenParameter extends CodegenParameter {
+ public boolean hasSanitizedName = false;
+
+ public ExtendedCodegenParameter(CodegenParameter cp) {
+ super();
+
+ this.isFormParam = cp.isFormParam;
+ this.isQueryParam = cp.isQueryParam;
+ this.isPathParam = cp.isPathParam;
+ this.isHeaderParam = cp.isHeaderParam;
+ this.isCookieParam = cp.isCookieParam;
+ this.isBodyParam = cp.isBodyParam;
+ this.isContainer = cp.isContainer;
+ this.isCollectionFormatMulti = cp.isCollectionFormatMulti;
+ this.isPrimitiveType = cp.isPrimitiveType;
+ this.isModel = cp.isModel;
+ this.isExplode = cp.isExplode;
+ this.baseName = cp.baseName;
+ this.paramName = cp.paramName;
+ this.dataType = cp.dataType;
+ this.datatypeWithEnum = cp.datatypeWithEnum;
+ this.dataFormat = cp.dataFormat;
+ this.contentType = cp.contentType;
+ this.collectionFormat = cp.collectionFormat;
+ this.description = cp.description;
+ this.unescapedDescription = cp.unescapedDescription;
+ this.baseType = cp.baseType;
+ this.defaultValue = cp.defaultValue;
+ this.enumName = cp.enumName;
+ this.style = cp.style;
+ this.nameInLowerCase = cp.nameInLowerCase;
+ this.example = cp.example;
+ this.jsonSchema = cp.jsonSchema;
+ this.isString = cp.isString;
+ this.isNumeric = cp.isNumeric;
+ this.isInteger = cp.isInteger;
+ this.isLong = cp.isLong;
+ this.isNumber = cp.isNumber;
+ this.isFloat = cp.isFloat;
+ this.isDouble = cp.isDouble;
+ this.isDecimal = cp.isDecimal;
+ this.isByteArray = cp.isByteArray;
+ this.isBinary = cp.isBinary;
+ this.isBoolean = cp.isBoolean;
+ this.isDate = cp.isDate;
+ this.isDateTime = cp.isDateTime;
+ this.isUuid = cp.isUuid;
+ this.isUri = cp.isUri;
+ this.isEmail = cp.isEmail;
+ this.isFreeFormObject = cp.isFreeFormObject;
+ this.isAnyType = cp.isAnyType;
+ this.isArray = cp.isArray;
+ this.isMap = cp.isMap;
+ this.isFile = cp.isFile;
+ this.isEnum = cp.isEnum;
+ this.isEnumRef = cp.isEnumRef;
+ this._enum = cp._enum;
+ this.allowableValues = cp.allowableValues;
+ this.items = cp.items;
+ this.additionalProperties = cp.additionalProperties;
+ this.vars = cp.vars;
+ this.requiredVars = cp.requiredVars;
+ this.mostInnerItems = cp.mostInnerItems;
+ this.vendorExtensions = cp.vendorExtensions;
+ this.hasValidation = cp.hasValidation;
+ this.isNullable = cp.isNullable;
+ this.required = cp.required;
+ this.maximum = cp.maximum;
+ this.exclusiveMaximum = cp.exclusiveMaximum;
+ this.minimum = cp.minimum;
+ this.exclusiveMinimum = cp.exclusiveMinimum;
+ this.maxLength = cp.maxLength;
+ this.minLength = cp.minLength;
+ this.pattern = cp.pattern;
+ this.maxItems = cp.maxItems;
+ this.minItems = cp.minItems;
+ this.uniqueItems = cp.uniqueItems;
+ this.multipleOf = cp.multipleOf;
+ this.setHasVars(cp.getHasVars());
+ this.setHasRequired(cp.getHasRequired());
+ this.setMaxProperties(cp.getMaxProperties());
+ this.setMinProperties(cp.getMinProperties());
+ }
+
+ @Override
+ public ExtendedCodegenParameter copy() {
+ CodegenParameter superCopy = super.copy();
+ ExtendedCodegenParameter output = new ExtendedCodegenParameter(superCopy);
+ output.hasSanitizedName = this.hasSanitizedName;
+ return output;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null)
+ return false;
+
+ if (this.getClass() != o.getClass())
+ return false;
+
+ boolean result = super.equals(o);
+ ExtendedCodegenParameter that = (ExtendedCodegenParameter) o;
+ return result && hasSanitizedName == that.hasSanitizedName;
+ }
+
+ @Override
+ public int hashCode() {
+ int superHash = super.hashCode();
+ return Objects.hash(superHash, hasSanitizedName);
+ }
+
+ @Override
+ public String toString() {
+ String superString = super.toString();
+ final StringBuilder sb = new StringBuilder(superString);
+ sb.append(", hasSanitizedName=").append(hasSanitizedName);
+ return sb.toString();
+ }
+ }
+
/**
* Validates that the given string value only contains '-', '.' and alpha numeric characters.
* Throws an IllegalArgumentException, if the string contains any other characters.
diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache
index 9a74aa8db88b..dc67f59d27fe 100644
--- a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache
@@ -35,7 +35,7 @@ export interface {{classname}}{{operationIdCamelCase}}Request {
* @type {{=<% %>=}}{<%&dataType%>}<%={{ }}=%>
* @memberof {{classname}}{{operationIdCamelCase}}
*/
- readonly '{{paramName}}'{{^required}}?{{/required}}: {{{dataType}}}
+ readonly {{#hasSanitizedName}}'{{{baseName}}}'{{/hasSanitizedName}}{{^hasSanitizedName}}{{{paramName}}}{{/hasSanitizedName}}{{^required}}?{{/required}}: {{{dataType}}}
{{^-last}}
{{/-last}}
@@ -102,13 +102,23 @@ export class {{classname}} {
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable>;
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable {
{{/useSingleRequestParameter}}
+{{#allParams.0}}
+{{#useSingleRequestParameter}}
+ const {
+ {{#allParams}}
+ {{#hasSanitizedName}}'{{{baseName}}}': {{/hasSanitizedName}}{{paramName}},
+ {{/allParams}}
+ } = requestParameters;
+
+{{/useSingleRequestParameter}}
+{{/allParams.0}}
{{#allParams}}
{{#required}}
{{#isConstEnumParam}}
let {{paramName}} = {{{dataType}}};
{{/isConstEnumParam}}
{{^isConstEnumParam}}
- if ({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}} === null || {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}} === undefined) {
+ if ({{paramName}} === null || {{paramName}} === undefined) {
throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
}
@@ -119,24 +129,24 @@ export class {{classname}} {
let queryParameters = new URLSearchParams();
{{#queryParams}}
{{#isArray}}
- if ({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}) {
+ if ({{paramName}}) {
{{#isCollectionFormatMulti}}
- {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}.forEach((element) => {
+ {{paramName}}.forEach((element) => {
queryParameters.append('{{baseName}}', element);
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
- queryParameters['{{baseName}}'] = {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}.join(COLLECTION_FORMATS['{{collectionFormat}}']);
+ queryParameters['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']);
{{/isCollectionFormatMulti}}
}
{{/isArray}}
{{^isArray}}
- if ({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}} !== undefined && {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}} !== null) {
+ if ({{paramName}} !== undefined && {{paramName}} !== null) {
{{#isDateTime}}
- queryParameters.append('{{baseName}}', ({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}).toISOString());
+ queryParameters.append('{{baseName}}', ({{paramName}}).toISOString());
{{/isDateTime}}
{{^isDateTime}}
- queryParameters.append('{{baseName}}', {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}});
+ queryParameters.append('{{baseName}}', {{paramName}});
{{/isDateTime}}
}
{{/isArray}}
@@ -146,13 +156,13 @@ export class {{classname}} {
let headers = {...this.defaultHeaders};
{{#headerParams}}
{{#isArray}}
- if ({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}) {
- headers['{{baseName}}'] = {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}.join(COLLECTION_FORMATS['{{collectionFormat}}']);
+ if ({{paramName}}) {
+ headers['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']);
}
{{/isArray}}
{{^isArray}}
- if ({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}} !== undefined && {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}} !== null) {
- headers['{{baseName}}'] = String({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}});
+ if ({{paramName}} !== undefined && {{paramName}} !== null) {
+ headers['{{baseName}}'] = String({{paramName}});
}
{{/isArray}}
{{/headerParams}}
@@ -246,20 +256,20 @@ export class {{classname}} {
{{#formParams}}
{{#isArray}}
- if ({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}) {
+ if ({{paramName}}) {
{{#isCollectionFormatMulti}}
- {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}.forEach((element) => {
+ {{paramName}}.forEach((element) => {
formParams!.append('{{baseName}}', element);
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
- formParams!.append('{{baseName}}', {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}.join(COLLECTION_FORMATS['{{collectionFormat}}']));
+ formParams!.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']));
{{/isCollectionFormatMulti}}
}
{{/isArray}}
{{^isArray}}
- if ({{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}} !== undefined) {
- formParams!.append('{{baseName}}', {{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}});
+ if ({{paramName}} !== undefined) {
+ formParams!.append('{{baseName}}', {{paramName}});
}
{{/isArray}}
{{/formParams}}
@@ -272,7 +282,7 @@ export class {{classname}} {
}
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}}
- {{#bodyParam}}{{#useSingleRequestParameter}}requestParameters['{{/useSingleRequestParameter}}{{paramName}}{{#useSingleRequestParameter}}']{{/useSingleRequestParameter}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams!.toString() : formParams!{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}}
+ {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams!.toString() : formParams!{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}}
{
{{#hasQueryParams}}
params: queryParameters,
diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGeneric.mustache
index 306a4e5982f2..720aac912881 100644
--- a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGeneric.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelGeneric.mustache
@@ -5,6 +5,6 @@ export interface {{classname}}{{#allParents}}{{#-first}} extends {{/-first}}{{{.
* {{{.}}}
*/
{{/description}}
- {{#isReadOnly}}readonly {{/isReadOnly}}'{{{name}}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}};
+ {{#isReadOnly}}readonly {{/isReadOnly}}{{#hasSanitizedName}}'{{{baseName}}}'{{/hasSanitizedName}}{{^hasSanitizedName}}{{{name}}}{{/hasSanitizedName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}};
{{/vars}}
}{{>modelGenericEnums}}
diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelTaggedUnion.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelTaggedUnion.mustache
index 78394ca83846..754c1db278ba 100644
--- a/modules/openapi-generator/src/main/resources/typescript-nestjs/modelTaggedUnion.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/modelTaggedUnion.mustache
@@ -10,7 +10,7 @@ export interface {{classname}} { {{>modelGenericAdditionalProperties}}
* {{{.}}}
*/
{{/description}}
- '{{name}}'{{^required}}?{{/required}}: {{#discriminatorValue}}'{{.}}'{{/discriminatorValue}}{{^discriminatorValue}}{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{/discriminatorValue}}{{#isNullable}} | null{{/isNullable}};
+ {{#hasSanitizedName}}'{{{baseName}}}'{{/hasSanitizedName}}{{^hasSanitizedName}}{{{name}}}{{/hasSanitizedName}}{{^required}}?{{/required}}: {{#discriminatorValue}}'{{.}}'{{/discriminatorValue}}{{^discriminatorValue}}{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{/discriminatorValue}}{{#isNullable}} | null{{/isNullable}};
{{/allVars}}
}
{{>modelGenericEnums}}
diff --git a/modules/openapi-generator/src/test/resources/3_0/typescript-nestjs/reserved-param-names.yaml b/modules/openapi-generator/src/test/resources/3_0/typescript-nestjs/reserved-param-names.yaml
index 91f3b8588afc..ab02beffe8c6 100644
--- a/modules/openapi-generator/src/test/resources/3_0/typescript-nestjs/reserved-param-names.yaml
+++ b/modules/openapi-generator/src/test/resources/3_0/typescript-nestjs/reserved-param-names.yaml
@@ -12,6 +12,12 @@ paths:
description: ''
operationId: testReservedParamNames
parameters:
+ - name: notReserved
+ in: query
+ description: Should not be treated as a reserved param name
+ required: true
+ schema:
+ type: string
- name: from
in: query
description: Might conflict with rxjs import
diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/apiResponse.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/apiResponse.ts
index 98a604e8c9b5..682ba478921e 100644
--- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/apiResponse.ts
+++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/apiResponse.ts
@@ -15,8 +15,8 @@
* Describes the result of uploading an image resource
*/
export interface ApiResponse {
- 'code'?: number;
- 'type'?: string;
- 'message'?: string;
+ code?: number;
+ type?: string;
+ message?: string;
}
diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/category.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/category.ts
index 53cd597f732c..b988b6827a05 100644
--- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/category.ts
+++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/category.ts
@@ -15,7 +15,7 @@
* A category for a pet
*/
export interface Category {
- 'id'?: number;
- 'name'?: string;
+ id?: number;
+ name?: string;
}
diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/order.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/order.ts
index 6fe5ff4b6c37..a29bebe49065 100644
--- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/order.ts
+++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/order.ts
@@ -15,15 +15,15 @@
* An order for a pets from the pet store
*/
export interface Order {
- 'id'?: number;
- 'petId'?: number;
- 'quantity'?: number;
- 'shipDate'?: string;
+ id?: number;
+ petId?: number;
+ quantity?: number;
+ shipDate?: string;
/**
* Order Status
*/
- 'status'?: Order.StatusEnum;
- 'complete'?: boolean;
+ status?: Order.StatusEnum;
+ complete?: boolean;
}
export namespace Order {
export type StatusEnum = 'placed' | 'approved' | 'delivered';
diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/pet.ts
index 84986996e282..e0404395f91c 100644
--- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/pet.ts
+++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/pet.ts
@@ -17,15 +17,15 @@ import { Tag } from './tag';
* A pet for sale in the pet store
*/
export interface Pet {
- 'id'?: number;
- 'category'?: Category;
- 'name': string;
- 'photoUrls': Array;
- 'tags'?: Array;
+ id?: number;
+ category?: Category;
+ name: string;
+ photoUrls: Array;
+ tags?: Array;
/**
* pet status in the store
*/
- 'status'?: Pet.StatusEnum;
+ status?: Pet.StatusEnum;
}
export namespace Pet {
export type StatusEnum = 'available' | 'pending' | 'sold';
diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/tag.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/tag.ts
index 9fd8a41f47ec..b6ff210e8df4 100644
--- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/tag.ts
+++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/tag.ts
@@ -15,7 +15,7 @@
* A tag for a pet
*/
export interface Tag {
- 'id'?: number;
- 'name'?: string;
+ id?: number;
+ name?: string;
}
diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/user.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/user.ts
index db12e3c1ca24..fce51005300c 100644
--- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/user.ts
+++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/model/user.ts
@@ -15,16 +15,16 @@
* A User who is purchasing from the pet store
*/
export interface User {
- 'id'?: number;
- 'username'?: string;
- 'firstName'?: string;
- 'lastName'?: string;
- 'email'?: string;
- 'password'?: string;
- 'phone'?: string;
+ id?: number;
+ username?: string;
+ firstName?: string;
+ lastName?: string;
+ email?: string;
+ password?: string;
+ phone?: string;
/**
* User Status
*/
- 'userStatus'?: number;
+ userStatus?: number;
}
diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/apiResponse.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/apiResponse.ts
index 98a604e8c9b5..682ba478921e 100644
--- a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/apiResponse.ts
+++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/apiResponse.ts
@@ -15,8 +15,8 @@
* Describes the result of uploading an image resource
*/
export interface ApiResponse {
- 'code'?: number;
- 'type'?: string;
- 'message'?: string;
+ code?: number;
+ type?: string;
+ message?: string;
}
diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/category.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/category.ts
index 53cd597f732c..b988b6827a05 100644
--- a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/category.ts
+++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/category.ts
@@ -15,7 +15,7 @@
* A category for a pet
*/
export interface Category {
- 'id'?: number;
- 'name'?: string;
+ id?: number;
+ name?: string;
}
diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/order.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/order.ts
index 6fe5ff4b6c37..a29bebe49065 100644
--- a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/order.ts
+++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/order.ts
@@ -15,15 +15,15 @@
* An order for a pets from the pet store
*/
export interface Order {
- 'id'?: number;
- 'petId'?: number;
- 'quantity'?: number;
- 'shipDate'?: string;
+ id?: number;
+ petId?: number;
+ quantity?: number;
+ shipDate?: string;
/**
* Order Status
*/
- 'status'?: Order.StatusEnum;
- 'complete'?: boolean;
+ status?: Order.StatusEnum;
+ complete?: boolean;
}
export namespace Order {
export type StatusEnum = 'placed' | 'approved' | 'delivered';
diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/pet.ts
index 84986996e282..e0404395f91c 100644
--- a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/pet.ts
+++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/pet.ts
@@ -17,15 +17,15 @@ import { Tag } from './tag';
* A pet for sale in the pet store
*/
export interface Pet {
- 'id'?: number;
- 'category'?: Category;
- 'name': string;
- 'photoUrls': Array;
- 'tags'?: Array;
+ id?: number;
+ category?: Category;
+ name: string;
+ photoUrls: Array;
+ tags?: Array;
/**
* pet status in the store
*/
- 'status'?: Pet.StatusEnum;
+ status?: Pet.StatusEnum;
}
export namespace Pet {
export type StatusEnum = 'available' | 'pending' | 'sold';
diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/tag.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/tag.ts
index 9fd8a41f47ec..b6ff210e8df4 100644
--- a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/tag.ts
+++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/tag.ts
@@ -15,7 +15,7 @@
* A tag for a pet
*/
export interface Tag {
- 'id'?: number;
- 'name'?: string;
+ id?: number;
+ name?: string;
}
diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/user.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/user.ts
index db12e3c1ca24..fce51005300c 100644
--- a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/user.ts
+++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/user.ts
@@ -15,16 +15,16 @@
* A User who is purchasing from the pet store
*/
export interface User {
- 'id'?: number;
- 'username'?: string;
- 'firstName'?: string;
- 'lastName'?: string;
- 'email'?: string;
- 'password'?: string;
- 'phone'?: string;
+ id?: number;
+ username?: string;
+ firstName?: string;
+ lastName?: string;
+ email?: string;
+ password?: string;
+ phone?: string;
/**
* User Status
*/
- 'userStatus'?: number;
+ userStatus?: number;
}
diff --git a/samples/client/petstore/typescript-nestjs/builds/reservedParamNames/api/default.service.ts b/samples/client/petstore/typescript-nestjs/builds/reservedParamNames/api/default.service.ts
index afd6e3552e93..c41aa37ec06b 100644
--- a/samples/client/petstore/typescript-nestjs/builds/reservedParamNames/api/default.service.ts
+++ b/samples/client/petstore/typescript-nestjs/builds/reservedParamNames/api/default.service.ts
@@ -24,6 +24,13 @@ import { COLLECTION_FORMATS } from '../variables';
* @interface DefaultServiceTestReservedParamNamesRequest
*/
export interface DefaultServiceTestReservedParamNamesRequest {
+ /**
+ * Should not be treated as a reserved param name
+ * @type {string}
+ * @memberof DefaultServiceTestReservedParamNames
+ */
+ readonly notReserved: string
+
/**
* Might conflict with rxjs import
* @type {string}
@@ -70,22 +77,35 @@ export class DefaultService {
*/
public testReservedParamNames(requestParameters: DefaultServiceTestReservedParamNamesRequest, ): Observable>;
public testReservedParamNames(requestParameters: DefaultServiceTestReservedParamNamesRequest, ): Observable {
- if (requestParameters['from'] === null || requestParameters['from'] === undefined) {
- throw new Error('Required parameter from was null or undefined when calling testReservedParamNames.');
+ const {
+ notReserved,
+ 'from': _from,
+ 'headers': _headers,
+ } = requestParameters;
+
+ if (notReserved === null || notReserved === undefined) {
+ throw new Error('Required parameter notReserved was null or undefined when calling testReservedParamNames.');
+ }
+
+ if (_from === null || _from === undefined) {
+ throw new Error('Required parameter _from was null or undefined when calling testReservedParamNames.');
}
- if (requestParameters['headers'] === null || requestParameters['headers'] === undefined) {
- throw new Error('Required parameter headers was null or undefined when calling testReservedParamNames.');
+ if (_headers === null || _headers === undefined) {
+ throw new Error('Required parameter _headers was null or undefined when calling testReservedParamNames.');
}
let queryParameters = new URLSearchParams();
- if (requestParameters['from'] !== undefined && requestParameters['from'] !== null) {
- queryParameters.append('from', requestParameters['from']);
+ if (notReserved !== undefined && notReserved !== null) {
+ queryParameters.append('notReserved', notReserved);
+ }
+ if (_from !== undefined && _from !== null) {
+ queryParameters.append('from', _from);
}
let headers = {...this.defaultHeaders};
- if (requestParameters['headers'] !== undefined && requestParameters['headers'] !== null) {
- headers['headers'] = String(requestParameters['headers']);
+ if (_headers !== undefined && _headers !== null) {
+ headers['headers'] = String(_headers);
}
let accessTokenObservable: Observable = of(null);