-
Notifications
You must be signed in to change notification settings - Fork 7
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
✨ NEW: Initial implementation of GraphQL mutations #24
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #24 +/- ##
==========================================
- Coverage 92.09% 91.36% -0.73%
==========================================
Files 25 25
Lines 746 799 +53
==========================================
+ Hits 687 730 +43
- Misses 59 69 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Thanks @chrisjsewell Hm... that does indeed look quite a bit more complicated than simply posting a JSON
|
yes but the point is you get structured schema validation, and control exactly the return data you receive. for You can always just write
what do they have to learn it, its explicitly in the schema: https://aiida-restapi--24.org.readthedocs.build/en/24/user_guide/graphql.html#the-graphql-schema (see |
you can create whatever mutation you want, but again IMO explicit is better than implicit (although note currently the I'm not sure why this would be any different to deciding what POST methods to create though? |
In 4b6005f I have added a skeleton implementation of middleware (see https://docs.graphene-python.org/en/latest/execution/middleware/). This allows you to interject before each query resolution / mutation, to run operations such as authentication. (see also https://www.starlette.io/graphql/#accessing-request-information) |
and my final pitch (lol) is that, as with queries, mutations are fully pluggable |
FYI I added some links to the initial comment |
Thanks for the links to the docs @chrisjsewell It seems this is indeed the canonical way in graphql... Another question that comes to mind here is how to handle files. |
I thought exactly the same thing. Graphene specifically mentions https://pypi.org/project/graphene-file-upload/ but not satisfied on the best approach yet |
@ltalirz @NinadBhat this is a rough initial implementation of the mutation (see https://graphql.org/learn/queries/#mutations and https://docs.graphene-python.org/en/latest/types/mutations/) to create a group, e.g.:
returns: