Skip to content

feat(schema): schemars 1.x + Draft-2020-12 + TOML round-trip tests#5

Merged
UnbreakableMJ merged 1 commit into
mainfrom
feat/schema-property-tests
Apr 27, 2026
Merged

feat(schema): schemars 1.x + Draft-2020-12 + TOML round-trip tests#5
UnbreakableMJ merged 1 commit into
mainfrom
feat/schema-property-tests

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Chunk M1-W1-C of M1 plan — closes Plan §6.1.

Workspace dep bump

schemars 0.8 → 1 (latest 1.2.1; MSRV 1.74, well below our 1.85 pin). 1.x emits Draft 2020-12 by default; existing JsonSchema derives compile unchanged.

Two new tests in lib.rs::cross_cutting_tests

Test Plan §6.1 gate
schemars_output_is_draft_2020_12 schema: schemars_output_is_2020_12
declared_state_round_trips_through_toml round-trip: declared_state_serde

Plan §6.1 Done when status

  • Public types derive Serialize, Deserialize, JsonSchema, Debug, Clone.
  • cargo doc --no-deps emits zero missing docs warnings.
  • A representative resolved.toml fixture round-trips without loss.
  • schemars output validates as Draft 2020-12.
  • Zero unwrap()/expect()/panic! in production code paths.
  • pearlite-audit reports no §13 violations.

pearlite-schema is now fully done per Plan §6.1.

Out of scope

Property tests — Plan §6.1 doesn't list any for pearlite-schema. The proptest gates apply to pearlite-state (§6.2) and pearlite-diff (§6.3) instead.

Verification

  • cargo test -p pearlite-schema — 14 passed; 0 failed
  • cargo doc -p pearlite-schema --no-deps — zero warnings
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt --all --check
  • scripts/ci/check-spdx.sh
  • pearlite-audit check . — 1 check, 0 violations

🤖 Generated with Claude Code

Chunk M1-W1-C of M1 plan — closes Plan §6.1.

Workspace dep:
- schemars 0.8 → 1 (latest 1.2.1; MSRV 1.74 stays well below our 1.85
  pin). 1.x emits Draft 2020-12 by default; the existing JsonSchema
  derives compile unchanged.

pearlite-schema dev-dep:
- serde_json (workspace dep, used only in tests).

Two acceptance tests in lib.rs::cross_cutting_tests:

- schemars_output_is_draft_2020_12 — generates the JSON Schema for
  DeclaredState and asserts the $schema field claims Draft 2020-12.
  This is the Plan §6.1 "schema: schemars_output_is_2020_12" gate.
- declared_state_round_trips_through_toml — parses host_full.toml,
  serializes it back, re-parses, and asserts equality. This is the
  "round-trip: declared_state_serde — every field round-trips through
  TOML" gate.

Plan §6.1 "Done when" status now:

- Public types derive Serialize, Deserialize, JsonSchema, Debug,
  Clone (+Eq/PartialEq/Hash/Default where applicable). ✓
- cargo doc --no-deps emits zero "missing docs" warnings. ✓
- A representative resolved.toml fixture round-trips without loss. ✓
- schemars output validates as Draft 2020-12. ✓
- Zero unwrap()/expect()/panic! in production code paths. ✓ (lints
  enforce workspace-wide).
- pearlite-audit reports no §13 violations. ✓

What's NOT in this chunk (deferred per Plan §6.1):
- Property tests with proptest — Plan §6.1 doesn't list any property
  test for pearlite-schema (proptest gates apply to pearlite-state §6.2
  and pearlite-diff §6.3).

Verification:
- cargo test -p pearlite-schema  (14 passed; 0 failed)
- cargo doc -p pearlite-schema --no-deps  (zero warnings)
- cargo clippy --workspace --all-targets -- -D warnings  (zero warnings)
- cargo fmt --all --check
- scripts/ci/check-spdx.sh
- pearlite-audit check .  (1 check, 0 violations)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ merged commit a6d8358 into main Apr 27, 2026
3 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the feat/schema-property-tests branch April 27, 2026 14:24
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