Closed nsheff closed 10 months ago
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.
I'm following the instructions on resolving json refeferences using the new
referencing
package, and it works for validation. However, theresource.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?