-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add initial support for the Folksonomy Engine API #158
Comments
@teolemon I've just tried to use Like a self-contained package. And I don't know how we could integrate that generated code into the existing project.
|
Other aspect to consider: the rest of the off-dart library is based on "json serializable". Another remark: if folksonomy is actually included in the same project, we'd be better off with another dedicated file ( |
I have no issue making it a separate package. How good is the auto-generated code @monsieurtanuki ? |
Hi @teolemon! Anyway, regardless, I can start locally a new project from scratch playing with openapi generator on folksonomy. So far I could not play with the generated code that much because the code was not null safe compliant, which blocked compilation at an early stage. In a new project I'll have more freedom, regarding either the code generation parameters or the null safe status of the whole project. Beyond the raw generated code, we'll probably have to add some fat. Regarding an automated code generation, for the moment I copied the api json file to a local file, and then ran the generation. If we don't access the api json from an URL repeating the same process on the same local input file will result in the same generated files. Work in progress... |
We should somehow be able to generate it automatically, the only question is how good the generated code is. Especially something like null-safety is very important and as @monsieurtanuki pointed out there are some problems regarding that. But yes I also don't think it makes sense to add this to the already big OpenFoodAPIClient. I would suggest that we create a separate package like openfoodfacts-folksonomy-dart and then we can go ahead and reference it from off-dart. Somethink like platform dependet packages do it:
|
Currently enjoying the aftermath of my 3rd dose of vaccine 😖 |
Get well @teolemon, hope you feel better soon, let's just wait and see what @monsieurtanuki thinks of the idea and then we'll see. |
New files: * `api_folksonomy_test.dart`: Tests around folksonomy * `folksonomy.dart`: Client calls of the Folksonomy API (Open Food Facts) * `KeyStats.dart`: Folksonomy: statistics around a tag key. * `ProductList.dart`: Folksonomy: current value for a product and a tag key. * `ProductStats.dart`: Folksonomy: statistics about the tag keys on a product. * `ProductTag.dart`: Folksonomy product tag: for this barcode, that value is set for that key. Impacted files: * `HttpHelper.dart`: added "delete" and "put" requests * `JsonHelper.dart`: added a helper method around timestamps * `OpenFoodAPIConfiguration.dart`: added reference URIs for folksonomy * `openfoodfacts.dart`: exported folksonomy files * `UriHelper.dart`: added a helper method for folksonomy URIs
Hi guys! I hope @teolemon you feel better by now. I've just coded folksonomy client in dart (cf. #332). It was so painful to use openapi generator that I tried to code it myself, and it was so easy that I continued. I don't know that much about folksonomy and I don't know how relevant it would be to make a separate project, regarding the developers that would use it. What I can say is:
Less projects, less maintenance. |
Impacted files: * `api_folksonomy_test.dart`: removed unnecessary imports * `HttpHelper.dart`: rolled back "delete" and "put" requests
Impacted files: * `api_saveProduct_test.dart`: unrelated test fine-tuning
Impacted files: * `api_folksonomy_test.dart`: refactored and added tests * `folksonomy.dart`: fixed side-effects; refactored the comments
New files: * `api_folksonomy_test.dart`: Tests around folksonomy * `api_saveProduct_test.dart`: unrelated test fine-tuning * `folksonomy.dart`: Client calls of the Folksonomy API (Open Food Facts) * `KeyStats.dart`: Folksonomy: statistics around a tag key. * `ProductList.dart`: Folksonomy: current value for a product and a tag key. * `ProductStats.dart`: Folksonomy: statistics about the tag keys on a product. * `ProductTag.dart`: Folksonomy product tag: for this barcode, that value is set for that key. Impacted files: * `JsonHelper.dart`: added a helper method around timestamps * `OpenFoodAPIConfiguration.dart`: added reference URIs for folksonomy * `openfoodfacts.dart`: exported folksonomy files * `UriHelper.dart`: added a helper method for folksonomy URIs
What's left after #332 are the methods around users and their private data, and the write methods. |
I asked in the slack channel |
What
Add initial support for the Folksonomy Engine API (READ/WRITE), which will enable writing and reading custom information on products (like storing taste, franchises, whatever is possible…)
For more general info on the folksonomy engine
https://api.folksonomy.openfoodfacts.org/docs
SDK auto-generation
We can autogenerate a SDK from https://api.folksonomy.openfoodfacts.org/openapi.json
https://medium.com/@rtlsilva/generating-dart-rest-api-client-libraries-using-openapi-generator-9b3dc517e68c
Routes
Screenshot
Part of
The text was updated successfully, but these errors were encountered: