You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When GraphQL mutation names are generated for nested entries and sections, a collision is possible for _Drafts.
Mutations for Matrix field entry drafts omit the Field segment, meaning they will receive the same name as the mutation for drafts in a section that shares a handle with the field.
Create an entry type named Stop (with handle stop);
Create a section named Tours (with handle tours) and an entry type named Tour (with handle tour) — the naming here is immaterial and doesn’t contribute to the bug… we just need a place to stick the field, semantically;
Create a Matrix field named Stops that uses the Stop entry type, and attach it to the Tour entry type’s field layout;
Create a section named Stops (also with handle stops) that uses the Stop entry type;
(This last step is contrived—most developers are probably not creating deliberately ambiguous content types like this!)
The resulting GraphQL schema would produce these four mutations:
save_stops_stop_Entry — Save a Stop entry to the Stops section
save_stops_stop_Draft — Save a Stop entry draft to the Stops section
save_stopsField_stop_Entry — Save a nested Stop entry into the Stops Matrix field
save_stops_stop_Draft — Save a nested Stop entry into the Stops Matrix field
The second and third _Draft type names are the same! Currently, Craft appears to only acknowledge the latter (or… whichever one is created second?)
Craft CMS version
5.0.0+
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered:
What happened?
When GraphQL mutation names are generated for nested entries and sections, a collision is possible for
_Draft
s.Mutations for Matrix field entry drafts omit the
Field
segment, meaning they will receive the same name as the mutation for drafts in a section that shares a handle with the field.https://github.com/craftcms/cms/blob/5.x/src/gql/mutations/Entry.php#L285
Steps to Reproduce
stop
);tours
) and an entry type named Tour (with handletour
) — the naming here is immaterial and doesn’t contribute to the bug… we just need a place to stick the field, semantically;stops
) that uses the Stop entry type;(This last step is contrived—most developers are probably not creating deliberately ambiguous content types like this!)
The resulting GraphQL schema would produce these four mutations:
save_stops_stop_Entry
— Save a Stop entry to the Stops sectionsave_stops_stop_Draft
— Save a Stop entry draft to the Stops sectionsave_stopsField_stop_Entry
— Save a nested Stop entry into the Stops Matrix fieldsave_stops_stop_Draft
— Save a nested Stop entry into the Stops Matrix fieldThe second and third
_Draft
type names are the same! Currently, Craft appears to only acknowledge the latter (or… whichever one is created second?)Craft CMS version
5.0.0+
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered: