I am using openapi-generator with typescript-fetch plugin:
openapi-generator generate -g typescript-fetch --additional-properties=supportsES6=true,typescriptThreePlus=true,modelPropertyNaming=original -o ./open-api -i ./apigateway.json
for some reason, the generator alsways transforms properties adv_1-1 to adv_1_1. meaning, it removes the original -.
spec:
"prices": {
"type": "object",
"properties": {
"adv_1-1": {
"type": "number"
},
"adv_1-2": {
"type": "number"
},
"adv_1-3": {
"type": "number"
},
"adv_1-4": {
"type": "number"
},
"adv_1-6": {
"type": "number"
},
"adv_2-1": {
"type": "number"
},
"adv_2-3": {
"type": "number"
},
"migrateId": {
"type": "number"
},
"mm": {
"type": "number"
}
}
}
result:
export interface MediaPrintPrices {
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
adv_1_1?: number;
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
adv_1_2?: number;
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
adv_1_3?: number;
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
adv_1_4?: number;
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
adv_1_6?: number;
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
adv_2_1?: number;
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
adv_2_3?: number;
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
migrateId?: number;
/**
*
* @type {number}
* @memberof MediaPrintPrices
*/
mm?: number;
}
4.1.2
openapi-generator generate -g typescript-fetch --additional-properties=supportsES6=true,typescriptThreePlus=true,modelPropertyNaming=original -o ./open-api -i ./apigateway.json
馃憤 Thanks for opening this issue!
馃彿 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
@misantronic no expert in TS but is dash (-) allowed in the variable naming?
Ideally, we should be using a JSON serializer to handle this but I don't think we've found it suitable yet.
dashes are not allowed in variables, but that doesnt matter since they are allowed in literal object-properties.
Can you please try the following option?
modelPropertyNaming
Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase)
As seen in my example above, I already use original. In my opinion it should then keep the original structure of the properties.
Most helpful comment
As seen in my example above, I already use
original. In my opinion it should then keep the original structure of the properties.