OpenAPITools / OpenAPITools/openapi-generator

[JAVA] Add CodegenProperty.isEnumModel for Model of Enum

Open
#1,783 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

I found there has no property to identify a field is Model (isModel=true) and also Enum. For example:

public enum AccountType{
...
}
openapi-generator version

openapi-generator-cli-4.0.0-20181124.163833-43

OpenAPI declaration file content or url
    AccountType:
      type: string
      enum:
        - VIP
        - VVIP
Command line used for generation

NA

Steps to reproduce

1, run code generate
2, add {{isEnum}}, {{isModel}} in pojo.mustache to see the print

Related issues/PRs

NA

Suggest a fix/enhancement

NA

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 CodegenProperty and the Java pojo.mustache template, using the AccountType OpenAPI declaration as the reproduction case. Generate the Java model and verify that the template can distinguish a model that is also an enum through the new property.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.