DEV Community

Source Tapestry Review
Source Tapestry Review

Posted on

Modeling a tea menu entry as a constrained data field

A menu label that names an ingredient and a base leaf can be modeled as a small structured record whose allowed values are limited to what the cited source actually states. The engineering problem is not taste; it is preventing unsupported claims from entering a template.

Take a synthetic record for the cited product: { ingredients: ["jasmine flowers", "oven-dried green tea"], pack_size_g: 70, recipe: { tea_g: 3, water_ml: 200, temp_c: [80, 85], steep_min: [2, 3] } }. These values come from the product page and are illustrative of a filled record, not a verification of production method or origin.

A validator should accept a short entry that describes the base leaf generically and lists the aromatic ingredient separately. It should reject fields such as origin, processing_method, or certification unless those fields are populated from a separate cited source. Edge cases: an empty aromatic field should not silently merge into the base tea; a temperature range should store both bounds, not an average; a recipe field missing a unit should fail rather than default to grams.

Worked expectation: rendering the record above into a menu string yields something like "oven-dried green tea with jasmine flowers, 70 g pack; start at 3 g to 200 ml, 80–85 °C, 2–3 minutes." Testing should confirm that adding an unprovided origin value produces a validation error, and that changing the pack size to a guessed number also fails.

What the evidence can establish is limited: the cited page supports ingredient names, net weight, and a starting recipe. It does not establish how the leaf was grown, where it came from, or that the recipe suits every drinker. A different decision is needed when a menu must show a legally required origin field; then the source set has to expand before the template goes live.

Top comments (0)