Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL-encoded characters in $ref paths break schema resolution #1082

Open
1 of 4 tasks
adalinesimonian opened this issue Jan 15, 2025 · 0 comments
Open
1 of 4 tasks

URL-encoded characters in $ref paths break schema resolution #1082

adalinesimonian opened this issue Jan 15, 2025 · 0 comments

Comments

@adalinesimonian
Copy link

Describe the bug

Schemas with URL-encoded characters in $ref paths do not resolve. For example, a reference to something like "#/definitions/Interface<type>" fails to resolve if it is written as "#/definitions/Interface%3Ctype%3E".

Expected Behavior

The YAML language server should properly resolve URL-encoded $ref paths (e.g., #/definitions/Interface%3Ctype%3E) and provide IntelliSense, validation, and other features based on the referenced schema definition.

Current Behavior

When using a $ref path that includes URL-encoded characters, vscode-yaml does not recognize or resolve the schema definition, resulting in validation errors (e.g. $ref '/definitions/Interface%3Ctype%3E' in 'file:///.../schema.json' can not be resolved.).

Steps to Reproduce

  1. Create a file named example.schema.json containing the following schema:
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "myProperty": {
          "$ref": "#/definitions/Interface%3Ctype%3E"
        }
      },
      "definitions": {
        "Interface<type>": {
          "type": "object",
          "properties": {
            "foo": {
              "type": "string"
            }
          }
        }
      }
    }
  2. Create a file named example.yaml containing the following content:
    # yaml-language-server: $schema=example.schema.json
    
    myProperty:
      foo: bar
  3. Observe that the schema reference #/definitions/Interface%3Csomething%3E is not resolved, resulting in a validation error.

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant