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
Fix: Added missing product fields to ProductField enum #331
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@M123-dev Please have a look at my comments.
lib/model/Product.dart
Outdated
@JsonKey(name: 'generic_name') | ||
String? genericName; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the diffs and this was in the ProductFields but not in the Product, Its in the normal reponses and since its particially already in the code I just added it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!
Nothing personal, but there are already tons of fields in Product
(50+) and none of them has comments.
Adding a String?
called genericName
, why not, next one is going to be dynamic justSomething
?
More seriously: we should definitely add comments on the Product
fields. In another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes there I agree with you, we should make in any case. In fact, I've been thinking about updating the entire documentation a bit for a while now.
I don't know how to approach this, but it would also be good to somehow manage to have the products in just one place and not in two files in two places each.
@@ -101,15 +108,20 @@ extension ProductFieldExtension on ProductField { | |||
ProductField.CATEGORIES: 'categories', | |||
ProductField.CATEGORIES_TAGS: 'categories_tags', | |||
ProductField.CATEGORIES_TAGS_IN_LANGUAGES: 'categories_tags_', | |||
ProductField.LABELS: 'labels', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably would be worth checking in a test that when we ask for those fields in a get product query, we actually get them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monsieurtanuki I added a test but this does not include serving_quantity as this can be retrieved (manually checked) individually and with everything, but not manually set as I found out after way too long research. I left it completely out so that the tests don't start to fail so often. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
///Common name | ||
///Example: Chocolate bar with milk and hazelnuts | ||
@JsonKey(name: 'generic_name', includeIfNull: false) | ||
String? genericName; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment and the example!
Beyond that good start will come later painful questions like: is that always in English? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looked into a response and it has generic_name, generic_name_fr as well as a generic_name_fr_debug_tags list, interesting
Fixes: #326
Transfered missing values of Product and ProductField enum