Details
-
Bug
-
Resolution: Fixed
-
Neutral
-
None
-
None
-
-
Empty show more show less
-
DevX 40
-
3
-
Yes
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.