Skip to content

fix(yaml): preserve absolute URIs in schema resolution - #131

Open
junyu33 wants to merge 1 commit into
volarjs:masterfrom
junyu33:fix/yaml-absolute-schema-uris
Open

junyu33 wants to merge 1 commit into
volarjs:masterfrom
junyu33:fix/yaml-absolute-schema-uris

Conversation

@junyu33

@junyu33 junyu33 commented Oct 26, 2026

Copy link
Copy Markdown

Problem

The default YAML workspace resolver treats absolute schema URIs as relative paths and passes them to Utils.resolvePath().

When combining multiple schemas, this can turn a valid URI such as file:///c:/schemas/frontmatter.json into:

schemaservice://combinedschema/file%3A/c%3A/schemas/frontmatter.json

The resulting URI cannot be loaded, producing an “Unable to load schema … No content” diagnostic.

This was reproduced in the Slidev VS Code extension on Windows.

Fix

Return references with an explicit URI scheme unchanged. Relative references continue through the existing resolution logic, including embedded-document handling.

Tests

Add 19 regression cases covering:

  • Absolute file, HTTP(S), and custom-scheme URIs.
  • Relative paths, parent paths, spaces, and embedded documents.
  • Successful validation with combined schemas.
  • Retained diagnostics for invalid values and missing schemas.

Verified locally on Windows:

  • pnpm test — all 20 tests pass.
  • pnpm run build
  • pnpm run lint
  • Formatting checks for the changed files.

Avoid resolving absolute schema URIs against synthetic combined-schema bases, which produces unreadable schemaservice URLs.

Add regression tests for absolute URIs, relative and embedded paths, combined schemas, and retained validation diagnostics.
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

Successfully merging this pull request may close these issues.

1 participant