Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling additionalProperties generation with a global config option #376

Closed
jfarcand opened this issue Jun 16, 2015 · 3 comments
Closed
Milestone

Comments

@jfarcand
Copy link

Assume you work with an existing set of JSON files that you can't modify. If you be useful to be able to set

<additionalProperties>false</additionalProperties>

in pom.xml so the Java Object is generated without additionalProperties and without the needs to change the original JSON.

@joelittlejohn
Copy link
Owner

Thanks for raising this. It sounds like a really simple change, I don't see a problem with including this.

@joelittlejohn joelittlejohn changed the title [plugin] Allow disabling additionalProperties generation Allow disabling additionalProperties generation Jun 16, 2015
@jfarcand
Copy link
Author

@joelittlejohn That would make it super simple to automate something like

JSON Feeds => jsonschema2pojo => Java Object => Cassandra Mapper => Save to Cassandra

Right now the Datasax's Cassandra driver complains about

Exception in thread "main" java.lang.IllegalArgumentException: Cannot find matching getter and setter for field 'additionalProperties'
    at com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:230)
    at com.datastax.driver.mapping.AnnotationParser.convert(AnnotationParser.java:160)

Thanks for the fast answer!

@joelittlejohn
Copy link
Owner

Another benefit of doing this: at present if you use source type 'JSON' there's no way to indicate that you want to disable additional properties, so it's not possible to turn them off. With this change they could at least be turned off globally.

@joelittlejohn joelittlejohn added this to the 0.4.14 milestone Aug 3, 2015
@joelittlejohn joelittlejohn changed the title Allow disabling additionalProperties generation Allow disabling additionalProperties generation with a global config option Aug 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants