Skip to content

Update dsc version to 3.4-preview.1 and jsonschema crate to 0.49.1 - #1651

Open
SteveL-MSFT wants to merge 7 commits into
mainfrom
stevel-msft-version-bump-jsonschema-update
Open

Update dsc version to 3.4-preview.1 and jsonschema crate to 0.49.1#1651
SteveL-MSFT wants to merge 7 commits into
mainfrom
stevel-msft-version-bump-jsonschema-update

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

Motivation

Bump the dsc executable version to 3.4-preview.1 and update the jsonschema crate from 0.38 to 0.49.1 to stay current with upstream improvements in JSON Schema validation performance and correctness.

Approach

The jsonschema 0.49.1 release includes several breaking API changes that required migrating all custom keyword implementations in dsc-lib-jsonschema:

  • Keyword trait is now generic: Keyword<'i> with updated validate() and is_valid() signatures (no more LazyLocation parameter).
  • ValidationError::custom() simplified from 4 arguments to 1 (just the error message). Path context is now applied automatically by the framework.
  • with_resource() removed from ValidationOptions. Replaced with a static VSCODE_DIALECT_REGISTRY using referencing::Registry and with_registry(), which pre-registers all VS Code keyword schemas, vocabulary, and dialect resources at program startup.
  • Resource type moved from jsonschema to the referencing crate.

All 14 VS Code keyword implementations were updated to conform to the new API.

Test changes

Factory-time validation errors no longer carry instance_path (empty for compilation-time errors). Tests updated to assert on schema_path() instead, which correctly reflects where in the schema the error occurred. All 2,551 tests pass (361 in dsc-lib-jsonschema, 2,190 in dsc-lib).

- Bump dsc crate version from 3.3.0-rc.1 to 3.4.0-preview.1
- Update jsonschema dependency from 0.38 to 0.49.1
- Add referencing 0.49.1 as workspace dependency
- Migrate to new Keyword<'i> trait API (generic lifetime parameter)
- Replace ValidationError::custom() 4-arg calls with single message arg
- Replace with_resource() calls with static VSCODE_DIALECT_REGISTRY
  using referencing::Registry and with_registry()
- Update VSCodeValidationOptionsExtensions trait to use lifetime parameter
- Update tests to use schema_path() instead of instance_path() for
  factory-time validation errors (behavioral change in new API)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 19:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request bumps the dsc crate version to 3.4.0-preview.1 and upgrades the workspace jsonschema dependency to 0.49.1, migrating dsc-lib-jsonschema’s VS Code dialect/vocabulary/keyword integration to the new jsonschema + referencing APIs (notably Keyword<'i> and ValidationOptions::with_registry()).

Changes:

  • Updated VS Code custom keyword implementations to the new jsonschema 0.49 Keyword<'i> trait signatures and error-construction APIs.
  • Replaced per-keyword resource registration with a lazily initialized referencing::Registry (VSCODE_DIALECT_REGISTRY) and wired it into ValidationOptions extensions via with_registry().
  • Adjusted tests to assert on schema_path() instead of instance_path() for compilation-time errors; updated Cargo manifests/lockfile for the dependency bump.

Reviewed changes

Copilot reviewed 39 out of 40 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/dsc-lib-jsonschema/src/vscode/vocabulary.rs Switches Resource to referencing and adds a default schema resource helper for the VS Code vocabulary.
lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs Introduces VSCODE_DIALECT_REGISTRY and updates ValidationOptions extension methods to use with_registry().
lib/dsc-lib-jsonschema/src/vscode/mod.rs Re-exports VSCODE_DIALECT_REGISTRY alongside the validation-options extensions.
lib/dsc-lib-jsonschema/src/vscode/keywords/vscode_keyword.rs Updates keyword registration to the new ValidationOptions<'i> API (factory registration only).
lib/dsc-lib-jsonschema/src/vscode/keywords/vscode_keyword_definition.rs Updates keyword-definition trait bounds and factory return types for the new generic Keyword<'i> API.
lib/dsc-lib-jsonschema/src/vscode/keywords/suggest_sort_text.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/pattern_error_message.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/mod.rs Updates Resource import to referencing::Resource for keyword schema resource helpers.
lib/dsc-lib-jsonschema/src/vscode/keywords/markdown_enum_descriptions.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/markdown_description.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/error_message.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/enum_sort_texts.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/enum_details.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/enum_descriptions.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/do_not_suggest.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/deprecation_message.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/default_snippets.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/completion_detail.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/allow_trailing_commas.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/keywords/allow_comments.rs Migrates keyword factory + Keyword<'i> implementation to the new API; updates error construction.
lib/dsc-lib-jsonschema/src/vscode/dialect.rs Switches Resource to referencing and adds a default schema resource helper for the VS Code dialect meta-schema.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/suggest_sort_text.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/pattern_error_message.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/mod.rs Updates example docs to schema_path() assertions.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/markdown_enum_descriptions.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/markdown_description.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/error_message.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/enum_sort_texts.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/enum_details.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/enum_descriptions.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/do_not_suggest.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/deprecation_message.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/default_snippets.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/completion_detail.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/allow_trailing_commas.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/src/tests/vscode/keywords/allow_comments.rs Updates assertions to schema_path() for new error path behavior.
lib/dsc-lib-jsonschema/Cargo.toml Adds a workspace dependency on referencing for the new resource/registry APIs.
dsc/Cargo.toml Bumps dsc crate version to 3.4.0-preview.1.
Cargo.toml Updates jsonschema workspace dependency to 0.49.1 and adds referencing = 0.49.1.
Cargo.lock Locks updated dependency graph for jsonschema 0.49.1 + new transitive crates.
Comments suppressed due to low confidence (4)

lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:238

  • with_vscode_completion_keywords() calls with_registry() and then calls with_vscode_keyword(), which adds the same registry again. Dropping the redundant with_registry() here avoids an unnecessary builder step.
    lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:248
  • with_vscode_documentation_keywords() calls with_registry() and then calls with_vscode_keyword(), which adds the same registry again. Dropping the redundant with_registry() here avoids an unnecessary builder step.
    lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:256
  • with_vscode_error_keywords() calls with_registry() and then calls with_vscode_keyword(), which adds the same registry again. Dropping the redundant with_registry() here avoids an unnecessary builder step.
    lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:262
  • with_vscode_parsing_keywords() calls with_registry() and then calls with_vscode_keyword(), which adds the same registry again. Dropping the redundant with_registry() here avoids an unnecessary builder step.

Comment thread lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs
Comment thread lib/dsc-lib-jsonschema/src/vscode/keywords/vscode_keyword.rs Outdated
- Elide unnecessary lifetime in VSCodeKeyword::register() to satisfy
  clippy::elidable_lifetime_names (pedantic lint)
- Remove redundant with_registry() calls in multi-keyword extension
  methods since with_vscode_keyword() already registers the registry
- Update register() docs to clarify it only registers the keyword
  factory, not schema resources, and point callers to the extension
  trait and VSCODE_DIALECT_REGISTRY for full resource registration

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 19:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 40 changed files in this pull request and generated 2 comments.

Comment thread lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs
Comment thread lib/dsc-lib-jsonschema/src/vscode/keywords/vscode_keyword.rs
- Use explicit lifetime on register() for public API clarity, with
  clippy allow attribute for elidable_lifetime_names
- Delegate with_vscode_dialect() to with_vscode_vocabulary() instead
  of with_vscode_keywords() to match the semantic intent chain

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 19:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 40 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:264

  • with_vscode_vocabulary() and with_vscode_dialect() are now functionally identical (both just call with_vscode_keywords() via the same registry). Because VSCODE_DIALECT_REGISTRY also registers VSCodeDialect::SCHEMA_ID, calling with_vscode_vocabulary() will implicitly make the dialect meta-schema resolvable too, which is a behavioral change from the previous API where dialect registration required with_vscode_dialect(). Consider splitting the registries (e.g., vocabulary-only vs dialect-including) or otherwise restoring a meaningful distinction so callers can opt into the dialect meta-schema explicitly.

Comment thread lib/dsc-lib-jsonschema/src/vscode/vocabulary.rs
Comment thread lib/dsc-lib-jsonschema/src/vscode/dialect.rs
@github-actions

Copy link
Copy Markdown

😐 Code Coverage Report

Changed Code Coverage

76% (70%+ coverage)

Metric Value
Changed lines analyzed 113
Lines covered by tests 86
Coverage percentage 76%

🔵 Full Codebase Coverage

81% (good)

Metric Value
Total executable lines 18152
Lines covered by tests 14844
Coverage percentage 81%

Changed code coverage measures only Rust lines added/modified in this PR.
Full codebase coverage measures all instrumented Rust lines across the project.

- Replace stale with_resource()/with_resources() doc references with
  with_registry() in vocabulary.rs and dialect.rs
- Add tests for VSCODE_DIALECT_REGISTRY verifying all 16 resources
  (14 keywords + vocabulary + dialect) are registered
- Add tests for VSCodeKeyword::register() standalone usage
- Add tests for default_schema_resource() on VSCodeDialect and
  VSCodeVocabulary verifying correct  and canonical form

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 43 out of 44 changed files in this pull request and generated 4 comments.

Comment thread lib/dsc-lib-jsonschema/src/vscode/vocabulary.rs Outdated
Comment thread lib/dsc-lib-jsonschema/src/vscode/dialect.rs Outdated
Comment thread lib/dsc-lib-jsonschema/src/vscode/keywords/vscode_keyword.rs Outdated
Comment thread lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs
…fetime

- Fix misleading 'bundled' wording in schema_resource_canonical() docs
  for both VSCodeDialect and VSCodeVocabulary
- Replace explicit lifetime + clippy allow with anonymous lifetime ('_')
  on VSCodeKeyword::register()

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 21:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 43 out of 44 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (2)

lib/dsc-lib-jsonschema/src/vscode/vocabulary.rs:166

  • Same as the bundled variant: the docstring reads like Resource is passed directly to with_registry(), but callers need to insert it into a referencing::Registry first.
    lib/dsc-lib-jsonschema/src/vscode/dialect.rs:152
  • Same issue as schema_resource_bundled(): the docstring reads like Resource is passed directly to with_registry(), but callers need to insert it into a referencing::Registry first.
    /// Retrieves the canonical form of the meta schema as a [`Resource`] so you can include
    /// it in the registered resources for a [`jsonschema::Validator`] using the [`with_registry()`] method on [`jsonschema::ValidationOptions`].
    ///

Comment thread lib/dsc-lib-jsonschema/src/vscode/vocabulary.rs Outdated
Comment thread lib/dsc-lib-jsonschema/src/vscode/dialect.rs Outdated
Comment thread lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs Outdated
- Reword Resource docstrings to clarify that callers add the Resource
  to a Registry, then pass the Registry via with_registry()
- Replace generic .expect("valid URI") with .unwrap_or_else() that
  includes the failing URI in the panic message

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 21:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 43 out of 44 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

lib/dsc-lib-jsonschema/src/vscode/vocabulary.rs:166

  • In this doc comment block, the later sentence says the bundled form is returned "without the bundled schema resources", which is contradictory (the bundled form is the one with bundled resources under $defs). This can confuse callers choosing between canonical vs bundled forms.
    lib/dsc-lib-jsonschema/src/vscode/dialect.rs:152
  • In this doc comment block, the later sentence says the bundled form is returned "without the bundled schema resources", which is contradictory (the bundled form is the one that includes the bundled $defs/resources). This can mislead callers about which helper to use.
    /// Retrieves the canonical form of the meta schema as a [`Resource`] so you can add
    /// it to a [`referencing::Registry`] and pass that registry to [`with_registry()`] on [`jsonschema::ValidationOptions`].
    ///

Comment thread lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 21:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 43 out of 44 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:221

  • with_vscode_keywords() currently calls with_vscode_keyword() 14 times, and with_vscode_keyword() adds with_registry(&VSCODE_DIALECT_REGISTRY) every time. Adding the same registry repeatedly is redundant and can introduce unnecessary work. Consider registering all keyword factories first and then calling with_registry() once at the end (same applies to the other with_vscode_*_keywords() helpers).

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.

2 participants