OpenAPITools / OpenAPITools/openapi-generator
ignoreAnyOfInEnum flag is not working properly.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
3GPP R15 has defined a set of standards in the form of OpenAPI Yamls.
This yamls contains enum along with AnyOf.
Currently open api generator is not generating models correctly for ENUM along with AnyOF
RequestTrigger:
anyOf:
- type: string
enum:
- LOC_CH
- PRA_CH
- SERV_AREA_CH
- RFSP_CH
- ALLOWED_NSSAI_CH
- UE_AMBR_CH
I checked it on internet and found out two solution :
-
[https://github.com/OpenAPITools/openapi-generator/issues/798]
Where we can delete anyof and run the maven build again.
But we cannot change the YAML , as its of standard. -
[https://github.com/OpenAPITools/openapi-generator/issues/4491]
Here I see, Jason submitted some code where he added new configuration ignoreAnyOfInEnum ( and making its use in AbstractJavaCodeGen Class ) to ignore the AnyOf Tag.But This flag is also not working.
Seems reasons for that is , ignoreAnyOfInEnum config is not getting set in GeneratorSettings.java like other config properties we do.
Please help , stuck.
@wing328
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ignoreAnyOfInEnum from AbstractJavaCodeGen into GeneratorSettings.java, using the reported RequestTrigger OpenAPI YAML as the reproduction case. Check the Maven build and generated models to verify that enabling the flag changes enum-plus-anyOf handling without requiring edits to the standard YAML.
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