Skip to content

Document sourceProducts as a Source Products object on Deck and Token cards - #733

Merged
ZeldaZach merged 1 commit into
mainfrom
fix-source-products-type-642
Sep 8, 2026
Merged

ZeldaZach merged 1 commit into
mainfrom
fix-source-products-type-642

Conversation

@ZeldaZach

Copy link
Copy Markdown
Member

Fixes #642

Card (Deck) and Card (Token) still described sourceProducts as a flat string[] of Sealed Product uuids. It is actually the same SourceProducts object already documented on Card (Set) — a mapping of finish (etched, foil, nonfoil) to the uuids of the products that finish is found in. #632 fixed Card (Set) when it addressed #626–628, but left the identical field on the other two models untouched.

Verified two ways:

  • In the data, every card in AzaarLichlord_PAST.json (the reporter's example) carries sourceProducts as an object like {"nonfoil": [...]}, never a flat array.
  • Upstream in mtgjson5/models/cards.py, CardSet, CardDeck and CardToken all declare source_products: SourceProducts | None. The Deck and Token fields just carry a stale json_schema_extra={"type_override": "string[]"} and the old description, which is why the generated docs came out wrong — Card (Set) has no such override.

Also lists Card (Deck) and Card (Token) as parent models on the Source Products page, matching how Identifiers and SKU IDs name every parent.

npm run generate:types now emits sourceProducts?: SourceProducts in CardDeck.ts and CardToken.ts, in line with CardSet.ts. markdownlint is clean on all three changed files.

The other half of #642 — that Source Products' own fields are documented as required but are often absent — was handled by #732.

Note: the root cause is upstream in mtgjson/mtgjson. Until the type_override is dropped from CardDeck.source_products and CardToken.source_products there, the next --generate-docs run will overwrite this fix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xba7S7uYsrKAVdniqNcfhS

… cards

Card (Deck) and Card (Token) still described sourceProducts as a flat
string[] of Sealed Product uuids. It is actually the same SourceProducts
object already documented on Card (Set) — a mapping of finish (etched,
foil, nonfoil) to the uuids of the products that finish is found in.
Confirmed in the data (every card in AzaarLichlord_PAST.json carries
{"nonfoil": [...]}) and upstream, where CardSet, CardDeck and CardToken
all declare source_products as SourceProducts; the Deck and Token fields
just carry a stale type_override of "string[]".

Also lists Card (Deck) and Card (Token) as parent models on the Source
Products page, matching how Identifiers and SKU IDs name every parent.

Fixes #642

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 (c57dedc) to head (c5dcc99).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #733   +/-   ##
=========================================
  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 c0e3035 into main Sep 8, 2026
5 checks passed
@ZeldaZach
ZeldaZach deleted the fix-source-products-type-642 branch September 8, 2026 18:05
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.

Type of sourceProducts property in Card (Deck) data model

1 participant