Skip to content
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

Merged
merged 4 commits into from Dec 19, 2021

Conversation

M123-dev
Copy link
Member

Fixes: #326

Transfered missing values of Product and ProductField enum

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a 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.

Comment on lines 106 to 108
@JsonKey(name: 'generic_name')
String? genericName;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's that?

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member Author

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',
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On it

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@M123-dev Please add a couple of tests around the initial issue #326:

  • asking for field serving quantity in a getProduct, and getting serving quantity
  • asking for all fields in a getProduct, and getting serving quantity

And we're done :)

@M123-dev
Copy link
Member Author

@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.

@M123-dev M123-dev changed the title Missing product field Fix: Added missing product fields to ProductField enum Dec 18, 2021
Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @M123-dev!
Still, I would have liked an additional test for serving_quantity (read mode).
But that's OK for the moment I guess: I'm adding comments to #291.

Comment on lines +108 to +112
///Common name
///Example: Chocolate bar with milk and hazelnuts
@JsonKey(name: 'generic_name', includeIfNull: false)
String? genericName;

Copy link
Contributor

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? ;)

Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

There is a parameter serving_quantity with no corresponding ProductField
2 participants