-
Notifications
You must be signed in to change notification settings - Fork 373
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
Remove external ref resolving #1750
Comments
Additional requirements for a releaseAdapt migration guideAdd a small motivation why we performed this change, with a link to this issue. Website
|
PR #1762 removes |
Completed with #1829 |
Overview
Refs (i.e.
$ref
) are a core part of the JSON Schema specification. At the moment JSON Forms tackles it with different concepts.$ref
, JSON Forms manually resolves the$ref
But JSON Forms also supports ref-resolving via
json-schema-ref-parser
. As a concept it is implemented in@jsonforms/core
, however only theReact
renderers are actually using it.The implemented functionality is:
Dispatch
renderer checks whether there are any$refs
in its schema. This is checked via copied code fromjson-refs
which adds the dependenciesuri-js
anduuid
to@jsonforms-core
.json-schema-ref-parser
is tasked with resolving all of them. Thejson-schema-ref-parser
can be configured via options which allows configuring resolving even to external paths, e.g.https://whatever.com/example.json
. The resulting JSON Schema is then actually used.Problems
$refs
in the dispatch renderer is relatively slow.json-schema-ref-parser
is really slow, and especially so for circular JSON Schemas. Also it's run unconditionally in React, even when the integrated manually resolving would be enough.@jsonforms/core
although only one binding is actually using it.json-schema-ref-parser
are actually Node dependencies which can't be run in the Browser. Any application using JSON Forms therefore also needs to add polyfills to actually run it. Up until Webpack 4 this happened automatically. With Webpack 5 this was removed, leading to build errors when using JSON Forms. It doesn't make a good impression when using JSON Forms requires Node polyfills.Overall there is hardly any benefit to all of this. Yes, we allow resolving external refs, however as the actual resolving method has to be handed in anyway AND it is run unconditionally in most cases, the respective developer could just resolve them beforehand and then hand them in to JSON Forms. This is actually what we recommend for example for the Angular renderers and demonstrate in the Angular seed.
Downsides of removing ref resolving
Potential downsides when removing this without replacement:
json-schema-ref-parser
, i.e. handed in JSON Schemas were prepared in a way which allowed the manually resolving to actually work. This worry is mitigated a bit by the Angular renderers as they never used this resolving. Still the React renderers support more complicated schemas, e.g.oneOf
etc.Mitigation idea
To still allow external refs to be resolved in general, we could offer a resolving customization method. If the user hands in such a function, it will be called whenever something needs to be resolved. The user can then implement arbitrary behavior here, including resolving to external paths.
Tl;dr
The current external ref resolving approach using
json-schema-ref-parser
has too many downsides to keep it like it is in the current form. Removing it will break some users, but they should be mostly fine by resolving the schemas themselves before handing it to JSON Forms. We can offer a customization method which would allow for all previously supported use cases (and many more) but this requires work by the user.The text was updated successfully, but these errors were encountered: