-
-
Notifications
You must be signed in to change notification settings - Fork 545
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
When defining content
in the @apiresponse the default schema is no longer defined in the OpenApi spec.
If we annotate our endpoint using the following:
@ApiResponse(responseCode = "200", description = "OK")
Map<Class1, Map<Class2, Set<String>>> get();
We have the following schema being generated:
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"uniqueItems": true,
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
However, we automatically lose this valuable information when defining content
(even if we use useReturnTypeSchema
).
For example, for the following code:
@ApiResponse(
useReturnTypeSchema = true,
responseCode = "200",
description = "OK",
content = {
@Content(
mediaType = "*/*",
examples =
@ExampleObject(
name = "success",
value ="..."))
}
)
Map<Class1, Map<Class2, Set<String>>> get();
We get the following:
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"examples": {
"success": {
"description": "success",
"value": "..."
}
}
}
}
}
}
This hinders the process of generating concise and enriched documentation. Besides, I could not find in the documentation any reference saying that if content is defined the default schema is not used. This is particularly relevant as it is not possible to achieve this schema description using annotations in the code.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request