Uploaded image for project: 'Magnolia GraphQL'
  1. Magnolia GraphQL
  2. MGNLGQL-68

Good query names for plural contenttype names like 'authors'

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • None
    • None

    Description

      Steps to reproduce

      1.  Create a contenttype called 'authors'
      2.  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

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                czimmermann Christopher Zimmermann
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:

                  Checklists

                    Bug DoR
                    Task DoD