[Bug]: @ArraysSchema applied on a stream property results in object type in OAS 3.1 (original) (raw)
@ArraysSchema applied on a stream property results in object type in OAS 3.1
Description of the problem/issue
We are using the springdoc with the swagger-core dependency. Once we switched from OpenApi 3.0 to 3.1 the Stream property of a POJO model is described as object instead of an array even if the @ArraySchema is applied to that property.
Affected Version
2.2.40
Earliest version the bug appears in (if known): we found it in 2.2.36.
Steps to Reproduce
Use this POJO model with a Stream property, while generating OAS 3.1:
@Getter @Setter public class ModelWithStream {
@ArraySchema(schema = @Schema(implementation = Greeting.class)) private Stream greetings; }
Expected Behavior
The OAS 3.1 should contain this definition in components.schemas. The greetings property should be generated as a type array.
"ModelWithStream": { "type": "object", "properties": { "greetings": { "type": "array", "items": { "$ref": "#/components/schemas/Greeting" } } } }
Actual Behavior
The greetings property is generated as a type object with the Stream.parallel property exposed in the schema.
"ModelWithStream": { "type": "object", "properties": { "greetings": { "type": "object", "items": { "$ref": "#/components/schemas/Greeting" }, "properties": { "parallel": { "type": "boolean" } } } } }
Logs / Stack Traces
N/A.
Additional Context
The expected model is generated when switching springdoc back to generate the OAS 3.0 version.
Checklist
- I have searched the existing issues and this is not a duplicate.
- I have provided sufficient information for maintainers to reproduce the issue.