APIDevTools / json-schema-ref-parser

Parse, Resolve, and Dereference JSON Schema $ref pointers in Node and browsers
https://apitools.dev/json-schema-ref-parser
MIT License
953 stars 227 forks source link

Can't resolve any reference to external schema #241

Closed ThomasKuhlmann closed 3 years ago

ThomasKuhlmann commented 3 years ago

Hi,

I am using https://github.com/bcherny/json-schema-to-typescript and keep running immediately into issues when trying to reference another JSON schema file.

Right now I created two simple test files:

project.json

{
  "$id": "project",
  "type": "object",
  "properties": {
    "priority": { "$ref": "priority" }
  }
}

priority.json

{
  "$id": "priority",
  "type": "string",
  "default": "priority string"
}

I pretty much immediately get this error: 'SyntaxError: Unable to resolve $ref pointer "/Users/thomaskuhlmann/Projects/kreelu/packages/backend/cloud/src/schemas/priority"

The path is correct, and there aren't any further details anywhere - any suggestions on how to troubleshoot this one?

Much obliged! Thomas

philsturgeon commented 3 years ago

This tool was not designed to resolve $id. The conversation is over here and it’s basically in need of a new tool which is not yet finished. #145