Skip to content

[BUG][aspnetcore] Duplicated enum models #4087

Open

Description

@yilinjuang

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

The issue was fixed in #3622 based on isModel attribute. If the enum has isModel set to true, then the enum isn't generated in objects it's referenced. However, looks like how isModel is set was changed in #3855 . Now enums no longer have isModel set.

openapi-generator version

4.2.0 master

OpenAPI declaration file content or url
openapi: 3.0.2
info:
  title: Test
  version: 0.1.0
servers:
  - url: http://localhost
paths:
  /:
    post:
      operationId: test
      responses:
        200:
          description: test
components:
  schemas:
    TestObject:
      type: object
      properties:
        enumInObject:
          $ref: "#/components/schemas/TestEnum"
    TestEnum:
      type: string
      enum:
        - value1
        - value2
Command line used for generation

openapi-generator generate -g aspnetcore

Steps to reproduce
  1. generate
  2. TestEnum is generated both in TestEnum.cs and TestObject.cs
Related issues/PRs

#3622, #3855

Suggest a fix

Is there any other way to tell if an enum is referenced or inlined?

Activity

  1. auto-labeler commented on Oct 7, 2019

    @auto-labeler

    👍 Thanks for opening this issue!
    🏷 I have applied any labels matching special text in your issue.

    The team will review the labels and make any necessary changes.

  2. wing328 commented on Oct 31, 2019

    @wing328
    Member

    @jimschubert can you please take a look when you've time? looks like a regression introduced by #3855

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions