Skip to content

Preserve dotted property names during schema canonicalization - #23

Open
agammann wants to merge 1 commit into
MoonshotAI:mainfrom
agammann:fix-dotted-property-canonicalization
Open

agammann wants to merge 1 commit into
MoonshotAI:mainfrom
agammann:fix-dotted-property-canonicalization

Conversation

@agammann

Copy link
Copy Markdown

Problem

When Schema.Canonical() simplifies an invalid keyword inside a property named a.b, it serializes the schema path as a dot-separated string and then parses that string back into parts. The property name is split into a and b, so the simplifier misses the offending field and can reduce the entire schema to {}.

For example, {"type":"object","properties":{"a.b":{"type":"string","minLength":-1}}} canonicalized to {} on the current main revision. The same schema with a property named ab retained the property and repaired minLength to 0.

Change

Keep the structured path parts on simplifiable schema errors and use those parts for the canonicalization retry. The existing public string path remains unchanged. A regression case checks that the dotted property and its repaired bound are retained.

Validation

  • Confirmed the new regression case fails on unmodified main and passes with this change.
  • go test ./... with the repository's Go 1.23 toolchain.
  • go test -race ./... with Go 1.27.1.
  • golangci-lint run -v with the CI-pinned v1.64.8 under Go 1.23.
  • Built the Linux c-shared library and ran python3 -m unittest discover -s python/tests -v (3 tests passed).
  • git diff --check.

@agammann

Copy link
Copy Markdown
Author

The pull-request CI run expired after waiting for fork-workflow approval and contains no jobs, so its failure does not provide test results for the current head. Could a maintainer approve or retrigger a fresh CI run? I can follow up once the checks execute.

This branch has not been deployed

No deployments
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