Skip to content

Mark Source Products fields as optional - #732

Merged
ZeldaZach merged 1 commit into
mainfrom
fix-source-products-optional-662
Sep 8, 2026
Merged

ZeldaZach merged 1 commit into
mainfrom
fix-source-products-optional-662

Conversation

@ZeldaZach

Copy link
Copy Markdown
Member

Fixes #662

etched, foil, and nonfoil were documented as required on the Source Products model, but MTGJSON omits any finish a card was not printed in.

Verified against live data — counting which sourceProducts keys are present per card:

Set Key combination Cards
10E foil, nonfoil 258
10E nonfoil only 125
10E foil only 125
MH2 foil, nonfoil 377
MH2 etched, foil, nonfoil 113
MH2 foil only 1

All three fields turn up missing in practice, so each gets the optional badge. That badge is what util/generate-types.js reads, so the generated model becomes:

export type SourceProducts = {
  etched?: string[];
  foil?: string[];
  nonfoil?: string[];
};

This matches the sibling SkuIds model, which already declares its finish fields optional.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xba7S7uYsrKAVdniqNcfhS

MTGJSON omits any finish a card was not printed in, so etched, foil, and
nonfoil can each be absent from a sourceProducts object. Verified against
10E (cards with only nonfoil, and cards with only foil) and MH2 (cards
with all three, and one with only foil).

Adding the optional badge also flows into the generated TypeScript model,
bringing it in line with the sibling SkuIds model.

Fixes #662

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xba7S7uYsrKAVdniqNcfhS
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d7c4aef) to head (07b3b64).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #732   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           69        69           
  Branches        27        27           
=========================================
  Hits            69        69           

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ZeldaZach
ZeldaZach merged commit c57dedc into main Sep 8, 2026
5 checks passed
@ZeldaZach
ZeldaZach deleted the fix-source-products-optional-662 branch September 8, 2026 17:56
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.

Documentation for Source Products seems to be incorrect

1 participant