Skip to content

External Refs Resolution #48

@azriel46d

Description

@azriel46d

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions