Apply schema manipulation on input field definitions
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.5k
- Forks
- 468
- Avg merge
- 3h 9m
- Merged PRs (30d)
- 2
Description
What problem does this feature proposal attempt to solve?
Lighthouse applies a process we call schema manipulation for some directives, allowing them to transform the GraphQL AST: https://github.com/nuwave/lighthouse/blob/301930b356faa63da681d564cbef41c7d312f2aa/src/Schema/AST/ASTBuilder.php#L133-L137
The directives @whereConditions and @orderBy implement the ArgManipulator interface. This is only called when they are defined directly on the args of a field.
While there is a directive interface for definitions that are directly applied on types (e.g. input Foo @example), we currently have no mechanism for traversing down into the fields of input types and apply transformation there.
Which possible solutions should be considered?
An implementation for this would entail:
- Adding a new interface
InputFieldManipulator - Add a method to
ASTBuilderthat applies it toinputfields - Implement the interface for the
ArgManipulatordirectives where it makes sense
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading ASTBuilder.php around the existing schema-manipulation logic and the ArgManipulator contract. Trace how @whereConditions and @orderBy are handled when placed on field arguments, then determine how equivalent traversal should reach input fields. Done means the new InputFieldManipulator mechanism exists and applicable ArgManipulator directives use it where appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, php
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100