This repository was archived by the owner on Sep 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
Input object argument format for mutation API #531
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
now used by both the normal and experimental augmentation tests
This was referenced Nov 1, 2020
Codecov Report
|
#524: unified the translation of nested orderBy arguments for relationship fields into translateNestedOrderingArgument, fixed schemaType argument to be innerSchemaType, for call in relationFieldOnNodeType #495: uses parentIsListArgument to buildNeo4jTypeTranslation, to appropriately translate temporal filters used within OR / AND list filters
this results in letting the cypher error pass through, caused by datetime(""), if an empty string is provided for a .formatted argument
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Experimental Mutation API
This PR adds initial support for generating input object arguments for node and relationship mutations. A documentation update preview is available at: https://deploy-preview-59--distracted-golick-08ed24.netlify.app/docs/graphql-schema-generation-augmentation#experimental-api.
To prevent breaking changes moving forward, the new API is available under this configuration flag:
Example schema
In the below schema, we have a
Usertype and aMovietype. Each has an@idfield along with at least one other@uniqueor@indexfield:Node mutations
In the new mutation API design, the following node mutations are generated for the
Usertype:The
_UserWhereinput object is generated for node selection, containing the same arguments geneated forfilterin the query API, for all@id,@unique, and@indexfields on theUsertype:The
_UserDatainput object is generated for providing property values when creating, updating, or merging aUsertype node:Relationship mutations
These
Whereinput objects with complex filtering arguments are also used by relationship mutations to select source and target nodes. The following relationship field mutations are generated for theUsertype:Using multiple keys
In alignment with the "Input object arguments" sub-section of the "Future design considerations" section in PR #499, initial behavior is to use all
@id,@unique, and@indexfields on a node type when generating its correspondingwhereargument input object. When using assertSchema to set property indexes and uniqueness constraints, this should provide a way to ensure that available complex node selection arguments are performant.Merge node mutations
Because the Cypher
MERGEclause cannot be combined withWHERE, complex filtering arguments (_not,_in, etc.) are not generated for thewhereinput objects used by merge node mutations. But multiple keys can still be used. So, merge mutationwhereinput objects contain arguments for any@id,@unique, and@indexfields, with no additional custom filters added.For the below
MergeUsermutation:The
_UserKeysinput objects is generated specifically for it:Tests
Tests for experimental API have been added to test/unit/experimental:
Augmentation
Translation
Node
Relationship
This should resolve #516.
This PR also fixes #495 and fixes #524.