https://kotlinlang.org logo
#http4k
Title
# http4k
a

Andrew O'Hara

05/14/2021, 5:36 PM
When I use http4k-contract to generate a spec, the path and query descriptions are serialized as
null
with both Argo and Jackson. The Swagger Editor seems to treat these as warnings, Swagger UI works fine, but the latest Redoc throws an exception that prevents the UI from loading. Is there any way to set a non-null description for these parameters? Or has anyone had a better experience with a different version of redoc?
r

Razvan

05/15/2021, 8:28 AM
We a using a custom configuration of Jackson for avoiding sending the null values
Copy code
renderer = OpenApi3(
                        ApiInfo("xxx API", "1.x", "desc"),
                        AppJackson,
                        apiRenderer = ApiRenderer.Auto(AppJackson, auto),
                    )
with:
Copy code
object AppJackson : ConfigurableJackson(
    KotlinModule()
        .asConfigurable()
        .withStandardMappings()
        .done()
        .deactivateDefaultTyping()
        .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
        .configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false)
        .configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true)
        .configure(DeserializationFeature.USE_BIG_INTEGER_FOR_INTS, true)
        .setSerializationInclusion(JsonInclude.Include.NON_NULL)
)
… as a workaround as I think ApiRenderer should not allow them as the OpenAPI specification does not
null
 is not supported as a type (see `nullable`for an alternative solution).
24 Views