openapi-generator-dart
openapi-generator-dart copied to clipboard
Trailing underscore gets removed while parsing
Description of the bug
Parsing the following spec produces invalid dart code.
The error is, that the class attribute package_
gets renamed to package
but this one already exists.
Steps to reproduce
parse this file.
{
"openapi": "3.0.1",
"info": {
"title": "my-service",
"version": "1.0"
},
"servers": [
{
"url": "/my-service"
}
],
"security": [
{
"Authorization": []
}
],
"paths": {
"/api/v2/subscription/cancel": {
"delete": {
"tags": [
"subscription-v-2-controller"
],
"operationId": "cancelSubscription_2",
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"components": {
"schemas": {
"WechatPayRedirectToAndroidApp": {
"type": "object",
"properties": {
"timestamp": {
"type": "string"
},
"package_": {
"type": "string"
},
"package": {
"type": "string"
}
}
}
}
}
}
@Openapi(
additionalProperties: AdditionalProperties(
pubName: 'openapi_my_service',
),
alwaysRun: true,
inputSpecFile: 'lib/src/common/openapi_specs/my_service.json',
generatorName: Generator.dart,
outputDirectory: '../generated/my_service/',
)
class MyServiceOpenapiGeneratorConfig {}
Expected behavior
The variable gets not renamed, or I have the option to specify how it will be renamed.
Logs
:::::::::::::::::::::::::::::::::::::::::::
:: Openapi generator for dart ::
:::::::::::::::::::::::::::::::::::::::::::
[INFO] openapi_generator on lib/src/common/openapi_clients.dart:Running following command to generate openapi client - [ generate -o=../generated/my_service/ -i=lib/src/common/openapi_specs/my_service.json -g=dart --additional-properties=allowUnicodeIdentifiers=false,ensureUniqueParams=true,useEnumExtension=true,prependFormOrBodyParameters=false,pubName=openapi_my_service,legacyDiscriminatorBehavior=true,sortModelPropertiesByRequiredFlag=true,sortParamsByRequiredFlag=true,wrapper=none ]
[INFO] openapi_generator on lib/src/common/openapi_clients.dart:Openapi generator completed successfully.
[INFO] openapi_generator on lib/src/common/openapi_clients.dart:Installing dependencies with generated source. flutter pub get
[INFO] openapi_generator on lib/src/common/openapi_clients.dart:Install completed successfully.
[INFO] openapi_generator on lib/src/common/openapi_clients.dart:Skipping source gen because generator does not need it.
[INFO] openapi_generator on lib/src/common/openapi_clients.dart:
### Screenshots
_No response_
### Platform
macOS
### Library version
4.12.1
### Flutter version
3.13.4
### Flutter channel
stable
### Additional context
_No response_
Same bug with _id
and id