Resolve refs with relative filepath

Hello,

We have a react webapp using JSON Forms which has two sections. Currently these exist as two separate pages/routes which the user can toggle between, with two schema files. Within these schemas we are already using $ref to refer to definitions within the same file, using json-refs to resolve.

We want to consolidate the pages and the associated JSON which is being edited, but keep separate schema files for ease of maintenance. Ideally using a master schema which references definitions in each of the two sub-schemas.

Any pointers on how we can resolve the remote references, using relative file paths?

Many thanks in advance.

Hello @paddy.hudson ,

just as already done for local $ref elements, your relative file references should also be resolved before handing the schema into json forms.

You could try with json-refs: In their README they use relative file refs in their circular dependency example.

If automatic resolvement doesn’t work you could also try:

  1. compile the master schema at build time by copying the definitions from your two base schemas. You could do this via a script in CI to avoid manual work and/or copy paste mistakes
  2. Manually compile the master schema at runtime by copying the definitions from the two sub schemata

Best regards,
Lucas