Details
-
Bug
-
Resolution: Unresolved
-
Neutral
-
None
-
None
-
None
Description
Steps to reproduce
- Create a contenttype called 'authors'
- Try to use a GraphQL query for an 'author' by path.
{
author(path: "/My-Good-Authors/Charles-Darwin") {
name
}
}
Expected results
It works.
Actual results
Get an error:
Validation error of type FieldUndefined: Field 'author' in type 'Query' is undefined @ 'author'"
Workaround
Change contenttype names to be singular.
Development notes
Magnolia GraphQL creates two queries by default, one for single items and one for multiple items.
Currently it assumes that the contenttype name is singular and so it uses that name for the single query and it uses a library to 'pluralize' the contenttype name for the multiple items.
So with contenttype name "authors" the two queries are:
singluar: "authors"
plural: "authorses"
Recommendation
In Magnolia, contenttype names are not enforced to be singluar or plural, but singular is the soft convention GraphQL should behave best based on that convention, as it does now.
However we should not force any projects who have used a plural name for their content type to change it. So it should be possible to somehow configure the system whether the contenttype name is singular or plural - or maybe best - simply allow developers to specify the name of the two queries if they want to. (for example to handle a contentTyp name like "news")
Idea:
Could the system detect whether the contenttype name is singluar or plural - and take appropriate action based on that?
Checklists
Attachments
Issue Links
- is related to
-
MGNLCT-169 DOC: Document that contenttype names should be singular
-
- Closed
-