swagger-api / swagger-api/swagger-core
Wrong schema generation of `Object[]` for OpenAPI 3.1
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
Schema generation for object array is broken in OpenAPI 3.1.
Create a class with an object array field and resolve the schema for it:
private Object[] objectArray;
Set a breakpoint here and inspect the schema before and after. After the call items of the ArraySchema has no more information (e.g. type = object).
The serialized schema looks like this:
"objectArray": {
"type": "array",
"items": {
}
}
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 in modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java at the linked line, then reproduce schema resolution with a class containing an Object[] field. Inspect the ArraySchema before and after the call and compare the serialized OpenAPI 3.1 output. Done means the items schema retains its object information instead of serializing as an empty object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100