swagger-api / swagger-api/swagger-codegen

isEnum returns false when enum is referenced

Open
#7,763 7 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

When is defined enum as standalone type and is referenced from elsewhere, template var isEnum is set to false.

Swagger-codegen version
<dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-codegen-cli</artifactId>
            <version>2.3.1</version>
        </dependency>
Swagger declaration file content or url
definitions:
 UIDocumentsOverviewLock:
    type: object
    properties:
      action:
        $ref: '#/definitions/InvalidateDocsAction'
 InvalidateDocsAction:
    type: string
    enum:
      - FINAL
      - INDIVIDUALIZED
      - FC_NOT_INDIVIDUALIZED
      - FC_AND_INDIVIDUALIZED
Command line used for generation
Steps to reproduce

in mustasche template is isEnum false on property 'action' and should be true because InvalidateDocsAction is defined as enum.

Related issues/PRs
Suggest a fix/enhancement

Checking the referenced class type

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Swagger definition and reproduce generation for the Mustache template, focusing on the referenced property action and its isEnum value. Inspect how the referenced class type is represented during template processing; done means isEnum is true for action because InvalidateDocsAction is defined as an enum.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.