[FEATURE]
hi, everyone, i'm using openapi-generator-cli for generate TS services and models
I m using Symfony 4 with Doctrine and API Platform to build the backend of my application. I generated entities using php bin/console make:entity. Each class has an id field like this one
/**
* @ApiResource()
* @ORM\Entity(repositoryClass=CategoryRepository::class)
*/
class Category
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
...
i use a json file which contain @id and id for arttribute in object
"@id": {
"readOnly": true,
"type": "string"
},
"@type": {
"readOnly": true,
"type": "string"
},
"id": {
"readOnly": true,
"type": "integer",
"nullable": true
},
i use this commande to generate code : openapi-generator-cli generate -i ./json.json -g typescript-angular -o src/app/generated-api/
here i obtain :
export interface CategoryJsonld {
readonly context?: string | any | null;
readonly id?: string;
readonly type?: string;
id?: number;
...
I found why
because of the sanitazer in AbstractTypeScriptClientCodegen.java
name = sanitizeName(name, "[^\\w$]");
Solution ?
i we can add a parameter to bypass this sanitize or to override it that would be great !
example :
--additional-properties=notSanitize =true
output
export interface CategoryJsonld {
readonly context?: string | any | null;
readonly '@id'?: string;
readonly type?: string;
id?: number;
...
i found a topic related !#13999 best regard, Pierre