-
-
Notifications
You must be signed in to change notification settings - Fork 545
Description
Describe the bug
When using the annotation @apiresponse with a content and the a schema with 'oneOf', the schema of my response object contains an extra 'type: "string". Before 2.8.2 this was not the case.
Code:
@GetMapping("/test")
@ResponseStatus(HttpStatus.OK)
@operation(summary = "get", description = "Provides a response.")
@apiresponse(content = @content(mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @io.swagger.v3.oas.annotations.media.Schema(oneOf = {
Integer.class
})),
responseCode = "200")
public Object get() {
return 1;
}
Result:
"application/hal+json": {
"schema": {
"type": "string",
"oneOf": [
{
"type": "integer",
"format": "int32"
}
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/dkwakkel/springdoc-wrong-type
Run the application (spring boot).
Run curl --location --request GET 'http://localhost:8080/api-docs' --header 'Content-Type: application/json'
The issue did not occur before v2.8.2, and it is still present in v2.8.11.
Expected behavior
The type should not be there:
"application/hal+json": {
"schema": {
"oneOf": [
{
"type": "integer",
"format": "int32"
}