diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index cc5a4d319211..c4caca0c6227 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -856,6 +856,7 @@ private String getNameUsingParamNaming(String name) { private String getNameUsingModelPropertyNaming(String name) { switch (getModelPropertyNaming()) { case original: + additionalProperties.put("modelPropertyNamingOriginal", true); return name; case camelCase: return camelize(name, LOWERCASE_FIRST_LETTER); diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache index 562a5e33eebe..1d860cedf041 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache @@ -13,6 +13,11 @@ export interface {{classname}}{{#allParents}}{{#-first}} extends {{/-first}}{{{. /** @deprecated */ {{/deprecated}} {{/description}} + {{^modelPropertyNamingOriginal}} + {{#isReadOnly}}readonly {{/isReadOnly}}{{{name}}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}}; + {{/modelPropertyNamingOriginal}} + {{#modelPropertyNamingOriginal}} {{#isReadOnly}}readonly {{/isReadOnly}}{{#hasSanitizedName}}'{{{baseName}}}'{{/hasSanitizedName}}{{^hasSanitizedName}}{{{name}}}{{/hasSanitizedName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}}; + {{/modelPropertyNamingOriginal}} {{/vars}} }{{>modelGenericEnums}} diff --git a/modules/openapi-generator/src/test/resources/3_0/typescript-angular/composed-schemas.yaml b/modules/openapi-generator/src/test/resources/3_0/typescript-angular/composed-schemas.yaml index e18ae757e726..0cc11cea4685 100644 --- a/modules/openapi-generator/src/test/resources/3_0/typescript-angular/composed-schemas.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/typescript-angular/composed-schemas.yaml @@ -26,6 +26,11 @@ paths: components: schemas: + Dummy: + type: object + properties: + property.name: + type: string DogBreed: type: string enum: [Dingo, Husky] diff --git a/samples/client/others/typescript-angular/builds/composed-schemas/.openapi-generator/FILES b/samples/client/others/typescript-angular/builds/composed-schemas/.openapi-generator/FILES index 8f9668fe1248..630a7ad821d6 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas/.openapi-generator/FILES +++ b/samples/client/others/typescript-angular/builds/composed-schemas/.openapi-generator/FILES @@ -14,6 +14,7 @@ model/dogBreed.ts model/dogComposed.ts model/dogInherited.ts model/dogMapped.ts +model/dummy.ts model/models.ts model/petWithMappedDiscriminator.ts model/petWithSimpleDiscriminator.ts diff --git a/samples/client/others/typescript-angular/builds/composed-schemas/model/dummy.ts b/samples/client/others/typescript-angular/builds/composed-schemas/model/dummy.ts new file mode 100644 index 000000000000..28ce8912b39b --- /dev/null +++ b/samples/client/others/typescript-angular/builds/composed-schemas/model/dummy.ts @@ -0,0 +1,15 @@ +/** + * Schemas with different types of composition for testing models generation + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface DummyModel { + 'property.name'?: string; +} + diff --git a/samples/client/others/typescript-angular/builds/composed-schemas/model/models.ts b/samples/client/others/typescript-angular/builds/composed-schemas/model/models.ts index 017b537546ea..8efea01e203c 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas/model/models.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas/model/models.ts @@ -5,6 +5,7 @@ export * from './dogBreed'; export * from './dogComposed'; export * from './dogInherited'; export * from './dogMapped'; +export * from './dummy'; export * from './petWithMappedDiscriminator'; export * from './petWithSimpleDiscriminator'; export * from './petWithoutDiscriminator';