Skip to content

cli/compose/schema: migrate to github.com/santhosh-tekuri/jsonschema/v6 - #7195

Open
thaJeztah wants to merge 1 commit into
docker:masterfrom
thaJeztah:modern_jsonschema
Open

cli/compose/schema: migrate to github.com/santhosh-tekuri/jsonschema/v6#7195
thaJeztah wants to merge 1 commit into
docker:masterfrom
thaJeztah:modern_jsonschema

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Aug 15, 2026

Copy link
Copy Markdown
Member

Size is slightly larger, but not dramatic (+514,560 bytes);

Before/after

ls -l ./build/docker-darwin-arm64
-rwxr-xr-x  1 thajeztah  staff  39800754 Aug 15 16:48 ./build/docker-darwin-arm64*

ls -l ./build/docker-darwin-arm64
-rwxr-xr-x  1 thajeztah  staff  40315314 Aug 15 16:48 ./build/docker-darwin-arm64*

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added this to the 29.8.0 milestone Aug 15, 2026
@thaJeztah thaJeztah added status/2-code-review area/stack kind/refactor PR's that refactor, or clean-up code labels Aug 15, 2026
@codecov-commenter

codecov-commenter commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.33898% with 35 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/compose/schema/schema.go 70.33% 31 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@thaJeztah
thaJeztah force-pushed the modern_jsonschema branch 3 times, most recently from 9b7a816 to 6c0a976 Compare August 15, 2026 15:24
@thaJeztah
thaJeztah requested a lite review from Copilot August 23, 2026 15:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Migrates Compose schema validation to jsonschema/v6, updating error formatting and vendored dependencies.

Changes:

  • Replaces gojsonschema validation and custom error handling.
  • Updates schema and loader test expectations.
  • Vendors jsonschema/v6 and required x/text packages.

Reviewed changes

Copilot reviewed 5 out of 123 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vendor/modules.txt Updated as part of this pull request.
vendor/golang.org/x/text/message/message.go Updated as part of this pull request.
vendor/golang.org/x/text/message/doc.go Updated as part of this pull request.
vendor/golang.org/x/text/message/catalog/dict.go Updated as part of this pull request.
vendor/golang.org/x/text/message/catalog.go Updated as part of this pull request.
vendor/golang.org/x/text/language/tags.go Updated as part of this pull request.
vendor/golang.org/x/text/language/doc.go Updated as part of this pull request.
vendor/golang.org/x/text/language/coverage.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/tag/tag.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/stringset/set.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/number/roundingmode_string.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/number/number.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/number/common.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/match.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/language/tags.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/language/match.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/language/coverage.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/language/compose.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/language/compact/tags.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/language/compact/compact.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/language/compact.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/language/common.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/internal.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/format/format.go Updated as part of this pull request.
vendor/golang.org/x/text/internal/catmsg/varint.go Updated as part of this pull request.
vendor/golang.org/x/text/feature/plural/message.go Updated as part of this pull request.
vendor/golang.org/x/text/feature/plural/common.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/utils.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/types.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/subSchema.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/schemaType.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/schemaReferencePool.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/schemaPool.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/schemaLoader.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/result.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/LICENSE-APACHE-2.0.txt Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/jsonContext.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/internalLog.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/glide.yaml Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/.travis.yml Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonschema/.gitignore Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonreference/reference.go Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonreference/README.md Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonreference/LICENSE-APACHE-2.0.txt Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonpointer/README.md Updated as part of this pull request.
vendor/github.com/xeipuuv/gojsonpointer/pointer.go Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/vocab.go Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/schema.go Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/root.go Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/README.md Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/position.go Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/output.go Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/schema Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/meta/validation Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/meta/unevaluated Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/meta/meta-data Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/meta/format-assertion Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/meta/format-annotation Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/meta/core Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/meta/content Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2020-12/meta/applicator Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2019-09/schema Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2019-09/meta/validation Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2019-09/meta/meta-data Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2019-09/meta/format Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2019-09/meta/core Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2019-09/meta/content Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft/2019-09/meta/applicator Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft-07/schema Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft-06/schema Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/metaschemas/draft-04/schema Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/loader.go Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/LICENSE Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/go.work.sum Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/go.work Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/content.go Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/.pre-commit-hooks.yaml Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/.golangci.yml Updated as part of this pull request.
vendor/github.com/santhosh-tekuri/jsonschema/v6/.gitmodules Updated as part of this pull request.
vendor.sum Updated as part of this pull request.
vendor.mod Updated as part of this pull request.
cli/compose/schema/schema_test.go Updated as part of this pull request.
cli/compose/loader/loader_test.go Updated as part of this pull request.
Suppressed comments (2)

cli/compose/schema/schema.go:129

  • reflect.Value.String() returns the underlying value only for string-kind values; for an integer or interface map key it produces placeholders such as "<int Value>" or "<interface {} Value>". That changes/collapses non-string keys during conversion and can make malformed nested YAML mappings validate under permissive patternProperties. Convert supported key values explicitly (or reject non-string keys) instead of using Value.String().
    cli/compose/schema/schema.go:97
  • The migrated validator registers a custom duration format here, but the schema and loader tests do not exercise either an accepted or rejected duration. Add a regression case such as an invalid stop_grace_period so this format registration and time.ParseDuration path are covered.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cli/compose/schema/schema.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

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 5 out of 123 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

cli/compose/schema/schema.go:93

  • The Compose schemas mark every expose item with format: "expose", but this compiler only registers ports and duration. In jsonschema/v6 an unknown format leaves Schema.Format unset, so invalid values such as 65536 or 8080:9090 are accepted here and no later loader step validates expose. Please register a checker implementing the Compose expose grammar (or remove the schema annotation if this validation is intentionally unsupported).
    cli/compose/schema/schema.go:237
  • This selection stops at a nested oneOf because flattenErrors deliberately treats kind.OneOf as a leaf. For example, the invalid networks.default: bridge case in TestNonMappingObject reaches the inner object/null oneOf, so getDescription receives that combinator as err.parent and reports networks.default: 'oneOf' failed, none matched instead of the test's expected type description. Descend through nested oneOf/anyOf causes before formatting the selected error.

Comment thread cli/compose/schema/schema.go
@thaJeztah thaJeztah changed the title ci/compose/schema: migrate to github.com/santhosh-tekuri/jsonschema/v6 cli/compose/schema: migrate to github.com/santhosh-tekuri/jsonschema/v6 Aug 24, 2026
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah marked this pull request as ready for review August 24, 2026 10:54
@thaJeztah

Copy link
Copy Markdown
Member Author

For the LoC in this PR;

Screenshot 2026-08-24 at 12 58 16

Most of them are the golang.org/x/text packages that are now imported; impact on binary size is present, but not too horrible;

This branch:

ls -lh ./build/docker-darwin-arm64
-rwxr-xr-x  1 thajeztah  staff    39M Aug 24 12:58 ./build/docker-darwin-arm64*

ls -l ./build/docker-darwin-arm64
-rwxr-xr-x  1 thajeztah  staff  40823586 Aug 24 12:58 ./build/docker-darwin-arm64*

master;

ls -lh ./build/docker-darwin-arm64
-rwxr-xr-x  1 thajeztah  staff    38M Aug 24 12:59 ./build/docker-darwin-arm64*

ls -l ./build/docker-darwin-arm64
-rwxr-xr-x  1 thajeztah  staff  40296082 Aug 24 12:59 ./build/docker-darwin-arm64*

diff; 40823586 - 40296082 = 527504 (527k)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/stack kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants