Trying to generate POJOs from JSON examples (not schemas) using the following maven configuration:
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.4.5</version>
<configuration>
<sourceDirectory>src/main/resources/json</sourceDirectory>
<outputDirectory>${project.build.sourceDirectory}</outputDirectory>
<targetPackage>com.test.applications.service.model</targetPackage>
<sourceType>JSON</sourceType>
<generateBuilders>true</generateBuilders>
<includeHashcodeAndEquals>false</includeHashcodeAndEquals>
<annotationStyle>NONE</annotationStyle>
</configuration>
this generates POJOs as expected without any annotations but still generates the addtionalProperties:
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
I know disabling this is possible through schema declaration through "additionalProperties": false
but in my case I generate from json examples.
I tried to use a custom Annotator that will override the AbstractAnnotator and run it through maven:
public class CustomNoopAnnotator extends AbstractAnnotator{
@Override
public boolean isAdditionalPropertiesSupported() {
return false;
}
}
and additional config in maven:
<customAnnotator>com.test.application.generator.CustomNoopAnnotator</customAnnotator>
this class is another module and the module I am trying to generate POJOs from has a dependency to this module.
I get java.lang.ClassNotFound exception with this setup.
I'd appreciate any feedback as to how to disable additionalProperties HashMap from being generated using JSON source type.
Trying to generate POJOs from JSON examples (not schemas) using the following maven configuration:
this generates POJOs as expected without any annotations but still generates the addtionalProperties:
I know disabling this is possible through schema declaration through
"additionalProperties": falsebut in my case I generate from json examples.
I tried to use a custom Annotator that will override the AbstractAnnotator and run it through maven:
and additional config in maven:
this class is another module and the module I am trying to generate POJOs from has a dependency to this module.
I get java.lang.ClassNotFound exception with this setup.
I'd appreciate any feedback as to how to disable additionalProperties HashMap from being generated using JSON source type.