-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support comparison of Schemas generated by TapirSchemaToJsonSchema
#179
Support comparison of Schemas generated by TapirSchemaToJsonSchema
#179
Conversation
…SchemaToJsonSchema` `TapirSchemaToJsonSchema` generates JsonSchema specification `http://json-schema.org/draft/2020-12/schema#` and uses `#/$defs/` prefixes to locate reference to schemas stored in `Schema.$defs` field. This change adds support for both `#/$defs/` and `#/components/schemas/` and the choice is made by the user of `SchemaComparator` via the following helper methods * `SchemaResolver.components` * `SchemaResolver.defsSchemas` Closes softwaremill#172 and softwaremill#170
Bin compat is not required, exactly for this reason - it's a 0.x version. The mima check is currently informative, suggesting that we might want to bump the minor version |
Thanks for the patch and sorry for the delay in reviewing :) To simplify a bit, maybe we could simply have a predefined list of |
Yes, supporting both
when initializing a resolver from I can resolve references by both Is this a good direction? |
A few doubts from me:
|
For me, the main goal for this PR change is to support It is possible to completely decouple this project form decisions made in In the principles of KISS, I think supporting of just |
@seveneves yes supporting what we generate definitely makes sense :) What @ghik writes might be true in a wider perspective, but we've got to start somewhere. So maybe just change the default to check both resolvers by default for references, and we'll be good to go? |
@adamw I pushed a change and changed the description for the PR |
@seveneves Thanks! One last thing - maybe it would be possible to add a test case checking that indeed resolving |
Great, thanks! |
TapirSchemaToJsonSchema
generates JsonSchema specificationhttp://json-schema.org/draft/2020-12/schema#
and uses#/$defs/
prefixes to locate reference to schemas stored inSchema.$defs
field.This change adds support for both
#/$defs/
and#/components/schemas/
Two helper methods are provided that can be used to create
SchemaResolver
fromMap[String, Schema]
$defs
Closes #172 and #170
Test for
SchemaResolver.defsSchemas
relies onTapirSchemaToJsonSchema
from tapir project and I will provide a PR with specification there