[MGNLGQL-113] Sort definitions fail if contenttype has no title field Created: 17/Mar/22 Updated: 22/Jun/23 Resolved: 22/Jun/23 |
|
| Status: | Closed |
| Project: | Magnolia GraphQL |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.0, 1.1.3 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Christopher Zimmermann | Assignee: | Valeria Robles-Garzon |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | 3h | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Attachments: |
|
|||||||||||||||||||||||||
| Sub-Tasks: |
|
|||||||||||||||||||||||||
| Template: |
|
|||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
|||||||||||||||||||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
|||||||||||||||||||||||||
| Bug DoR: |
[X]*
Steps to reproduce, expected, and actual results filled
[X]*
Affected version filled
|
|||||||||||||||||||||||||
| Epic Link: | GraphQL Phase 2 | |||||||||||||||||||||||||
| Sprint: | DevX 40 | |||||||||||||||||||||||||
| Story Points: | 3 | |||||||||||||||||||||||||
| Team: | ||||||||||||||||||||||||||
| Work Started: | ||||||||||||||||||||||||||
| Approved: |
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. |