You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I have a strange bug, which i am not Sure is Laravel unique, or an API-Platform issue or a graphql-php issue. To reproduce you should have the following setup:
Laravel API-Platform with graphql enabled
A Model with custom graphqlOperations, one of it beeing a custom parameter for a query collection (orderFilter - provided with this package):
I have applied those to my model called "Tenant". If i now visit the /api/graphql endpoint of my application to test it out, i can try that query:
( This query is schematically correct, and validated correctly by the UI)
However this will give me the following "funny" error, saying that "orderTenantcollection_query" is not a known type, and if i meant "orderTenantcollection_query" (the same lol):
To check why i checked the KnownTypeNames.php file of the graphql-php library. There is a check for $schema !== null && $schema->hasType($typeName) which resolves to false hence generating the error. However to generate the error message graphql-php get's a list of all possible types by calling $schema->getTypeMap() which will fully load all types (According to the function documentation this is not for production use since it does a full schema scan) and "orderTenantcollection_query" will be included there. A check for $schema !== null && $schema->hasType($typeName) after this would resolve to true then.
I have no idea, why graphql-php does not try again after a full scan (possibly performance issues) or where the exact problem lies here - hence i do not know how to fix it. (maybe api-platform uses / can use a typeLoader in the schema class, maybe something else does need to be specified). Maybe someone here with more insight knows what the problem is.
The text was updated successfully, but these errors were encountered:
API Platform version(s) affected: 4.0.4
Description
I have a strange bug, which i am not Sure is Laravel unique, or an API-Platform issue or a graphql-php issue. To reproduce you should have the following setup:
I have applied those to my model called "Tenant". If i now visit the
/api/graphql
endpoint of my application to test it out, i can try that query:( This query is schematically correct, and validated correctly by the UI)
However this will give me the following "funny" error, saying that "orderTenantcollection_query" is not a known type, and if i meant "orderTenantcollection_query" (the same lol):
To check why i checked the
KnownTypeNames.php
file of the graphql-php library. There is a check for$schema !== null && $schema->hasType($typeName)
which resolves to false hence generating the error. However to generate the error message graphql-php get's a list of all possible types by calling$schema->getTypeMap()
which will fully load all types (According to the function documentation this is not for production use since it does a full schema scan) and "orderTenantcollection_query" will be included there. A check for$schema !== null && $schema->hasType($typeName)
after this would resolve totrue
then.I have no idea, why graphql-php does not try again after a full scan (possibly performance issues) or where the exact problem lies here - hence i do not know how to fix it. (maybe api-platform uses / can use a
typeLoader
in the schema class, maybe something else does need to be specified). Maybe someone here with more insight knows what the problem is.The text was updated successfully, but these errors were encountered: