Skip to content

deps: Update schemars to 1.x#254

Merged
kejadlen merged 1 commit intomainfrom
alpha/push-tmorzztppuux
Jan 21, 2026
Merged

deps: Update schemars to 1.x#254
kejadlen merged 1 commit intomainfrom
alpha/push-tmorzztppuux

Conversation

@kejadlen
Copy link
Contributor

@kejadlen kejadlen commented Jan 21, 2026

Upgrades schemars from 0.8 to 1.2 and adapts to API changes.

API changes:

  • schemars::gen module renamed to schemars::generate
  • option_nullable setting removed—schemars 1.x generates type: ["string", "null"] for Option types natively

Schema compatibility fixes:

  • Added skip_serializing_if to #[schemars(skip)] fields that were serializing to null but falling under additionalProperties: { type: "string" }
  • Removed deny_unknown_fields from ReportDestinationTemplates which conflicted with its flattened BTreeMap
  • Added NormalizeDescriptions transform to collapse single line breaks into spaces while preserving paragraph breaks (\n\n). See Handling of newline in RustDoc GREsau/schemars#120

Test fix:

  • Added mutex to serialize environment variable tests in directories.rs to prevent flaky failures from test parallelism

Assisted-by: Claude Opus 4.5 via Claude Code

@kejadlen kejadlen force-pushed the alpha/push-tmorzztppuux branch 3 times, most recently from 6d4a36e to dafdf31 Compare January 21, 2026 00:34
Copy link
Contributor

@rubberduck203 rubberduck203 left a comment

Choose a reason for hiding this comment

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

We should test this against our internal library of doctor groups/known errors sooner than later to ensure everything still parses correctly.

"DoctorCheckSpec": {
"description": "What needs to be checked before the action will run. `paths` will be checked first, then `commands`. If a `path` matches no files or the matching files have changed, the `command` will run.",
"description": "What needs to be checked before the action will run. `paths` will be checked first, then\n`commands`. If a `path` matches no files or the matching files have changed, the `command` will run.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Weird new line break was introduced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like a change in schemars: GREsau/schemars#120

I had Claude write a transform and added that to this PR, but not sure it's worth the extra step to collapse the descriptions or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Possibly not worth the effort. It just caught my eye.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll go ahead and revert the transformer then - agree that probably it's not worth the complexity to de-newline the docs.

},
"paths": {
"description": "A list of globs to check for changes. When the glob matches a new file, or the contents of the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working directory.",
"default": null,
"description": "A list of globs to check for changes. When the glob matches a new file, or the contents\nof the file change, the check will require a fix.\n\nRelative paths are relative to the scope config directory containing the config file.\n\nShared configs can use the template string `{{ working_dir }}` to access the working\ndirectory.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Here as well. Some kind of behavior change in the schema generator?

},
"DoctorInclude": {
"description": "Configure how a groups will be used when determining the task graph.",
"oneOf": [
{
"description": "Default option, the group will be included by default when determining which groups should run.",
"description": "Default option, the group will be included by default when determining which groups should\nrun.",
Copy link
Contributor

Choose a reason for hiding this comment

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

It's littered with these changes. Do we need to update the doc comments they come from?

"enum": [
"when-required"
]
"const": "when-required"
Copy link
Contributor

Choose a reason for hiding this comment

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

This itself is not a breaking change, but it looks like the intent was for it to be extendable.
Would later changing it back to an enum and extending it be a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is actually the same? I believe enum in JSON Schema is similarly non-extendable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, as far as “you can’t add any value you want, so an enum with one member is constant”.

https://json-schema.org/understanding-json-schema/reference/enum

I’m a little rusty on my json schema and trying to think through if moving back from constant to enum later would be compatible. I think it’s fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also this is a child of an anyOf field, which is the actual enum, presumably exploded out into anyOf instead of enum for the descriptions.

@kejadlen kejadlen force-pushed the alpha/push-tmorzztppuux branch 8 times, most recently from f77f60c to f404308 Compare January 21, 2026 22:18
Assisted-by: Claude Opus 4.5 via Claude Code
@kejadlen kejadlen force-pushed the alpha/push-tmorzztppuux branch from f404308 to c669d09 Compare January 21, 2026 22:22
@kejadlen kejadlen merged commit 5b2f393 into main Jan 21, 2026
11 checks passed
@kejadlen kejadlen deleted the alpha/push-tmorzztppuux branch January 21, 2026 23:06
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.

3 participants