Skip to content

[BUG][dart-dio]: EnumClass conflict when using 'name' in a enum component #20910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 of 6 tasks
epou opened this issue Mar 17, 2025 · 0 comments · May be fixed by #20911
Open
4 of 6 tasks

[BUG][dart-dio]: EnumClass conflict when using 'name' in a enum component #20910

epou opened this issue Mar 17, 2025 · 0 comments · May be fixed by #20911

Comments

@epou
Copy link
Contributor

epou commented Mar 17, 2025

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

We encountered a conflict in a class where a static member and an instance member are defined with the same name ('name'). Dart does not allow a class to define a static member 'name' and have an instance member 'EnumClass.name' with the same name.

Class 'OrderBy' can't define static member 'name' and have instance member 'EnumClass.name' with the same name.
Try renaming the member to a name that doesn't conflict.dart(conflicting_static_and_instance)
openapi-generator version

v7.12.0

OpenAPI declaration file content or url
---
openapi: 3.0.3
info:
  title: Test
  version: 1.0.0-SNAPSHOT
paths:
  /test:
    get:
      parameters:
        - name: order_by
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/OrderBy'
      responses:
        "200":
          description: OK
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                name:
                  type: string
              required:
                - username
                - name
      responses:
        "200":
          description: OK
        "400":
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'

components:
  schemas:
    OrderBy:
      type: string
      enum:
        - name
        - username
    ValidationErrorResponse:
      type: object
      properties:
        attr:
          enum:
          - name
          - username
          type: string
          description: The attribute that caused the validation error
Generation Details

docker run --rm -v ./test_code:/local openapitools/openapi-generator-cli:v7.12.0 generate -i ${OPENAPI_YML} -g dart-dio -o /local/

Steps to reproduce
Related issues/PRs
Suggest a fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant