Skip to content

feat: add product identifier fields (code, ean, ean_refill)#263

Open
Ares9323 wants to merge 2 commits intoDonkie:mainfrom
Ares9323:feat/add-product-identifiers
Open

feat: add product identifier fields (code, ean, ean_refill)#263
Ares9323 wants to merge 2 commits intoDonkie:mainfrom
Ares9323:feat/add-product-identifiers

Conversation

@Ares9323
Copy link
Copy Markdown

Summary

Adds three optional fields to the color object in filaments.schema.json:

  • code — Manufacturer product code / SKU (e.g. Bambu Lab 10601 for PLA Basic Blue)
  • ean — EAN/GTIN barcode for the spooled version
  • ean_refill — EAN/GTIN barcode for the refill (no spool) version

This addresses the need discussed in #198 for product identification fields. The schema distinguishes between:

  1. Manufacturer codes (code) — internal product IDs used by manufacturers (e.g. Bambu Lab's 5-digit codes)
  2. Barcodes (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 barcodes

Data included

Verified identifiers for 25 Bambu Lab colors across:

  • PLA Basic (11 colors)
  • PLA Matte (5 colors)
  • PLA Tough+ (1 color)
  • PETG HF (5 colors)
  • PETG Translucent (3 colors)

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:

"code": { "type": "string" },
"ean": { "type": "string", "pattern": "^[0-9]{8,14}$" },
"ean_refill": { "type": "string", "pattern": "^[0-9]{8,14}$" }

Relates to #198

…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
Copilot AI review requested due to automatic review settings March 15, 2026 13:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json color objects with optional code, ean, and ean_refill fields (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.

Comment on lines +217 to +227
"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}$"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Author

@Ares9323 Ares9323 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated files according to copilot suggestions

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json color properties with optional identifier arrays (codes, eans, eans_refill).
  • Update scripts/compile_filaments.py to 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.

Comment on lines +215 to +233
"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.",
Comment on lines +215 to +239
"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
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.

2 participants