json-schema-ref-parser icon indicating copy to clipboard operation
json-schema-ref-parser copied to clipboard

[Feature reques] Support URN id references

Open mikaello opened this issue 3 years ago • 0 comments

It seems that JSON Schemas with references built with URN is not supported, e.g. these schemas:

When trying to dereference these, the following error messages are produced respectively:

{
  stack: 'ResolverError: Error opening file "urn:jsonschema/:org:phenopackets:api:model:ontology:OntologyClass" \n' +
    "ENOENT: no such file or directory, open 'urn:jsonschema/:org:phenopackets:api:model:ontology:OntologyClass'\n" +
    '    at ReadFileContext.callback (/home/mikaelol/projects/temp/json-parse/node_modules/@apidevtools/json-schema-ref-parser/lib/resolvers/file.js:52:20)\n' +
    '    at FSReqCallback.readFileAfterOpen [as oncomplete] (node:fs:314:13)',
  code: 'ERESOLVER',
  message: 'Error opening file "urn:jsonschema/:org:phenopackets:api:model:ontology:OntologyClass" \n' +
    "ENOENT: no such file or directory, open 'urn:jsonschema/:org:phenopackets:api:model:ontology:OntologyClass'",
  source: 'urn:jsonschema/:org:phenopackets:api:model:ontology:OntologyClass',
  path: null,
  toJSON: [Function: toJSON],
  ioErrorCode: 'ENOENT',
  name: 'ResolverError',
  footprint: 'null+urn:jsonschema/:org:phenopackets:api:model:ontology:OntologyClass+ERESOLVER+Error opening file "urn:jsonschema/:org:phenopackets:api:model:ontology:OntologyClass" \n' +
    "ENOENT: no such file or directory, open 'urn:jsonschema/:org:phenopackets:api:model:ontology:OntologyClass'",
  toString: [Function: toString]
}

and

{
  stack: 'ResolverError: Error opening file "urn:jsonschema/:iof:v3:Country" \n' +
    "ENOENT: no such file or directory, open 'urn:jsonschema/:iof:v3:Country'\n" +
    '    at ReadFileContext.callback (/home/mikaelol/projects/temp/json-parse/node_modules/@apidevtools/json-schema-ref-parser/lib/resolvers/file.js:52:20)\n' +
    '    at FSReqCallback.readFileAfterOpen [as oncomplete] (node:fs:314:13)',
  code: 'ERESOLVER',
  message: 'Error opening file "urn:jsonschema/:iof:v3:Country" \n' +
    "ENOENT: no such file or directory, open 'urn:jsonschema/:iof:v3:Country'",
  source: 'urn:jsonschema/:iof:v3:Country',
  path: null,
  toJSON: [Function: toJSON],
  ioErrorCode: 'ENOENT',
  name: 'ResolverError',
  footprint: 'null+urn:jsonschema/:iof:v3:Country+ERESOLVER+Error opening file "urn:jsonschema/:iof:v3:Country" \n' +
    "ENOENT: no such file or directory, open 'urn:jsonschema/:iof:v3:Country'",
  toString: [Function: toString]
}

mikaello avatar May 22 '22 10:05 mikaello