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

External Refs Resolution #48

Open
azriel46d opened this issue Nov 16, 2023 · 2 comments
Open

External Refs Resolution #48

azriel46d opened this issue Nov 16, 2023 · 2 comments

Comments

@azriel46d
Copy link

Hi, given that external refs are not supported, i've tested out a local setup in which the only change im doing is adjusting the loadUrl functionality such that it utilises json-refs library. for which all references are resolved.

Old Code

 private loadUrl(url: string): void {
      fetch(url)
          .then(resp => resp.json())
          .then(schema => this.setState({ result: { schema, currentUrl: url } }))
          .catch(e => this.setState({ result: { currentUrl: url, schema: { message: e.message }}}));
   }

New Code

 private loadUrl(url: string): void {
      jsonRefs.resolveRefsAt(url).then((result) => 
         this.setState({ result: { schema: result.resolved as JsonSchema, currentUrl: url } })
      ).catch(e => this.setState({ result: { currentUrl: url, schema: { message: e.message }}})); 
  }

would such a PR be accepted?
maybe utilising a toggle in the homepage wether refs should be resolved or not, would switch between the two ?

@robertmassaioli
Copy link
Collaborator

Hmm, the idea of this App, for performance reasons, was never to have to load external schemas once your schema was successfully downloaded: you either got everything or nothing.

Is it possible to bundle your external schema fully before providing it to this tool?

However, that said, can you paste a screenshot of what the error state looks like in the event that a sub-referenced schema fails to load?

@rbavery
Copy link

rbavery commented Jul 26, 2024

regs resolution would be very useful. most schemas in the Spatio Temporal Asset Catalog ecosystem use refs

this fails
https://raw.githubusercontent.com/crim-ca/mlm-extension/main/json-schema/schema.json

Screenshot 2024-07-26 at 12 33 22 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants