Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #14482
Closed
Open
Issue created Jan 18, 2023 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[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
  1. Run the generation
  2. 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 _.

Assignee
Assign to
Time tracking