Another question, this time regarding OpenAPI V3 a...
# http4k
r
Another question, this time regarding OpenAPI V3 and Swagger integration.
Whenever I use a DTO with a nullable property, even if the client and server are working perfectly fine, my Swagger docs fail to load entirely.
Copy code
Failed to load API definition.
Fetch error
Internal Server Error /api/openapi.json
I've tried Jackson at first, and now Kotlinx serialization to handle OpenAPI v3, but neither solved the issue. Note I Kotlinx serialization for the entire server/shared/client modules.
Copy code
val api = contract {
    renderer = OpenApi3(ApiInfo("Example", "1.0.0"), Jackson)
    descriptionPath = "/openapi.json"
    routes += exampleController.routes
}
Is there some way to deal with this?
m
Have you passed an example (that isnt null) for the nullable property? in the
receiving
d
This will probably be the problem. You cannot pass any null to the renderer, because it uses the JSON example in order to create the schema. 🙂
r
Thank you both for the advice! That fixed it.
🙌 1