jolou
3 years agoNew Member
How to make swagger-core see the Java Time types my service actually delivers?
Recent versions of Spring Boot are aware of the Java Time (jsr310) types by default.
My REST endpoints serialise them as nicely formatted strings, just the way I want it.
It just works, without any config or annotation.
But the openAPI-spec, generated via springdoc-openapi (which use swagger-core), does not. It has clearly used plain introspection, and produces multi-field schemas that do not match the values in the actual responses.
Is there any way to configure swagger-core to fix this, for example by instructing it to use jackson-datatype-jsr310?
I use:
- kotlin 1.6.10
- spring-boot-starter-parent 2.6.3
- springdoc-openapi-kotlin 1.6.6 (uses swagger-core 2.1.12)