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

Sort definitions fail if contenttype has no title field

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 2.0.0, 1.1.3
    • None
    • None

    Description

      When the contenttype has no 'enumerable' property, like a string, then the autogenerted graphQL 'sort' type for that congenttype gives an error, and the type cannot be used in GraphQL

      Please see attached definition file for example of definition that does not work.

      To reproduce:

      Start a DXCore with GraphQL module installed. (for example dxcore-demo webaapp)

      Put the attached navigations.yaml file in a light module 'contentTypes' directory.

      Open GraphQL app, this exception is written to log.

      2022-03-17 12:06:48,191 ERROR info.magnolia.graphql.core.http.GraphQLServlet    : Failed to execute the GraphQL query
      graphql.schema.validation.InvalidSchemaException: invalid schema:
      Enum type "NavigationSort" must define one or more enum values.
      	at graphql.schema.GraphQLSchema$Builder.buildImpl(GraphQLSchema.java:647) ~[graphql-java-16.2.jar:?] 

      It probably causes errors in other attempted usages of the graphQL type. For exaample "introspection" fails.

      Adding a simple "test" String property fixes the problem.

      Expectation

      I would expect that the graphql endpoint is still usaable even if there is no non-enumerable property.

      I would expect that 'name' property would always be availble for sorting.

      I would expect a more clear exception message - like "Navigation contentType must have at least one property that is enumerable, such as a String.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              vrg Valeria Robles-Garzon
              czimmermann Christopher Zimmermann
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Work Started:

                Checklists

                  Bug DoR
                  Task DoD

                  Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 3h
                    3h