-
Notifications
You must be signed in to change notification settings - Fork 111
Root type name changes & query provider API changes #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Renaming the root query and mutation types from "query" and "mutation" to "Query" and "Mutation" to follow object type naming conventions - Modified the GraphQLQueryProvider implementation to make the old API deprecated and replace with a collection of field definitions, making this aligned with the GraphQLMutationProvider interface. This makes it possible to define data fetcher for the root object type fields. - Added JavaDoc documentation to the GraphQLQueryProvider interface
|
Here's an example of usage of the new GraphQLQueryProvider.getQueryFieldDefinitions method : https://github.com/sergehuber/contextserver-graphql-api/blob/master/java/bundles/graphql-impl/src/main/java/org/oasis_open/contextserver/graphql/CXSGraphQLProvider.java |
|
I'm all for making the query provider return a list of fields instead of objects - this was one of the most glaring usability issues with it. I wouldn't worry about deprecating anything, this project is so young we can just make some breaking changes and release it as a new major version. |
| * @deprecated use query field definitions instead | ||
| * @return a GraphQL object type to add to the root query type | ||
| */ | ||
| default GraphQLObjectType getQuery() { return null; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per my comment, I don't think there's much need to preserve this as deprecated right now. Once this is removed I'll merge this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll make the changes then, I'll remove all the deprecated methods. I'll let you know when I've pushed the changes.
- Modify tests to use new field definition method
|
Ok I've pushed a new version that removes the old methods, and I've also modified the automated tests to make sure they use the new API. Travis build has executed successfully. Let me know if you want any more changes. |
|
Ok I've done one last change, renamed the method from getQueryFieldDefinitions to getQueries so that it's consistent with the getMutations method of the Mutation provider. I'm not too convinced about this naming scheme but I haven't found a better one :) |
|
Awesome, thanks! |
|
This is released in |
|
Thanks Andrew for doing this so fast ! |
Hello,
I'd like to propose the following changes:
I think these changes would make the exposed GraphQL API a lot cleaner and also a lot more flexible. The inability to use data fetchers on the fields or list types in the root object types is a very strong limitation.
If these changes are approved I'd be willing to update the README to give some more documentation on how to use the new API.
In order to keep the API compatible, all the methods in the GraphQLQueryProvider are now optional, but over time we should change this to remove the methods now marked as deprecated.
The name change for the root object types should not have major impacts, these are just types names but they should be noted as well. Btw I noticed that the SimpleGraphQLServlet also uses a capitalized "Mutation" type so this is consistent with these changes.