feat: replace jsonschema with marshmallow for manifest validation - #71
Merged
Merged
Conversation
Consolidates manifest validation onto marshmallow, reducing duplication between the JSON Schema files and the existing @serde dataclasses while preserving current validation behavior exactly (unknown fields allowed, metadata fields not required, version still required despite its default). Closes #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧑💻What is the change being made?
Replaces the
jsonschemadependency withmarshmallowfor manifest validation. Addssrc/terranova/schemas/manifest.pywith hand-writtenmarshmallow.Schemaclasses (one per manifest version, 1.0-1.3, built via inheritance) and aMANIFEST_SCHEMASregistry, replaces thepkgutil/json/jsonschema.validate()call site insrc/terranova/resources.pywith a marshmallowschema.load()call, removes the four supersededmanifest_schema_v*.jsonfiles, and swaps thejsonschemadependency formarshmallowinpyproject.toml.❓ Why is the change being made?
jsonschemaduplicated structure already expressed by the project's@serdedataclasses, and the project already leans on dataclasses throughout for serialization. This consolidates validation onto marshmallow for a more Pythonic API and better integration with existing patterns, closing #5.✅ How has this been tested?
tests/it/test_resources.pymanifest-validation suite passes unmodified (missing/unreadable manifest, invalid YAML, the "missing version still fails" quirk, unsupported version, schema-validation failure, valid parse for versions 1.0-1.3).dependencieslist is rejected.tests/it/test_manifest_schemas.pywith direct unit tests against eachManifestSchemaV1_xclass.uv run poe test): 324 passed.uv run poe lint(ruff + basedpyright): clean, 0 errors/0 warnings.terranova initagainst severaltests/fixtures/*/manifest.ymlfixtures (including a v1.2 manifest exercising thefrom/import/asrenames) succeeds.📚 How has this been documented?
Updated the four jsonschema references in
.claude/CLAUDE.mdto describe the new marshmallow-based validation and thesrc/terranova/schemas/manifest.pymodule.🔗 Related Issues
Closes #5