Skip to content

(GH-538) Add dsc-lib-jsonschema crate - #1171

Closed
Mikey Lombardi (He/Him) (michaeltlombardi) wants to merge 3 commits into
PowerShell:mainfrom
michaeltlombardi:gh-538/main/initial-canonicalization
Closed

(GH-538) Add dsc-lib-jsonschema crate#1171
Mikey Lombardi (He/Him) (michaeltlombardi) wants to merge 3 commits into
PowerShell:mainfrom
michaeltlombardi:gh-538/main/initial-canonicalization

Conversation

@michaeltlombardi

@michaeltlombardi Mikey Lombardi (He/Him) (michaeltlombardi) commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

PR Summary

This change begins the schema canonicalization process by adding a new library crate to contain the helpers for defining canonical and enhanced schemas ergonomically.

In this initial phase, the new crate defines:

  • The VSCODE_KEYWORDS constant, enumerating the keywords that VS Code's JSON language server recognizes.
  • The idiomaticize_string_enum transformer for munging the generated schemas for string enums with annotation keywords.
  • The idiomaticize_externally_tagged_enum transformer for munging the generated schemas for externally tagged enums to a more idiomatic and readable representation.

This change uses the new idiomaticize_* transformers from the dsc-lib-jsonschema crate in the dsc-lib crate to ensure that the generated schemas are idiomatic.

PR Context

Comment thread lib/dsc-lib-jsonschema/src/tests/transforms/mod.rs
Comment thread lib/dsc-lib-jsonschema/Cargo.toml Outdated
pretty_assertions = { workspace = true }

[lints.clippy]
pedantic ={ level = "deny" }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a specific pedantic rule(s) you are suppressing?

Suggested change
pedantic ={ level = "deny" }
pedantic = { level = "deny" }

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is functionally hoisting the deny flag from the CLI to the configuration file. I was trying to get rust analyzer to flag pedantic lints for me without having to separately run clippy.

This change begins the schema canonicalization process by
adding a new library crate to contain the helpers for
defining canonical and enhanced schemas ergonomically.

In this initial phase, the new crate defines:

- The `VSCODE_KEYWORDS` constant, enumerating the keywords
  that VS Code's JSON language server recognizes.
- The `idiomaticize_string_enum` transformer for munging the
  generated schemas for string enums with annotation keywords.
- The `idiomaticize_externally_tagged_enum` transformer for
  munging the generated schemas for externally tagged enums
  to a more idiomatic and readable representation.
This change uses the new `idiomaticize_*` transformers from the
`dsc-lib-jsonschema` crate in the `dsc-lib` crate to ensure that
the generated schemas are idiomatic.
This change updates the i18n Pester tests to account for:

- Usage of the `t!` macro when the translation key is defined on the next line.
- Usage of the convenience `panic_t!` macro, which simplifies sending translated
  strings to the `panic!` macro.
- Usage of the convenience `assert_t!` macro, which simplifies sending translated
  strings to the panic when an `assert!` macro fails.

These use cases were required for the `dsc-lib-jsonschema` crate, which uses both
`panic_t!` and `assert_t!` to raise translated panic messages when a transform is
invalidly applied.

While this change doesn't modify the behavior for any other crates, it does lay the
groundwork for translating panic messages and assertions throughout the crates.
@SteveL-MSFT

Copy link
Copy Markdown
Member

Mikey Lombardi (He/Him) (@michaeltlombardi) can you address the merge conflicts?

@michaeltlombardi

Copy link
Copy Markdown
Collaborator Author

Steve Lee (@SteveL-MSFT) it looks like the changes for this PR are already in place because ##1197, which included these changes and built on them, is already merged. Closing this PR as it's no longer required.

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