Skip to content

Conversation

JAORMX
Copy link
Collaborator

@JAORMX JAORMX commented Oct 13, 2025

Summary

This PR properly handles the major version upgrade of the github.com/santhosh-tekuri/jsonschema library from v5 to v6.

In Go, major version upgrades (v2+) require updating the import path to include the new version suffix. PR #2158 attempted this upgrade but only updated go.mod without updating the import paths and adapting to API changes, which caused compilation failures.

Changes

  • go.mod: Removed v5 dependency, kept only v6 with proper import path
  • pkg/registry/schema_validation.go:
    • Updated import path from jsonschema/v5 to jsonschema/v6
    • Adapted to v6 API: AddResource() now accepts parsed JSON (any) instead of io.Reader
    • Updated error handling to use v6's BasicOutput() and OutputError.String() methods
  • pkg/registry/schema_validation_test.go: Adjusted test expectation for v6's error message format ("additional properties" instead of "additionalProperties")

Testing

All tests pass successfully:

  • Unit tests: go test ./pkg/registry/...
  • Full test suite: task test

Migration Notes from v5 to v6

Key API changes in jsonschema v6:

  1. AddResource() signature changed from (url string, reader io.Reader) to (url string, doc any)
  2. ValidationError structure changed - uses ErrorKind and BasicOutput() instead of Message field
  3. Error message formatting is slightly different but still clear and helpful

See upstream migration discussion: santhosh-tekuri/jsonschema#172

Closes #2158

🤖 Generated with Claude Code

Copy link

codecov bot commented Oct 13, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.13%. Comparing base (47e5fd8) to head (b898343).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/registry/schema_validation.go 60.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2168      +/-   ##
==========================================
- Coverage   53.16%   53.13%   -0.03%     
==========================================
  Files         222      222              
  Lines       28904    28908       +4     
==========================================
- Hits        15366    15361       -5     
- Misses      12397    12403       +6     
- Partials     1141     1144       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhrozek
Copy link
Contributor

jhrozek commented Oct 13, 2025

patch LGTM, but conflict needs to be resolved

This commit properly handles the major version upgrade of the
github.com/santhosh-tekuri/jsonschema library from v5 to v6.

In Go, major version upgrades (v2+) require updating the import path
to include the new version suffix. PR #2158 attempted this upgrade
but only updated go.mod without updating the import paths and adapting
to API changes.

Changes made:
- Update import path from jsonschema/v5 to jsonschema/v6
- Remove v5 dependency from go.mod, keep only v6
- Adapt to v6 API: AddResource() now takes parsed JSON (any) instead
  of io.Reader
- Update error handling to use v6's BasicOutput() and OutputError.String()
- Adjust test expectations for v6's error message format

All tests pass with the new version.

Closes #2158

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@JAORMX JAORMX force-pushed the fix/jsonschema-v6-upgrade branch from fe1fc08 to e48245b Compare October 14, 2025 12:14
@JAORMX
Copy link
Collaborator Author

JAORMX commented Oct 14, 2025

@jhrozek resolved

@JAORMX JAORMX merged commit 4645ff9 into main Oct 14, 2025
27 checks passed
@JAORMX JAORMX deleted the fix/jsonschema-v6-upgrade branch October 14, 2025 13:22
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