-
-
Notifications
You must be signed in to change notification settings - Fork 565
Add examples + readme #2
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
Comments
Definitely. It's really in pre-release state now. We still explore usage scenarious ourselves and will probably make significant changes to API before first usable release. But if you want to experiment with it, check out tests as usage examples, say: https://github.com/webonyx/graphql-php/blob/master/tests/StarWarsSchema.php |
Added quick README for now. Feel free to open specific issues if something requires additional clarifications in Readme. |
* Added inline fragments support to ResolveInfo * Revert "Added inline fragments support to ResolveInfo" This reverts commit c35379c. * Inline fragments and union type support for QueryPlan * Introduced $options to prevent BC * No more underscores for fragments data * Fixed Scrutinizer * Fixed Scrutinizer #2 * Fixed Scrutinizer #3 * Renamings; merging fields inside fragments * Fixed fields order for merged types * Grouping implementor fields for abstract types
When creating a node visitor that uses more specific types, we get this error: ``` Parameter webonyx#2 $visitor of static method GraphQL\Language\Visitor::visit() expects array<string, array<string, callable(GraphQL\Language\AST\Node): (GraphQL\Language\VisitorOperation|void|false|null)>|(callable(GraphQL\Language\AST\Node): (GraphQL\Language\VisitorOperation|void|false|null))>, array{OperationDefinition: array{enter: Closure(GraphQL\Language\AST\OperationDefinitionNode): void, leave: Closure(): void}, Field: array{enter: Closure(GraphQL\Language\AST\FieldNode): void, leave: Closure(GraphQL\Language\AST\FieldNode): void}, InlineFragment: array{enter: Closure(GraphQL\Language\AST\InlineFragmentNode): void, leave: Closure(GraphQL\Language\AST\InlineFragmentNode): void}, FragmentDefinition: array{enter: Closure(GraphQL\Language\AST\FragmentDefinitionNode): void, leave: Closure(GraphQL\Language\AST\FragmentDefinitionNode): void}, SelectionSet: Closure(GraphQL\Language\AST\SelectionSetNode): void} given. ``` For the following code: ```php $ast = Visitor::visit($ast, [ NodeKind::OPERATION_DEFINITION => [ 'enter' => function (OperationDefinitionNode $node) : void { $this->parents[] = $node->operation; // Remove the operation name as we don't need this $node->name = null; }, 'leave' => function () : void { array_pop($this->parents); }, ], NodeKind::FIELD => [ 'enter' => function (FieldNode $node) : void { $this->parents[] = $node->name->value; }, 'leave' => function (FieldNode $node) : void { array_pop($this->parents); }, ], // ... ``` By changing the signature to `covariant` the problem goes away.
When creating a node visitor that uses more specific types, we get this error: ``` Parameter webonyx#2 $visitor of static method GraphQL\Language\Visitor::visit() expects array<string, array<string, callable(GraphQL\Language\AST\Node): (GraphQL\Language\VisitorOperation|void|false|null)>|(callable(GraphQL\Language\AST\Node): (GraphQL\Language\VisitorOperation|void|false|null))>, array{OperationDefinition: array{enter: Closure(GraphQL\Language\AST\OperationDefinitionNode): void, leave: Closure(): void}, Field: array{enter: Closure(GraphQL\Language\AST\FieldNode): void, leave: Closure(GraphQL\Language\AST\FieldNode): void}, InlineFragment: array{enter: Closure(GraphQL\Language\AST\InlineFragmentNode): void, leave: Closure(GraphQL\Language\AST\InlineFragmentNode): void}, FragmentDefinition: array{enter: Closure(GraphQL\Language\AST\FragmentDefinitionNode): void, leave: Closure(GraphQL\Language\AST\FragmentDefinitionNode): void}, SelectionSet: Closure(GraphQL\Language\AST\SelectionSetNode): void} given. ``` For the following code: ```php $ast = Visitor::visit($ast, [ NodeKind::OPERATION_DEFINITION => [ 'enter' => function (OperationDefinitionNode $node) : void { $this->parents[] = $node->operation; // Remove the operation name as we don't need this $node->name = null; }, 'leave' => function () : void { array_pop($this->parents); }, ], NodeKind::FIELD => [ 'enter' => function (FieldNode $node) : void { $this->parents[] = $node->name->value; }, 'leave' => function (FieldNode $node) : void { array_pop($this->parents); }, ], // ... ``` By changing the signature to `covariant` the problem goes away.
Without more information this project looks interesting but I'm not sure how to even get started. Is this something you're going to be expanding on in the future?
The text was updated successfully, but these errors were encountered: