-
Notifications
You must be signed in to change notification settings - Fork 118
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
Nullable list generated as an empty list #219
Comments
This is likely caused by google/built_value.dart#1049 which I believe was resolved in v8.1.0. We may need to use the new PRs welcome. |
@smkhalsa I was looking into this issue to potentially make a PR. If we use serializeNulls without nothing else, I'm afraid the JSON output will have all the nullable fields without value set to null. However, I would like to only set the ones I chose to null (the others should not appear in the JSON). I know that drift has a class Value which they use to differentiate between:
Would it be ok with you if I do the same? However, this may introduce a breaking change because this code: final reviewsReq = GReviewsReq((b) => b.vars.first = 10); will become: final reviewsReq = GReviewsReq((b) => b.vars.first = Value(10)); if Is that ok with you? Or do you see an alternative? |
I'd rather avoid this. Is the issue of absent vs nullable only present when converting to JSON? |
I think so. At least for my use case and I believe the one of the issue. |
The original issue relates to the Dart classes allowing lists with null values. |
Mmm I thought the original issue was to be able to not set |
Does built_value's own internal representation of the data distinguish between null and absent? |
I don't think so. I've made a sample repo: https://github.com/GP4cK/built_value_absent |
Basically whether you set |
I also created an issue on built_value's repo: google/built_value.dart#1123 |
Hello,
One of my GraphQL types has two fields that can either be null or non-empty lists (
in
andnotIn
in the screenshot):My issue is the fact that, in the type generated by Ferry, those fields are not nullable but instead created as empty lists:
This causes errors in my backend, as empty lists are not expected there.
I have created an example in this repo:
https://github.com/TanguyChevillardNovade/FerryEmptyList
Is this a bug, or did I forget to add something in one of the GraphQL files?
The text was updated successfully, but these errors were encountered: