OpenAPITools / OpenAPITools/openapi-generator
[BUG][TypeScript Angular] Leading '@' stripped in field names
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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"
}
}
}
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the linked OpenAPI YAML, the provided generator-cli configuration, and the typescript-angular generator. Start by tracing how the generated ProductOfferingRef fields are named; done means preserving the leading @ in generated field names and adding a regression test for this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100