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

fix: request the schema id URL instead of the current page url

Open mmcorrelo opened this issue 5 years ago • 2 comments

When the schema id is defined with an URL should use that hostname to request the references, instead of using the current page URL

EXAMPLE:

{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$id": "https://resourse.example.com/schemas/resources/main.json#",
	"title": "This is my main schema",
	"description": "This is my main schema description.",
        "type": "object",
	"properties": {
	  "$ref": "/schemas/resources/version1.0.1.json#"
	}
  }

Currently, if the dereference work is being done locally at http://localhost:3000 the deref request will be done with URL http://localhost:3000/schemas/resources/version.1.0.1.json instead of https://resourse.example.com/schemas/resources/version1.0.1.json

This is related to this issue

mmcorrelo avatar Dec 04 '20 00:12 mmcorrelo

@Relequestual hey could I bother you for a quick check here? The issue is outlined in #199 and we want to make sure the case is even valid before merging this.

philsturgeon avatar Feb 12 '21 13:02 philsturgeon

@mmcorrelo hey, sorry for being quiet on this, but it's come up a few times in conversations and I'd like to progress with it. Can you take the time to write some tests so we can see the change in behavior?

philsturgeon avatar Jun 11 '21 13:06 philsturgeon