[UoM prototype] Render measurement attributes in docs (3/4) - #952
[UoM prototype] Render measurement attributes in docs (3/4)#952ricardotejedorsanz wants to merge 2 commits into
Conversation
c6fa39c to
77f1df6
Compare
eb4dcd4 to
7c562f9
Compare
jeanguo-png
left a comment
There was a problem hiding this comment.
Non-blocking: could we default missing attribute.type to closed_list in the shared layouts? Older release docs data does not include type, so those pages will render a blank Type value even though the attributes are effectively closed-list. A small Liquid default would keep old release pages looking correct while supporting measurement attributes in the new data.
danielpgross
left a comment
There was a problem hiding this comment.
Approach looks fine (details will depend on whether we make further changes to the data model)
|
|
||
| #### Attribute types | ||
|
|
||
| Attributes include an explicit `type`. Closed-list attributes define a set of taxonomy values. Measurement attributes define a `measurement_type` and `supported_units` instead of values. |
There was a problem hiding this comment.
This is pretty terse, it might help to add some examples here for clarity
There was a problem hiding this comment.
Thanks @danielpgross, I included one-line definitions for closed_list and measurement, plus compact JSON examples for both attribute shapes:
Attribute types
Attributes include an explicit type:
closed_list: an attribute whose value is selected from a predefined set of taxonomy values, used when consistent value standardization is needed across products.measurement: an attribute whose value is a number paired with a supported unit, used when products need precise measurements such as dimensions, weight, volume, or power.
Closed-list attributes include values:
{
"id": "gid://shopify/TaxonomyAttribute/1",
"name": "Color",
"handle": "color",
"type": "closed_list",
"values": [
{
"id": "gid://shopify/TaxonomyValue/1",
"name": "Black",
"handle": "color__black"
}
]
}Measurement attributes include measurement_type and supported_units instead of values:
{
"id": "gid://shopify/TaxonomyAttribute/12429",
"name": "Height",
"handle": "height",
"type": "measurement",
"measurement_type": "dimension",
"supported_units": ["cm", "in"]
}70e5460 to
46b2ef5
Compare
7c562f9 to
979ecd0
Compare
46b2ef5 to
3e9cc33
Compare
979ecd0 to
cda0be9
Compare
Thanks @jeanguo-png, addressed this in a separate follow-up commit. |
What this PR does
This PR updates the public docs/visualizer path to understand measurement attributes introduced in #950 and bulk-imported in #951.
It is stacked on #951 so the visualizer can be reviewed with the V0 measurement vocabulary.
What changed
typefor attributes.measurement_typeandsupported_unitsinstead of a values list.UX changes
The visualizer now makes the attribute type explicit when an attribute is expanded:
Type: closed_list, followed by aValueslabel and their allowed taxonomy values.Type: measurement,Measurement type, andSupported unitsinstead of a values list.Image 1 — closed-list attribute expanded in a category:
Image 2 — measurement attribute expanded in a category:
Image 3 — measurement attribute on the attribute details page:
Validation
ruby -cpassed for the changed Ruby serializers/tests.bundle exec rake test:unitpassed.bundle exec bin/product_taxonomy docspassed.bundle exec jekyll build --source ../docs --destination /tmp/product-taxonomy-docs-sitepassed.measurement_typeandsupported_units, and closed-list attributes with aValueslabel.git diff --checkpassed.