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

refactor!: 658 - api version is now required for barcode and search queries #667

Merged
merged 3 commits into from
Jan 1, 2023

Conversation

monsieurtanuki
Copy link
Contributor

Impacted files:

  • api_get_to_be_completed_products_test.dart: minor refactoring
  • api_matched_product_v2_test.dart: minor refactoring
  • api_search_products_test.dart: added version
  • open_food_api_client.dart: api version is now required for getProductFreshness
  • product_query_configurations.dart: api version is now required for ProductQueryConfiguration; deprecated version 0, (1) and 2
  • product_search_query_configuration.dart: api version is now required for ProductSearchQueryConfiguration

What

  • It became embarrassing not to ask explictly for the api version and setting default versions instead: should we have different api versions for different methods? Should we upgrade the versions without notifying the user?
  • A solution, implemented here, was to make the version a required field for barcode and search queries in off-dart.

Fixes bug(s)

…ueries

Impacted files:
* `api_get_to_be_completed_products_test.dart`: minor refactoring
* `api_matched_product_v2_test.dart`: minor refactoring
* `api_search_products_test.dart`: added version
* `open_food_api_client.dart`: api version is now required for `getProductFreshness`
* `product_query_configurations.dart`: api version is now required for `ProductQueryConfiguration`; deprecated version 0, (1) and 2
* `product_search_query_configuration.dart`: api version is now required for `ProductSearchQueryConfiguration`
@teolemon
Copy link
Member

❌ test/api_search_products_test.dart: OpenFoodAPIClient search products with/without allergens check products without allergens (failed)
Expected: a value greater than <0>
Actual: <0>
Which: is not a value greater than <0>

package:test_api expect
test/api_search_products_test.dart 934:9 main..

@codecov-commenter
Copy link

codecov-commenter commented Dec 31, 2022

Codecov Report

Merging #667 (1570a45) into master (b6379ce) will decrease coverage by 0.27%.
The diff coverage is 97.10%.

@@            Coverage Diff             @@
##           master     #667      +/-   ##
==========================================
- Coverage   76.68%   76.40%   -0.28%     
==========================================
  Files         195      195              
  Lines        7008     7058      +50     
==========================================
+ Hits         5374     5393      +19     
- Misses       1634     1665      +31     
Impacted Files Coverage Δ
lib/src/model/parameter/tag_filter.dart 63.63% <ø> (ø)
lib/src/model/product.dart 77.53% <ø> (ø)
lib/src/model/product_packaging.dart 62.50% <ø> (ø)
lib/src/utils/product_fields.dart 66.66% <ø> (ø)
lib/src/utils/product_query_configurations.dart 76.19% <ø> (ø)
.../src/utils/product_search_query_configuration.dart 66.66% <ø> (ø)
...utils/user_product_search_query_configuration.dart 0.00% <ø> (-96.78%) ⬇️
test/api_get_to_be_completed_products_test.dart 96.96% <ø> (ø)
test/api_matched_product_v2_test.dart 100.00% <ø> (ø)
lib/src/open_food_api_client.dart 69.15% <75.00%> (+0.09%) ⬆️
... and 7 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@monsieurtanuki
Copy link
Contributor Author

❌ test/api_search_products_test.dart: OpenFoodAPIClient search products with/without allergens check products without allergens (failed) Expected: a value greater than <0> Actual: <0> Which: is not a value greater than <0>

package:test_api expect test/api_search_products_test.dart 934:9 main..

It looks like there was a problem on the PROD server at that time.

@monsieurtanuki monsieurtanuki merged commit c7f3b1d into openfoodfacts:master Jan 1, 2023
@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon!
I think we're ready for version 2.0.0 as a bundle of breaking changes.
I'll create v2.0.0 tomorrow morning.

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.

OpenFoodAPIClient.getProductV3 status is int not String?
3 participants