OpenAPITools / OpenAPITools/openapi-generator

[BUG] [JAVA] OpenAPI Generator did not generate correct Enum in model if same enum reference with two different object

Open
#18,611 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Right now we are making use of https://jdegre.github.io/editor/?url=https://raw.githubusercontent.com/jdegre/5GC_APIs/Rel-17/TS29510_Nnrf_NFManagement.yaml spec which has below field

image

nfType field is of type NfTypeEnum which is defined inside SubscrCond class as enum with 6 values
private NfTypeEnum nfType;

but according to spec it should be of NFType type(which is also used for other fields in class) which has more 56 values.

openapi-generator version

5.4.0 (but did tried with latest version as well )

OpenAPI declaration file content or url

https://jdegre.github.io/editor/?url=https://raw.githubusercontent.com/jdegre/5GC_APIs/Rel-17/TS29510_Nnrf_NFManagement.yaml is the spec that we are making use in order to generate model

Generation Details

mvn clean install

Steps to reproduce

use https://jdegre.github.io/editor/?url=https://raw.githubusercontent.com/jdegre/5GC_APIs/Rel-17/TS29510_Nnrf_NFManagement.yaml spec and other reference file and generate model and look for SubscrCond which only have one variable

private NFTypeEnum nfType; //setter getter .

Ideally it should have two variable as per spec

private NFTypeEnum nfTypeEnum; //setter getter .
private NFType nfType; //setter getter .

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 linked TS29510_Nnrf_NFManagement.yaml specification and generate the SubscrCond model using the reported mvn clean install workflow. Compare the generated nfType field and enum values with the specification's NFType and NfTypeEnum definitions; done means the generated model represents both references correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.