-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
additionalProperties java.util.Map is not generated by default when embedding this library and extending DefaultGenerationConfig #398
Comments
you need to explicitly enable this feature: RuleFactory ruleFactory = new RuleFactory();
ruleFactory.setGenerationConfig(new DefaultGenerationConfig(){
@Override
public boolean isIncludeAdditionalProperties(){
return true;
}
});
SchemaMapper schemaMapper = new SchemaMapper(ruleFactory, new SchemaGenerator()); by default this is disabled |
You need to remove additionalproperties from your json schema and by default it will include this in your generated class. |
@brentryan I have tried removing "additionalProperties" from json but it was not working.... |
does your plugin configuration look like this? What version are you using?
|
@shivamsharma You don't mention how you're using jsonschema2pojo, either via Maven, Ant, Gradle or embedded in your project. I'm going to assume though that you're using this embedded in your project (using the API directly) because I've just noticed the following bug: jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/DefaultGenerationConfig.java Line 230 in 9202d97
This should be returning |
I tried using both by maven & embedding code. Yeah I am using the code suggested by @santhosh-tekuri. Hope you will fix the bug as soon as possible. |
Json file is :
the code generated is :
But expected is :
as per documentation https://github.com/joelittlejohn/jsonschema2pojo/wiki/Reference#additionalproperties
The text was updated successfully, but these errors were encountered: