glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
12.51k stars 1.09k forks source link

Output nested Java classes to support single-file output #224

Open dvdsgl opened 7 years ago

dvdsgl commented 7 years ago

Our multi-file output support is janky. Perhaps we could simplify the Java case by nesting our types in an outer class?

schani commented 7 years ago

This works only where there is a single top-level class, unless we do a really ugly thing and add an outer class without functionality, just for nesting purposes.

What's the jankiness of the multi-file output, and why don't we fix that, instead of adding kludges?

dvdsgl commented 7 years ago

I agree about fixing the workflow, I just thought this could be an interesting shortcut for copy-pasting from the web to your IDE.

dvdsgl commented 7 years ago

I discovered that you can also import nested classes, so the 'really ugly' method isn't so ugly to consume.

schani commented 7 years ago

So maybe this should be an option that's on by default on the web?

schani commented 7 years ago

It's kinda nice that the outer class can then also hold the convenience methods, at least in the case of a single top-level.