You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upgraded to openapi generator version 7.11. One of our issues was fixed
in this version but we got two new issues back for which I added
workarounds.. It looks like both are caused by the new support for
JSON-B polymorphism type annotations introduced by
OpenAPITools/openapi-generator#20164:
Solves PZ-5160
{{! Lifely/INFO temporary workaround for the issue where the OpenAPI Generator Gradle plugin }}
2
+
{{! incorrectly generates '@JsonbTransient' annotations for certain 'type' fields in polymorphic model classes }}
3
+
{{! which has the result that these fields are not serialized and deserialized leading to errors in the various APIs we use. }}
4
+
{{! For example in the generated BRP 'PersonenQuery.java' class the 'type' String field was given the '@JsonbTransient' annotation }}
5
+
{{! which breaks the ZAC BRP API integration because this is mandatory field in the BRP API. }}
6
+
{{! This was most likely introduced by: https://github.com/OpenAPITools/openapi-generator/pull/20164 }}
7
+
{{! It may also be that the BRP OpenAPI spec does not use the discriminator keyword correctly since these 'type' fields are simple strings. }}
8
+
{{!andnot polymorphic structures. Also see: https://apidog.com/blog/openapi-discriminator-guide/ }}
9
+
10
+
{{! This template is based on a copy of the Java Mustache model template of the main branch of https://github.com/OpenAPITools/openapi-generator }}
11
+
{{! This workaround can be removed once we have migrated to a version of the OpenAPI Generator Gradle plugin that has solved this issue. }}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{! Lifely/INFO temporary workaround for the issue where the OpenAPI Generator Gradle plugin }}
2
+
{{! generates '@JsonbTypeInfo(key = "type")' annotations in the generated model classes both for }}
3
+
{{! parent and child polymorphic classes resulting in errors such as: }}
4
+
{{!"Caused by: jakarta.json.bind.JsonbException: One polymorphic chain cannot have two conflicting property names. }}
5
+
{{! Polymorphic type defined on the type net.atos.client.bag.model.generated.Standplaats }}
6
+
{{! and net.atos.client.bag.model.generated.AdresseerbaarObject have conflicting property name"}}
7
+
{{! This was most likely introduced by: https://github.com/OpenAPITools/openapi-generator/pull/20164 }}
8
+
9
+
{{! This template is based on a copy of the Java Mustache model template of the main branch of https://github.com/OpenAPITools/openapi-generator }}
10
+
{{! This workaround can be removed once we have migrated to a version of the OpenAPI Generator Gradle plugin that has solved this issue. }}
11
+
12
+
{{#jackson}}
13
+
14
+
@JsonIgnoreProperties(
15
+
value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization
16
+
allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization
0 commit comments