mbknor / mbknor-jackson-jsonSchema

Generate JSON Schema with Polymorphism using Jackson annotations
MIT License
232 stars 75 forks source link

More Flexible subtype resolver #139

Open big-andy-coates opened 3 years ago

big-andy-coates commented 3 years ago

Fixes: #137

Alternative to: #138

Note: built on top of #138 - sorry, being a bit lazy.

Rather than providing a callback, just move the actual code for resolving subtypes into the resolver itself. Then users are free to implement what they like here.

Obviously, it's their responsibility that this aligns with what ever weird and wonderful serialisation logic they have.

I've tried to make the change backwards compatible. Though I'm no Scala expert.

I think the introduction of the SubTypeResolver trait matches up well with the fix in #135, i.e. its no longer classes, but types, that are being resolved.

Personally, I prefer this pattern to #138.

mbknor commented 3 years ago

Thanks. This looks interesting. I'm looking into it.. I'm a little bit concerned that this change will not be dropin-compatible with old code..

big-andy-coates commented 3 years ago

I think it should be, but haven't tried it. Definitely worth testing!

big-andy-coates commented 3 years ago

Updated dependencies would also help me, if you're able https://github.com/mbknor/mbknor-jackson-jsonSchema/pull/136

big-andy-coates commented 2 years ago

Thoughts on this change @mbknor. Feel free to close the PR is you're not going to merge / adopt...

big-andy-coates commented 2 years ago

Thoughts on this change @mbknor. Feel free to close the PR is you're not going to merge / adopt...