Skip to content

Naming conflict between enum-constants and type names #1226

Open

Description

@BatmanAoD

This appears to be the same bug as #549, except it still occurs for me.

Here's an example schema, where Foo is generated as both a constant and a type:

openapi: 3.0.2
paths:
  "/name/as/enum":
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ContainsEnum"
  "/name/as/type/{foo}":
    post:
      parameters:
        - name: foo
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/Foo"
components:
  schemas:
    ContainsEnum:
      properties:
        object:
          enum:
            - foo
          type: string
    Foo:
      enum:
        - value
      type: string

I'm using oapi-codegen 1.14.0, as follows:

oapi-codegen -package <name> -generate types <schema>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions