-
-
Notifications
You must be signed in to change notification settings - Fork 562
Open
Description
Describe the bug
After updating from v2.8.13 to 2.8.14, the @Schema annotation appears to be ignored. Specifically, @Schema(description = "field", type = "integer", example = "22") is being displayed as:
"field": {
"type": "string",
"description": "field",
"example": "22"
}
where the previous version would show:
"field": {
"type": "integer",
"description": "field",
"example": "22"
}
To Reproduce
Steps to reproduce the behavior:
Set schema explicitly using @Schema annotation, check /v3/api-docs and see mismatch.
- What version of spring-boot you are using? 3.5.8
- What modules and versions of springdoc-openapi are you using?
org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.14 - What is the actual and the expected result using OpenAPI Description (yml or json)?
Actual:
"field": {
"type": "string",
"description": "field",
"example": "22"
}
Expected:
"field": {
"type": "integer",
"description": "field",
"example": "22"
}
- Provide with a sample code (HelloController) or Test that reproduces the problem
@RestController
public class HelloController {
@GetMapping("/hello")
public SampleResponse hello() {
SampleResponse res = new SampleResponse();
res.setField(true);
res.setCount(22);
res.setNote("ok");
return res;
}
public static class SampleResponse {
// Explicit override (expected: boolean), but in 2.8.14 becomes string in /v3/api-docs
@Schema(description = "field", type = "boolean", example = "true")
private Boolean field;
// Control case: explicit integer (expected integer)
@Schema(description = "count", type = "integer", example = "22")
private Integer count;
// Control case: inferred string (expected string)
private String note;
public Boolean getField() { return field; }
public void setField(Boolean field) { this.field = field; }
public Integer getCount() { return count; }
public void setCount(Integer count) { this.count = count; }
public String getNote() { return note; }
public void setNote(String note) { this.note = note; }
}
}
Expected behavior
Correctly set the type according to the explicit @Schema annotation
Metadata
Metadata
Assignees
Labels
No labels