meilisearch / meilisearch-dart

The Meilisearch API client written for Dart

Home Page:https://meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Discussion] using a modelling library

ahmednfwela opened this issue · comments

Description
the current library behavior relies on generating models manually (including serialization, deserialization, copyWith, etc...)
this is very error prone

Alternatives
we can use build_runner to automatically generate serialization/deserialization bindings, similar to c# using reflection in runtime, instead this being at compile time.

here are some libraries for this:

we can even take it a step further and generate the http bindings via something like

Hi @ahmednfwela

Indeed, if we can automate some checking, it will be amazing.

But I would like to understand the possible pros and cons of adopting such a solution, especially in terms of maintenance and userland breaking changes.
Also, can we implement something like this in small steps, (incrementally) instead of creating a big-bang PR?

all the heavy lifting is done at generation time (before compile time) and at runtime everything is practically the same.

I will create some test PRs to see the best solution

Do you think this subject is still relevant @ahmednfwela?

yes I am testing out this package https://pub.dev/packages/dart_json_mapper which seems like the best candidate for now

Closing this issue now, since we started using json_serializable in the latest version