Skip to content

[BUG][TypeScript Angular] Leading '@' stripped in field names #8155

@clementcontet

Description

@clementcontet
Description

When generating classes for TypeScript Angular, if a field name has a leading @ character, it is stripped.
We have these @ characters because we wanted to follow a TM Forum API Design guideline (which has these @referredType fields).

openapi-generator version

Tested with 4.3.1 and 5.0.0-beta3

OpenAPI declaration file content or url

When parsing this yaml: https://gist.github.com/clementcontet/2eaa131ec7a39c73729474508d0ca6f8#file-test-swagger-yaml

I get this generated class:

import { ProductOfferingType } from './productOfferingType';

export interface ProductOfferingRef { 
    id: string;
    referredType: ProductOfferingType;
}
Generation Details

I use this config file:

{
  "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "5.0.0-beta3",
    "generators": {
      "v2.0": {
        "generatorName": "typescript-angular",
        "output": "build",
        "glob": "swagger/swagger.yaml",
        "additionalProperties": {
          "ngVersion": "11.0.0",
          "configurationPrefix": "enov"
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions