Separate javaType into 'existingJavaType' and 'javaType'
See original GitHub issueAt present javaType
has two jobs, it can be used to reference an existing classpath type and also to give a newly generated type a fixed fully-qualified name. This was a bad design, for instance:
- All ‘existing’ referenced classes need to be present on the classpath to avoid getting a new class generated, even though in fact there is no need to require them at generation time.
- Sources are not regenerated if previous class files are not cleaned from the project, because it’s assumed that these types are ‘existing’ classes that are being used and should not be generated.
We should split these features, so that the schema author needs to be explicit.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
JSON schema using javaType from a separate module in the ...
I want the jsonschema2pojo to generate a class that use the type Name, however I get a separate class generated called Name with...
Read more >jsonschema2pojo
jsonschema2pojo supports an extension property 'javaType' that applies to schemas and allows you to specify a fully qualified name for your generated Java...
Read more >upgrade jsonschema2pojo from 0.4.23 to 1.0.0 for jdk11 ...
Anywhere you are referring to an existing Java type, e.g. BigDecimal, Instant, etc you now need to use existingJavaType instead of javaType. In...
Read more >CHANGELOG.md - joelittlejohn/jsonschema2pojo
Add 'javaOptional' extension rule to allow individual fields to use Java Optional on getter ... **Separate javaType into 'existingJavaType' and 'javaType' ...
Read more >https://raw.githubusercontent.com/joelittlejohn/js...
... enum + javaType (without package name) generates enum in default package as a class, ... **Separate javaType into 'existingJavaType' and 'javaType' ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
First off, great plugin. If this particular item has not been implemented yet, might it be possible to name it “existingJavaType”?
We use UML modeling toolsets that aid in auto-generating API JSON specifications which in turn we then leverage jsonSchema2Pojo durings builds. We’ve experienced with other jsonSchema2Pojo extensions that deviate a bit from the “norm” that the extension can be improperly named to what seems intuitive which doesn’t get picked up in our build process.
One example is the existing feature for “extendsJavaClass” extension that the plugin supports. It never fails that periodically it will get declared as “extendsJavaType” (which does seem to make logical sense as an extension of “javaType”) but the resulting POJOs don’t pick it up and it takes another cycle to fix. Maybe a wish here…but if the plugin supported both “extendsJavaClass” for backwards compatibility as well as “extendsJavaType” perhaps it would eliminate this for anyone who’s perhaps has also encountered it.
In any event, just throwing out thoughts from day-to-day experience.
@ajayboseac This change was introduced in 1.0.0-alpha3. Check the CHANGELOG.md (and the ‘Milestone’ field on this issue).