Add validation on card metadata types #518

Merged
Vylpes merged 1 commit from feature/516-validate-card-metadata-types into release/0.12.0 2026-09-06 16:07:20 +01:00
Owner
#516
Add validation on card metadata types
All checks were successful
Test / build (push) Successful in 1m36s
204b465932
Vylpes changed title from WIP: Add validation on card metadata types to Add validation on card metadata types 2026-09-06 09:30:17 +01:00
Smithy-bot approved these changes 2026-09-06 15:56:50 +01:00
Smithy-bot left a comment

Approve — parse-time card metadata validation is well implemented and matches #516.

What looks good

  • New CardMetadataValidator enforces the right policy: type must be a JSON number in the CardRarity range (string "1" is rejected, not coerced), while series id numeric strings are coerced for legacy files.
  • Integration in CardMetadataFunction treats validation failures like corrupt JSON — logs the file path, aborts that load, and activates safe mode so invalid cards never reach drop/inventory/stats paths.
  • Error messages include file path plus series/card identifiers, satisfying the visibility requirement.
  • Unit tests cover valid numeric type, rejected string/null/garbage/out-of-range types, series id coercion, and non-array roots.
  • docs/cards.md documents the validation policy clearly.

Non-blocking

  • No integration test exercising CardMetadataFunction end-to-end with a bad file on disk; validator coverage is thorough enough for now.
  • A series with an empty cards array passes validation; fine if that is intentional.

No merge-blocking issues.

**Approve** — parse-time card metadata validation is well implemented and matches #516. **What looks good** - New `CardMetadataValidator` enforces the right policy: `type` must be a JSON number in the `CardRarity` range (string `"1"` is rejected, not coerced), while series `id` numeric strings are coerced for legacy files. - Integration in `CardMetadataFunction` treats validation failures like corrupt JSON — logs the file path, aborts that load, and activates safe mode so invalid cards never reach drop/inventory/stats paths. - Error messages include file path plus series/card identifiers, satisfying the visibility requirement. - Unit tests cover valid numeric `type`, rejected string/null/garbage/out-of-range types, series id coercion, and non-array roots. - `docs/cards.md` documents the validation policy clearly. **Non-blocking** - No integration test exercising `CardMetadataFunction` end-to-end with a bad file on disk; validator coverage is thorough enough for now. - A series with an empty `cards` array passes validation; fine if that is intentional. No merge-blocking issues.
Vylpes merged commit bd1cd3d8e3 into release/0.12.0 2026-09-06 16:07:20 +01:00
Vylpes deleted branch feature/516-validate-card-metadata-types 2026-09-06 16:07:20 +01:00
Sign in to join this conversation.
No description provided.