Skip to content

Fix annotation for non-nullable array of non-nullable values as query argument #806

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

Conversation

gordinskiy
Copy link
Contributor

@gordinskiy gordinskiy commented Jan 11, 2021

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
RFC? yes
Version 0.13.5

When i use annotation to map argument as "Non-nullable array of non-nullable values" the scheme is built correctly. But i got error during query execution:

GraphQL\Error\InvariantViolation: Type loader is expected to return type "Int!", but it returned ""[0]

Example of mapping:

/**
 * @GQL\Query(type="[Order]", name="order",
 *     args={
 *         @GQL\Arg(name="orderIds", type="[Int!]!"),
 *     }
 * )
 */
public function getOrders(array $orderIds): Promise
{
    ...
}

@Vincz
Copy link
Collaborator

Vincz commented Jan 11, 2021

Hey @dmitry-hordinsky! Good catch! Would you mind to add a test for this please?

@gordinskiy gordinskiy force-pushed the hotfix/annotation-for-non-nullable-array-of-non-nullable-elements branch from 5f3e157 to 1079c7e Compare January 11, 2021 21:08
@gordinskiy
Copy link
Contributor Author

@Vincz added some tests for updated fragment.

@gordinskiy gordinskiy force-pushed the hotfix/annotation-for-non-nullable-array-of-non-nullable-elements branch from 3236d3b to 8c5a472 Compare January 12, 2021 00:18
@Vincz
Copy link
Collaborator

Vincz commented Jan 12, 2021

Thank you @dmitry-hordinsky !

@Vincz Vincz merged commit e143f5d into overblog:master Jan 12, 2021
@mcg-web
Copy link
Contributor

mcg-web commented Jan 12, 2021

@Vincz should we also patch from 0.12 ?

@Vincz
Copy link
Collaborator

Vincz commented Jan 12, 2021

Hey @mcg-web :-) Yes, you can. It fixes the Arguments Transformer without any BC.

@mcg-web
Copy link
Contributor

mcg-web commented Jan 13, 2021

Thanks @Vincz for your answer, we should patch from the lower maintained version branch where the bug was introduce (0.12 in this case). We always merge branches from the older version to the newest (0.11 -> 0.12 -> 0.13 -> ... -> master). so patch will be automatically apply to other newest versions using this flow. I'll add a note about this in contributing file.

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.

3 participants