OpenAPITools / OpenAPITools/openapi-generator
[BUG] openapi-generator problem with nested oneOf?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
The openapi-generator client generation crashes on the provided OpenAPI document, which passes validation both using openapi-generator validate and linting using speccy. It seems to be language independent (affects all languages I tried).
openapi-generator version
4.0.0-beta3
OpenAPI declaration file content or url
Gist of JSON here:
https://gist.github.com/einarwh/c8526951c3080ddca7b3b791066bb9e3
Command line used for generation
No fancy options, just:
openapi-generator generate -i openapi.json -g csharp
Steps to reproduce
Save gist as e.g. openapi.json and run:
openapi-generator validate -i openapi.json
to verify that the document is valid and then
openapi-generator generate -i openapi.json -g csharp
to get error message complaining about 'ResourceId' model.
Related issues/PRs
Looks very similar to this:
https://github.com/OpenAPITools/openapi-generator/issues/2610
Suggest a fix/enhancement
It seems that the problem is due to nested oneOf's.
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
Use the linked gist as openapi.json; first run validate, then run generate -g csharp and capture the ResourceId failure. Trace how the generator handles the nested oneOf models, and consider the issue complete when this valid document generates successfully without the reported crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100