Skip to content
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

Compose complex input arguments through nested arg resolvers #899

Merged
merged 81 commits into from
Dec 20, 2019

Conversation

spawnia
Copy link
Collaborator

@spawnia spawnia commented Aug 6, 2019

  • Added or updated tests
  • Added Docs for all relevant versions
  • Updated the changelog

Related Issue/Intent

Resolves #725
Resolves #1038

Changes

The basic idea behind this is to allow complex nested input to be resolved in a composable fashion, similar to how field resolvers work.

Field arguments may have a resolver attached to them which gets then called with the corresponding slice of the given inputs. It runs after the parent resolver.

Added the capability to run the following directives as nested argument resolvers:

  • @create
  • @update
  • @upsert
  • @delete

This also adds the @nest argument resolver, which is basically a no-op resolver, used to contain multiple other nested argument resolvers in a single input object.

Breaking changes

No, but let's test this one thoroughly before releasing it.

The MutationExecutor was split up into separate nested argument resolvers under the hood, but works just like before for application developers.

@spawnia spawnia mentioned this pull request Oct 10, 2019
3 tasks
# Conflicts:
#	src/Execution/Arguments/TypedArgs.php
#	src/Schema/Factories/ArgumentFactory.php
#	src/Schema/Factories/FieldFactory.php
#	tests/Unit/Execution/Arguments/TypedArgsTest.php
# Conflicts:
#	_ide_helper.php
#	src/Schema/Directives/CreateDirective.php
#	src/Schema/Factories/FieldFactory.php
@spawnia spawnia changed the title WIP: Composable input arguments Compose complex input arguments through nested arg resolvers Dec 13, 2019
@spawnia
Copy link
Collaborator Author

spawnia commented Dec 20, 2019

After dog-fooding this PR for a few weeks and giving it some final polish, this feature is finally ready. I am excited for people to try it, it has allowed us to compose functionality and DRY up a lot of extra code.

@spawnia spawnia merged commit 663c633 into master Dec 20, 2019
@spawnia spawnia deleted the composable-input-arguments branch December 20, 2019 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow update related models on create mutation Add a composable, extendable mechanism for nested mutations
2 participants