Skip to content

JSON Schema Relative Imports Broken #2097

Closed
@wmain

Description

monaco-editor version: >=0.19.0
Browser: Any
OS: Any
MRE Repository: https://github.com/wmain/monaco-bug

Version 0.19.0 introduces a change that breaks JSON schema's ability to utilize relative imports for $ref properties. This is an important use case for anyone who serves their client code from different environments/hosts. After some digging I believe I've traced the issue to vscode-uri, specifically in the migration/change referenced here, as defaulting to the file protocol will throw CORS errors.

Activity

aeschli

aeschli commented on Sep 14, 2020

@aeschli
Contributor

@wmain Can you share a small code sample that contains the schema similar to this: https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-configure-json-defaults ?

wmain

wmain commented on Sep 18, 2020

@wmain
Author

@aeschli I'm not sure I follow. The provided repository has a full code sample and schema in it.

added this to the September 2020 milestone on Sep 21, 2020
aeschli

aeschli commented on Sep 21, 2020

@aeschli
Contributor

Thanks, now I see.

I pushed a fix. This kind of worked by coincidence before. Now we properly resolve the relative ref to the URI of the schema. So in your example we will try to fetch http://myserver/relative.json as that the schema has URI http://myserver/foo-schema.json

wmain

wmain commented on Sep 22, 2020

@wmain
Author

Thanks for the fix!

modified the milestones: September 2020, vNext on Sep 22, 2020
locked and limited conversation to collaborators on Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    JSON Schema Relative Imports Broken · Issue #2097 · microsoft/monaco-editor