refactor: add DiscriminatorUtils for handling discriminator properties in schemas#5250
refactor: add DiscriminatorUtils for handling discriminator properties in schemas#5250Mattias-Sehlstedt wants to merge 2 commits into
Conversation
704cbd7 to
08063c6
Compare
08063c6 to
864e5c0
Compare
|
Hi @Mattias-Sehlstedt! Thank you for working on improving the code in Swagger Core once again. One issue that I see with this refactor is that it is creating a new public API and it seems unintentional. The Please consider moving it in the |
4e57bf0 to
d2df2c2
Compare
|
I have moved it to the jackson package and made it package private. I have also added a private constructor to align it with the already existing "utils" class there ( The other common pattern is to utilize JavaDoc to explicitly state that the signature is volatile/subject to change/internal. But I could not find that the project has done that before so a bit odd to start with it now. |
Pull Request
Thank you for contributing to swagger-core!
Please fill out the following information to help us review your PR efficiently.
Description
Moves Discriminator resolving logic into a separate
Utilsclass.A commonly requested feature is to extend the discriminator introspection. There exists a PR for this, but I would find it easier to reason about any change if the logic was isolated from the larger monster that is
ModelResolver. This so thatModelResolveris not cluttered with more subdomain (managing discriminators) logic, and that theModelResolveris instead only responsible for exposing an area of these subdomains if there is a reason to provide a helpful extension point.I.e.,
Utilsprovide stateless logic for subdomains of handling specifications, and theModelResolvermainly combine these smaller parts into something larger.Type of Change
Checklist