'Springdoc openapi 3 @Schema example ignored
@Schema Example is ignored by springdoc Openapi on one class property, but working on other property in the same class. Added
@Schema(type = "integer", format = "int64", example = "1560868939063") private Instant date;
on a field of a Class.
Accessing the /v3/api-docs endpoint i can see that the example was completely ignored, it shows:
"MyClass":{"type":"object","properties":{"date":{"type":"integer","format":"int64"},...
EDIT: It seems that it is ignored because the type of the Field is of java.time.Instant, meaning the actual java class property type, not the "type" property in the @Schema. On a Field of type for example String, it works and shows the example.
using spring-boot 2.5:
api "org.springdoc:springdoc-openapi-ui:1.6.4"
api "org.springdoc:springdoc-openapi-data-rest:1.6.4"
api "org.springdoc:springdoc-openapi-security:1.6.4"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|