jsonschema2pojo icon indicating copy to clipboard operation
jsonschema2pojo copied to clipboard

Support for oneOf in schema

Open Smit703 opened this issue 1 year ago • 2 comments

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?

Smit703 avatar Jun 19 '23 10:06 Smit703

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), ...
  • ...

unkish avatar Jun 30 '23 08:06 unkish