question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Separate javaType into 'existingJavaType' and 'javaType'

See original GitHub issue

At 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:

  1. 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.
  2. 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:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tviegutcommented, Mar 13, 2018

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.

0reactions
joelittlejohncommented, May 6, 2019

@ajayboseac This change was introduced in 1.0.0-alpha3. Check the CHANGELOG.md (and the ‘Milestone’ field on this issue).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found