feat: add product identifier fields (code, ean, ean_refill)#263
feat: add product identifier fields (code, ean, ean_refill)#263Ares9323 wants to merge 2 commits intoDonkie:mainfrom
Conversation
…schema Add three optional fields to the color object schema: - code: manufacturer product code / SKU (e.g. Bambu Lab "10601") - ean: EAN/GTIN barcode for the spooled version - ean_refill: EAN/GTIN barcode for the refill version Populate verified data for Bambu Lab (25 colors across PLA Basic, PLA Matte, PLA Tough+, PETG HF, and PETG Translucent). Relates to Donkie#198
There was a problem hiding this comment.
Pull request overview
Adds optional product identifier fields to filament color entries to support manufacturer SKUs and GTIN/EAN barcodes, addressing the need raised in #198.
Changes:
- Extends
filaments.schema.jsoncolor objects with optionalcode,ean, andean_refillfields (EAN fields constrained to 8–14 digits). - Populates these new fields for a set of Bambu Lab colors in
filaments/bambulab.json.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| filaments/bambulab.json | Adds code/ean/ean_refill values to selected Bambu Lab color entries. |
| filaments.schema.json | Updates the JSON schema to allow the new optional identifier fields on color objects. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
filaments.schema.json
Outdated
| "type": "string" | ||
| }, | ||
| "ean": { | ||
| "$comment": "EAN/GTIN barcode for the spooled version of this color.", | ||
| "type": "string", | ||
| "pattern": "^[0-9]{8,14}$" | ||
| }, | ||
| "ean_refill": { | ||
| "$comment": "EAN/GTIN barcode for the refill (no spool) version of this color.", | ||
| "type": "string", | ||
| "pattern": "^[0-9]{8,14}$" |
There was a problem hiding this comment.
Noted, modifying PR to address multiple EAN per product.
Address review feedback: - Rename code/ean/ean_refill to codes/eans/eans_refill (arrays) to support multiple identifiers per color (e.g. ASIN + EAN) - Update compile_filaments.py to propagate the new fields into the compiled output - Convert existing bambulab.json data to array format
Ares9323
left a comment
There was a problem hiding this comment.
Updated files according to copilot suggestions
There was a problem hiding this comment.
Pull request overview
Adds product identifier support to the filament color model so that manufacturer SKUs and barcodes can be captured in the source filament JSON and carried through the compile step.
Changes:
- Extend
filaments.schema.jsoncolor properties with optional identifier arrays (codes,eans,eans_refill). - Update
scripts/compile_filaments.pyto read and emit the new identifier fields in compiled output. - Populate identifiers for a set of Bambu Lab colors in
filaments/bambulab.json.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/compile_filaments.py | Plumbs codes / eans / eans_refill from input color objects into the compiled filament objects. |
| filaments/bambulab.json | Adds identifier data (SKU/EAN/refill EAN) for multiple Bambu Lab colors. |
| filaments.schema.json | Defines the new optional identifier arrays on color objects with uniqueness and EAN format validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "codes": { | ||
| "$comment": "Manufacturer product codes / SKUs for this color variant (e.g. Bambu Lab '10601' for PLA Basic Blue).", | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "uniqueItems": true | ||
| }, | ||
| "eans": { | ||
| "$comment": "EAN/GTIN barcodes for the spooled version of this color.", | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]{8,14}$" | ||
| }, | ||
| "uniqueItems": true | ||
| }, | ||
| "eans_refill": { | ||
| "$comment": "EAN/GTIN barcodes for the refill (no spool) version of this color.", |
| "codes": { | ||
| "$comment": "Manufacturer product codes / SKUs for this color variant (e.g. Bambu Lab '10601' for PLA Basic Blue).", | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "uniqueItems": true | ||
| }, | ||
| "eans": { | ||
| "$comment": "EAN/GTIN barcodes for the spooled version of this color.", | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]{8,14}$" | ||
| }, | ||
| "uniqueItems": true | ||
| }, | ||
| "eans_refill": { | ||
| "$comment": "EAN/GTIN barcodes for the refill (no spool) version of this color.", | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]{8,14}$" | ||
| }, | ||
| "uniqueItems": true |
Summary
Adds three optional fields to the color object in
filaments.schema.json:code— Manufacturer product code / SKU (e.g. Bambu Lab10601for PLA Basic Blue)ean— EAN/GTIN barcode for the spooled versionean_refill— EAN/GTIN barcode for the refill (no spool) versionThis addresses the need discussed in #198 for product identification fields. The schema distinguishes between:
code) — internal product IDs used by manufacturers (e.g. Bambu Lab's 5-digit codes)ean,ean_refill) — physical EAN/GTIN codes found on packaging, separated by packaging type since many manufacturers sell both spooled and refill versions with different barcodesData included
Verified identifiers for 25 Bambu Lab colors across:
All EAN codes were physically scanned from packaging. Product codes are from the Bambu Lab website.
Example
{ "name": "Jade White", "hex": "FFFFFF", "code": "10100", "ean": "6975337031024" }Schema additions
All fields are optional and backward-compatible:
Relates to #198