Update dsc version to 3.4-preview.1 and jsonschema crate to 0.49.1 - #1651
Update dsc version to 3.4-preview.1 and jsonschema crate to 0.49.1#1651SteveL-MSFT wants to merge 7 commits into
Conversation
- 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>
There was a problem hiding this comment.
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
jsonschema0.49Keyword<'i>trait signatures and error-construction APIs. - Replaced per-keyword resource registration with a lazily initialized
referencing::Registry(VSCODE_DIALECT_REGISTRY) and wired it intoValidationOptionsextensions viawith_registry(). - Adjusted tests to assert on
schema_path()instead ofinstance_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()callswith_registry()and then callswith_vscode_keyword(), which adds the same registry again. Dropping the redundantwith_registry()here avoids an unnecessary builder step.
lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:248with_vscode_documentation_keywords()callswith_registry()and then callswith_vscode_keyword(), which adds the same registry again. Dropping the redundantwith_registry()here avoids an unnecessary builder step.
lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:256with_vscode_error_keywords()callswith_registry()and then callswith_vscode_keyword(), which adds the same registry again. Dropping the redundantwith_registry()here avoids an unnecessary builder step.
lib/dsc-lib-jsonschema/src/vscode/validation_options_extensions.rs:262with_vscode_parsing_keywords()callswith_registry()and then callswith_vscode_keyword(), which adds the same registry again. Dropping the redundantwith_registry()here avoids an unnecessary builder step.
- 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>
- 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>
There was a problem hiding this comment.
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()andwith_vscode_dialect()are now functionally identical (both just callwith_vscode_keywords()via the same registry). BecauseVSCODE_DIALECT_REGISTRYalso registersVSCodeDialect::SCHEMA_ID, callingwith_vscode_vocabulary()will implicitly make the dialect meta-schema resolvable too, which is a behavioral change from the previous API where dialect registration requiredwith_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.
😐 Code Coverage ReportChanged Code Coverage76% (70%+ coverage)
🔵 Full Codebase Coverage81% (good)
|
- 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>
…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>
There was a problem hiding this comment.
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`].
///
- 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>
There was a problem hiding this comment.
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`].
///
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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 callswith_vscode_keyword()14 times, andwith_vscode_keyword()addswith_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 callingwith_registry()once at the end (same applies to the otherwith_vscode_*_keywords()helpers).
Motivation
Bump the dsc executable version to 3.4-preview.1 and update the
jsonschemacrate 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:Keywordtrait is now generic:Keyword<'i>with updatedvalidate()andis_valid()signatures (no moreLazyLocationparameter).ValidationError::custom()simplified from 4 arguments to 1 (just the error message). Path context is now applied automatically by the framework.with_resource()removed fromValidationOptions. Replaced with a staticVSCODE_DIALECT_REGISTRYusingreferencing::Registryandwith_registry(), which pre-registers all VS Code keyword schemas, vocabulary, and dialect resources at program startup.Resourcetype moved fromjsonschemato thereferencingcrate.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 onschema_path()instead, which correctly reflects where in the schema the error occurred. All 2,551 tests pass (361 indsc-lib-jsonschema, 2,190 indsc-lib).