[BUG] [dart-dio] _id is generated as id
Created by: flodaniel
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating a model a property _id
is transformed and becomes id
in the resulting dart class. In the provided example this breaks the class as it already has another id
property.
I tested this on latest master with this command (hosting the yml on a public gist):
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
-i https://gist.githubusercontent.com/flodaniel/65ffdf1e803773606dc42dccd58ba021/raw/7ce9e4e7721e1df9bb28c7d2de94581351f387ad/gistfile1.txt -g dart-dio -o /local/out/bad_id_generation
openapi-generator version
openapi-generator-cli 6.2.1 commit : b0ce532b built : 2022-11-01T09:40:00Z source : https://github.com/openapitools/openapi-generator docs : https://openapi-generator.tech/
OpenAPI declaration file content or url
https://gist.github.com/flodaniel/65ffdf1e803773606dc42dccd58ba021
openapi: 3.0.0
info:
title: Bad _id generation
version: 0.0.1
paths: {}
tags: []
servers: []
components:
schemas:
ConflictingIdProperty:
type: object
properties:
id:
type: string
_id:
type: string
Generation Details
openapi-generator generate -i ./bad_id_generation.yml -g dart-dio -o ./bad_id_generation
Steps to reproduce
- Run the generation
- review the resulting
conflicting_id_property.dart
file with the conflicting id properties.
Related issues/PRs
Suggest a fix
The issue is probably within class.mustache (https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache). baseName
is correct but name
is missing the _
.