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

Feature Request: Adding toJson methods to DTOs #372

Open
hasimyerlikaya opened this issue Dec 11, 2024 · 4 comments
Open

Feature Request: Adding toJson methods to DTOs #372

hasimyerlikaya opened this issue Dec 11, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@hasimyerlikaya
Copy link

Hi,

I saw that toJson methods are disabled for DTOs.
I don't know why you decided this, but it would be better if you added toJson methods too.

I was debugging with breakpoints, and at one point I decided to print the entitlement response to the console to do better and faster debugging. I realize that there is no toJson method for entitlement.dart.

In some cases we might need to store the conversion responses to our databases. ToJson methods would be helpful for that too.

Can I add toJson methods to DTOs?

@SpertsyanKM
Copy link
Contributor

Hi @hasimyerlikaya,

We were looking into implementing toJson and fromJson methods for internal use, aiming to facilitate data transfer to native code and to parse responses from it. I appreciate your interest in these methods as well. I’ll bring this up with the team, and we’ll look to incorporate this enhancement if there are no obstacles.

@SpertsyanKM SpertsyanKM added the enhancement New feature or request label Dec 11, 2024
@hasimyerlikaya
Copy link
Author

In fact, you already support fromJson methods.
For some reason, the functionality for creating the toJson method has been disabled.

Thank you for your interest.

image

@SpertsyanKM
Copy link
Contributor

Yes, we’ve implemented this for all entities that can be parsed from native bridges, but not for everything. The toJson methods have only been added for those that are transferred to native bridges.

If we decide to make both methods publicly available, we’ll include them for all entities. However, I foresee some challenges with this approach regarding changes. Currently, we can modify the keys and content as needed. Making these methods public would mean that any such changes would have to be reserved for major releases.

Anyway, I’ll talk it over with my colleagues first.

@hasimyerlikaya
Copy link
Author

Honestly, I don’t think making changes to all models would be a well-received request. At least for now, it would be sufficient to update only the models that already have a fromJson method. These are the models we are likely to want to store and debug. I’m not sure if we need these methods for all models.

Of course, the team will make the most appropriate decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants