joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc

Home Page:http://www.jsonschema2pojo.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for oneOf in schema

Smit703 opened this issue · comments

commented

I have a very large schema, which has a lot of oneOfs and this library is unable to process the fields in schema containing oneOf .How can the support for oneOf be added to the java code using this library?

commented

Hi

How can the support for oneOf be added to the java code using this library?

At the moment neither oneOf, anyOf nor allOf are supported, there have been requests (#91, #392, #1193, ...) to get support for oneOf/anyOf/allOf, though it's not an easy thing to do given that there are lots of options how it might be implemented and pitfalls.
Theoretically it might be possible to add that functionality via customizations eg. custom rule factory & etc., however that depends on a lot of factors incl. but not limited to:

  • library used for JSON serialization/deserialization
  • the way one envisions implementation: smht. complex / polymorphism / naïve
  • how well things will play out with the rest of the features (if they're used) eg.: extends, $ref, primitive types, deserializationClassProperty, enum(s), ...
  • ...