-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce GPC Bricks #22
Comments
More info regarding attribute types: https://www.gs1.org/voc/?show=properties And possibly a source of property set definitions: |
NOTESAm proceeding with this, using GS1's "bricks" as a reference |
NOTESThis is the basic model using in GS1
|
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
Already baked into the app is the notion of a property set, basic collections of facts about a product.
Each property set defines the name, type and potentially the title of product information elements:
This scheme is a bit clumsy and likely to become more complicated as more complex types are added. There is also no way currently in the system to validate data against property sets.
Proposal
1. Use JSON Schema
Rather than build out a complete type system, use the existing standards and tooling around JSON Schema. Under this model, a property set definition would look something like this:
There are numerous resources for validating JSON data, including multiple ruby gems:
We can probably push a lot of this down to the database level, validating / typing data within PostgreSQL itself:
2. Use Property Definitions From GS1
GS1 publishes standard property definitions for different product types and industries. Rather than invent our our, we should defer to the GS1 standards for property name and type information.
For example, the published Australasian_Liquor_Industry attributes includes a
liquorAge
integer type attribute.Other attributes include enums (
alcoholicStrengthDescription
), floats (standardDrinks
) and a number of attributes that are constrained by various rules - potentially mappable to JSON Schema regex type definitions.If we were to record data for alcoholic products - at least for the Australian market - we would map all these into a specific JSON Schema document for validating data.
3. Move Title Translations Into I18N
This may be an edge case, but there might be reasons to provide translations of property names. Rather than bake this into the schemas, we can push this off to Rails' I18N mechanism, translating based on keys, e.g.
calories: 'calorías'
The text was updated successfully, but these errors were encountered: