-
Notifications
You must be signed in to change notification settings - Fork 221
Description
| Q | A |
|---|---|
| Bug report? | yes |
| Feature request? | no |
| BC Break report? | yes |
| Version/Branch | 0.13.2 |
When using annotations, if we found a multiple relation with doctrine (OneToMany or ManyToMany), we generate a non null multiple (like: [Friends]!). It means that the field will always be an array (but it can be empty). So we have a Type::nonNull field.
If we have an access on this field, like @=isGranted() and we query for this field without being allowed, it will return a null value for the entire object instead of just for this fields itself (I haven't been able to really trace the problem, but I think it is in webonyx/graphql).
There is multiple ways to solve this problem.
- Generate nullable type instead of non nullable type
- Detect if we have an "access" on a field and if the field is "multiple", remove the non nullable
- Try to detect the case in the request handling and return an empty array instead of a null value
Personally, I would prefer the second one as if we have a field with an access, we are supposed to be able to return null for this field.
What do you think about this guys ?
ping @mcg-web @murtukov @akomm ?
I make a PR.