- Issue created by @Stuart_Wilkes_Wellcome
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
So in summary,
if you have a mix/match of entities where the user has/hasnt access, on an entity reference, and its required, its goin' all weird.Ok, I'll take a look!
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
I guess the issue could be the field is "required" in the GraphQL sense. It expects a result. If you don't give it a result possible scenario, its gonna end up throwing an error.
So i suppose you need an override to allow your field to remain required but to change your GraphQL to not be required.
In your settings.php you could slide this in via:
$config['graphql_compose.settings']['field_config']['paragraph']['YOUR_PARAGRAPH_TYPE']['FIELD_YOUR_FIELD_NAME']['required'] = FALSE;
Does this approach work for you?
Things! can never be null
[Things]! can be []
[Things!]! can be []
I can relax the error on multiple fields, but not single fields.
- Merge request !56Issue #3408161 by almunnings, Stuart_Wilkes_Wellcome: Entity references to archived nodes causing errors and null responses → (Merged) created by almunnings
- Status changed to Needs review
11 months ago 5:20am 16 December 2023 - 🇦🇺Australia almunnings Melbourne, 🇦🇺
Theres a patch attached to the MR that reduces the error for multiple fields.
It's kind of up to you on that required field config though.The next step on this would be to make that `required` options part of schema
Ah great thanks - that does indeed fix the issue for us!
-
almunnings →
committed 78a6d11e on 2.1.x
Issue #3408161 by almunnings, Stuart_Wilkes_Wellcome: Entity references...
-
almunnings →
committed 78a6d11e on 2.1.x
- Status changed to Fixed
11 months ago 9:57am 4 January 2024 Automatically closed - issue fixed for 2 weeks with no activity.
- 🇧🇪Belgium cedricl
I provided a patch so you don't have to put things in the settings file like this $config['graphql_compose.settings']['field_config']['paragraph']['YOUR_PARAGRAPH_TYPE']['FIELD_YOUR_FIELD_NAME']['required'] = FALSE;
But now you can do it the schema configurer, i've added a checkbox required which by default is set the same as the settings of your field. But you can override it and make that field not required for the schema in GraphQL.When saving it, the required value gets added to the config.
Not sure if this breaks anything else, but for our use case i haven't seen it breaking something. Should be tested and reviewed