joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
http://www.jsonschema2pojo.org
Apache License 2.0
6.24k stars 1.66k forks source link

Please add support for allOf #1459

Closed KangoV closed 1 year ago

KangoV commented 1 year ago

I'm trying to use this tool to generate classes for the OASIS STIX 2.1 schema. This uses allOf everywhere in the schema definitions. Is this something that can be easily achieved?

eirnym commented 1 year ago

If it's possible to edit the schema before generation, putting extends along allOf (with almost the same contents) helped me to generate classes using this tool.

PS: I had another schema, not this one. In simple cases, it could be done using sed or similar filter

joelittlejohn commented 1 year ago

Hi Darren. This request has been raised a few times. Feel free to add a vote to #91.

I understand that many schemas use allOf/anyOf/oneOf, but these concepts are not easily translated to Java and make more sense in the context of validation rather than data binding.