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
  • #4087
Closed
Open
Issue created Oct 07, 2019 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[BUG][aspnetcore] Duplicated enum models

Created by: 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?

Assignee
Assign to
Time tracking