openapi-generator
openapi-generator copied to clipboard
[BUG][Dart] --name-mappings is not applied to property names
Description
The Dart generator does not apply --name-mappings which are e.g. necessary to work around a field called _.
openapi-generator version
0e05cf26d94
OpenAPI declaration file content or url
openapi: '3.0.0'
info:
version: 1.0.0
title: test
paths:
/test:
get:
summary: sample
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
_:
type: string
Generation Details
java -jar /home/val/.m2/repository/org/openapitools/openapi-generator-cli/7.6.0-SNAPSHOT/openapi-generator-cli-7.6.0-SNAPSHOT.jar generate -i spec.yaml -o dart/ -g dart --name-mappings _=underscore
Steps to reproduce
generate, see this:
class TestGet200Response {
/// Returns a new [TestGet200Response] instance.
TestGet200Response({
this.,
});
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? ;
@override
bool operator ==(Object other) => identical(this, other) || other is TestGet200Response &&
other. == ;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
( == null ? 0 : !.hashCode);
// etc…
}
Related issues/PRs
#18662 for Erlang
Suggest a fix
…