I query a GET and get a response JSON string but desalinization throws The field form_object_guid in the JSON string is not defined in the DigitalFormGetResponse properties, which means the field form_object_guid does not exist in the class DigitalFormGetResponse. The class DigitalFormGetResponse is automatically generated from maven artifact openapi-generator-maven-plugin version 6.6.0 without including jersey2 as library. After I added an annotation to the plugin <additionalModelTypeAnnotations>@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)</additionalModelTypeAnnotations>, the generated code showed the class DigitalFormGetResponse has IgnoreProperties annotation and I assume it will ignore unknown properties in retrieved JSON string.
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
public class DigitalFormGetResponse {
However, I got the exception from the auto-generated function:
My previous version used jersey2 in the plugin and worked fine to ignore unknown properties. However, I have to move jersey2 out of the plugin (because it does not support PATH requests for Java16+) and then this ignoring feature becomes an issue.
POM file
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.6.0</version>
<executions>
<execution>
<id>spring-boot-api</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/digitalformsords.yaml</inputSpec>
<generatorName>java</generatorName>
<configOptions>
<dateLibrary>joda</dateLibrary>
<validateSpec>false</validateSpec>
<useSpringBoot3>true</useSpringBoot3>
<useJakartaEe>true</useJakartaEe>
<additionalModelTypeAnnotations>@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)</additionalModelTypeAnnotations>
</configOptions>
<library>jersey2</library>
<apiPackage>${default-package}.api</apiPackage>
<modelPackage>${default-package}.api.model</modelPackage>
<invokerPackage>${default-package}.api.handler</invokerPackage>
<generateModelTests>false</generateModelTests>
<generateApiTests>false</generateApiTests>
</configuration>
</execution>
</executions>
</plugin>

I added maven-replacer-plugin to POM file to remove the invoking to validateJsonObject(jsonObj); so the exception will not happen. I do not think it is the best way but I have to keep the existing logic to not force a JSON validation.