api-documentation
api-documentation copied to clipboard
Add user-input to json
As I understand it, now most fields have een parsed by product opener. This implies that capitalization and special characters have been removed. This process is irreversible. And we lost what the user tried to input. It would be nice to have the original input (add _orig to field as with the producer codes), so a nicer output can be presented to the user.
Which fields? For most tag fields, e.g. brands, "brands" contains the original input from the last user. brands_tags contain the canonicalized tags.
For taxonomized fields (e.g. categories), categories_hierarchy keeps accents and capitalization unless the tag exist in the taxonomy.
Very good point. I noticed in the JSON, that only the producer code has an original variant. So I thought, useful, why not the other fields? And the Brand-field comes to mind. It needs either taxonomy support, or I like to see the original field. Now the user input is really mangled.
The "emb_codes_orig" field is now a single string with all the doce. It should be an array of string.
emb_codes_orig is used because there is a special normalization for packaging codes, beyond deaccentuation / decapitalization and taxonomization.
emb_codes_orig is used to save the exact user input (before the special normalization) so that we can put it back in the input field when users edit products. It is not intended for other purposes.
For the brands, you have the exact user input in the "brands" field. brands_tags contain the tag values.
So for all fields, the original user input is in the JSON, nothing has been lost.
That was the reason why I wanted the originals.
OK, I will use brands until there is a taxonomy, which can be used.
What about the packaging field? Is there an original?
For all fields, the original user input is in the non suffixed field. e.g. "packaging":"Carton,sachet,plastique,PAP 21,HDPE 02,HDPE,Polietileno de alta densidade,Cartão"
Add this info to the API documentation.