Change default Relay input m2m types from ListInput[NodeInputPartial]
to ListInput[NodeInput]
#630
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.
Description
The default Relay input field type for a
ManyToManyField
orManyToManyRel
marked withstrawberry.auto
isListInput[NodeInputPartial]
.This means the following is allowed in mutations:
I can't think of a scenario where allowing
{"id": null}
would be the expected / desired behaviour (at least by default), and it causes some weird errors in the default CUD mutations. Foradd
/set
/remove
it seems appropriate that the"id"
Global ID field should be required by default.This PR changes the default Relay input type for
ManyToManyField
andManyToManyRel
fromListInput[NodeInputPartial]
toListInput[NodeInput]
so that the above is no longer possible.For reference, this seems to match the non-Relay behaviour of
ManyToManyInput
, which doesn't allownull
for its IDs.The unit tests all still pass with this change, but if this actually isn't a bug then I'm happy to close this PR.
Types of Changes
Issues Fixed or Closed by This PR
Checklist
Summary by Sourcery
Update the default input type for ManyToManyField and ManyToManyRel in Relay to require non-null IDs, aligning with non-Relay behavior and preventing unexpected errors in CUD mutations.
Bug Fixes: