The OAS 3.1 is missing information from the @ArraysSchema.arraySchema
Description of the problem/issue
We are using the springdoc with the swagger-core dependency. Once we switched from the OpenApi 3.0 to 3.1 some @Schema information defined in the @ArraySchema.arraySchema do not generate into the OpenApi JSON spec. So far, we've found that following properties are not generated:
- readOnly
- accessMode
- examples
There might be more of them.
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 collection property, while generating OAS 3.1:
@Getter
@Setter
public final class MyModel {
@ArraySchema(
arraySchema = @Schema(
deprecated = true,
accessMode = AccessMode.READ_ONLY,
description = "collection description",
examples = "John"),
schema = @Schema(
description = "item description",
examples = "Jason"))
private List<String> names;
}
Expected Behavior
The OAS 3.1 should contain this definition:
"org.example.MyModel": {
"type": "object",
"properties": {
"names": {
"type": "array",
"description": "collection description",
"deprecated" : true,
"readOnly" : true,
"examples" : [
"John"
],
"items": {
"type": "string",
"description": "item description",
"examples": [
"Jason"
]
}
}
}
}
Actual Behavior
Some fields from the arraySchema are missing in the generated model.
See that description attribute is present, while deprecated, examples and readOnly
are missing.
"org.example.MyModel": {
"type": "object",
"properties": {
"names": {
"type": "array",
"description": "collection description",
"items": {
"type": "string",
"description": "item description",
"examples": [
"Jason"
]
}
}
}
}
Logs / Stack Traces
N/A.
Additional Context
Switching springdoc back to version 3.0, and replacing examples with example in the POJO, the missing fields are present in the generated model.
Checklist
The OAS 3.1 is missing information from the @ArraysSchema.arraySchema
Description of the problem/issue
We are using the springdoc with the swagger-core dependency. Once we switched from the OpenApi 3.0 to 3.1 some @Schema information defined in the @ArraySchema.arraySchema do not generate into the OpenApi JSON spec. So far, we've found that following properties are not generated:
There might be more of them.
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 collection property, while generating OAS 3.1:
Expected Behavior
The OAS 3.1 should contain this definition:
Actual Behavior
Some fields from the
arraySchemaare missing in the generated model.See that
descriptionattribute is present, whiledeprecated,examplesandreadOnlyare missing.
Logs / Stack Traces
N/A.
Additional Context
Switching springdoc back to version 3.0, and replacing
exampleswithexamplein the POJO, the missing fields are present in the generated model.Checklist