Skip to content
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

Getting schema contents after refs are resolved #1188

Closed
nsheff opened this issue Nov 3, 2023 · 1 comment
Closed

Getting schema contents after refs are resolved #1188

nsheff opened this issue Nov 3, 2023 · 1 comment
Labels
Invalid Not a bug, PEBKAC, or an unsupported setup

Comments

@nsheff
Copy link

nsheff commented Nov 3, 2023

I'm following the instructions on resolving json refeferences using the new referencing package, and it works for validation. However, the resource.contents continues to provide the schema in its original form (without refs resolved). For some use cases (apart from validation), I would like to be able to get the fully-resolved schema, including with resolved $refs that point to $defs -- but I can't figure out how to do this. The resolved schema clearly exists somewhere for the final validation to work -- would it be possible to make this somehow accessible so that said resolved schema could be used for other purposes as well?

@Julian
Copy link
Member

Julian commented Nov 3, 2023

This is actually in general impossible (in general being when you take into account $dynamicRef and not just $ref). It's also discouraged by the JSON Schema team!

In general the main reasons to do this are indeed for non-validation, and generally for tooling which has poor support for $ref itself (thankfully this library now not being one of those).

The recommended solution (by the JSON Schema team) to do what generally is needed for said tooling -- namely to reduce the amount of fancy ref resolution needed such that it's "easier" and self contained -- is the official bundling process. An issue to track adding a bundler to referencing is here.

@Julian Julian closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
@Julian Julian added the Invalid Not a bug, PEBKAC, or an unsupported setup label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid Not a bug, PEBKAC, or an unsupported setup
Projects
None yet
Development

No branches or pull requests

2 participants