OpenAPITools / OpenAPITools/openapi-generator
[BUG] Swagger parser has updated array schema for openapi 3.1.0
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
This issue is for tracking perspective since affect lot of places for different generators
When swagger-parser process schema for OpenAPI v3.0.0 it represents arrays via ArraySchema class. openapi-generator highly rely on this type to identify whether type is array or not - https://github.com/OpenAPITools/openapi-generator/blob/1b344597bf642108c95bf98ad8f9f44b7dd568e0/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java#L538
During investigation of this issue I've found that in openapi 3.1.0 arrays are represented as JsonSchema therefore generator don't determine type properly -
- https://github.com/swagger-api/swagger-parser/blob/c0c434bf1c0189e9a770e31c50d4bc19bcf2dd08/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java#L2635
- https://github.com/swagger-api/swagger-parser/blob/c0c434bf1c0189e9a770e31c50d4bc19bcf2dd08/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java#L3815
FYI @wing328 (2015/07) ❤️
@jimschubert (2016/05) ❤️
@cbornet (2016/05)
@jmini (2018/04) ❤️
@etherealjoy (2019/06)
@spacether (2020/05) ❤️
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 with ModelUtils.java around line 538, then inspect the OpenAPIDeserializer.java locations cited for OpenAPI 3.1 array handling. Compare how ArraySchema is recognized for OpenAPI 3.0 with how JsonSchema represents arrays in 3.1; done means the generator identifies these schemas as arrays across the affected generators.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100