Skip to content

feat: 1055 - new experimental class "FlexibleProduct" #1056

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

monsieurtanuki
Copy link
Contributor

What

This PR adds flexibility:

  • we can now use "double" API version number, e.g. 3.2
  • we can now extract product data from json on the fly, instead of formatting the json into a Product before anything else

With that PR we can easily accept new product fields and fields changing format, as we can just store the json regardless of the current or future product format.

Fixes bug(s)

Part of

Files

New files:

  • api_get_flexible_product.dart: tests around the new class FlexibleProduct.
  • flexible_map.dart: (experimental) helper class around json and maps.
  • flexible_product.dart: (experimental) Product without predefined structure, relying mainly on the json.
  • flexible_product_result.dart: (experimental) API answer from a call to /api/v???/product/$barcode, in a flexible manner.
  • flexible_search_result.dart: (experimental) API answer from a call product search, in a flexible manner.

Impacted files:

  • language_helper.dart: added 3 experimental methods for FlexibleProduct
  • open_food_api_client.dart: added 2 experimental methods for FlexibleProduct - getFlexibleProductResult and searchFlexibleProducts
  • openfoodfacts.dart: added the new 4 class files
  • product_image.dart: added an experimental method to compute the image URLs
  • product_query_configurations.dart: made it possible to call API get product method with a "double" API version number - and not only an "int"
  • product_result_v3.dart: minor refactoring
  • product_result_v3.g.dart: generated

New files:
* `api_get_flexible_product.dart`: tests around the new class `FlexibleProduct`.
* `flexible_map.dart`: (experimental) helper class around json and maps.
* `flexible_product.dart`: (experimental) Product without predefined structure, relying mainly on the json.
* `flexible_product_result.dart`: (experimental) API answer from a call to /api/v???/product/$barcode, in a flexible manner.
* `flexible_search_result.dart`: (experimental) API answer from a call product search, in a flexible manner.

Impacted files:
* `language_helper.dart`: added 3 experimental methods for `FlexibleProduct`
* `open_food_api_client.dart`: added 2 experimental methods for `FlexibleProduct` - `getFlexibleProductResult` and `searchFlexibleProducts`
* `openfoodfacts.dart`: added the new 4 class files
* `product_image.dart`: added an experimental method to compute the image URLs
* `product_query_configurations.dart`: made it possible to call API get product method with a "double" API version number - and not only an "int"
* `product_result_v3.dart`: minor refactoring
* `product_result_v3.g.dart`: generated
@monsieurtanuki
Copy link
Contributor Author

@teolemon ping

@monsieurtanuki
Copy link
Contributor Author

@teolemon ping

ping

@monsieurtanuki
Copy link
Contributor Author

@teolemon ping

ping

ping

@teolemon
Copy link
Member

Sorry @monsieurtanuki , underwater on non mobile things. I asked for a technical quick look from @PrimaelQuemerais @g123k (who also seem to be a little bit underwater).

@monsieurtanuki
Copy link
Contributor Author

@teolemon For the record it is related to the app, cf. openfoodfacts/smooth-app#6502
I don't know if that's a priority, though.

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

Successfully merging this pull request may close these issues.

Add flexibility to Product according to api version
2 participants