One field is not showing anymore in the deserialization of the json.
It happened because our code generator is transforming the OpenApi definition into this:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true)
Before it was working because it translated into:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true)
This code is generated from an openapi: 3.0.2 yml file with SpringCodegen.
Does anyone know if I can tell in the open api definition or in the maven openApi plugin to generate the code to use: JsonTypeInfo.As.PROPERTY?
We are using Java 11
Thank you very much
Regards.
In my local test It worked with JsonTypeInfo.As.PROPERTY and JsonTypeInfo.As.EXTERNAL_PROPERTY but the code is generated with JsonTypeInfo.As.EXISTING_PROPERTY which I cannot change in the generated clases.
As far as I can tell, it is not possible to configure openapi generator's
JsonTypeInfogeneration. These definitions are hard-coded in mustache templates in openapi generator codebase.To see how
JsonTypeInfoare generated, I would suggest the following:openapi-generator/modules/openapi-generator/src/main/resources/.typeInfoAnnotation.mustachetemplate .You may want to checkout other tags to find the version that generate the
JsonTypeInfoyou expect, if any.Note: I could not find any reference to
JsonTypeInfo.As.EXISTING_PROPERTYin openapi generator v3.0.2