We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
When I search for an empty string using where constraints it seems to treats it as null.
{ assets( count: 10, where: { column: "asset_number", value: "" } ) { paginatorInfo { total } } }
The query returns the following error "Did not receive a value to match the WhereConstraints for column asset_number."
Expected behavior
I Would expect that searching by an empty string would be the same as searching by a non-empty string.
Schema
extend type Query { assets( where: WhereConstraints @whereConstraints ): [Asset!]! @paginate(type: "paginator" model: "App\\Asset") }
Output/Logs
{ "errors": [ { "message": "Did not receive a value to match the WhereConstraints for column asset_number.", "extensions": { "category": "graphql" }, "locations": [ { "line": 2, "column": 3 } ], "path": [ "assets" ], "trace": [ { "file": "/home/adam/Documents/work/aqmdata2/vendor/nuwave/lighthouse/src/Execution/Builder.php", "line": 48, "call": "Nuwave\\Lighthouse\\WhereConstraints\\WhereConstraintsDirective::handleBuilder(instance of Illuminate\\Database\\Eloquent\\Builder, array(3))" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/nuwave/lighthouse/src/Schema/Directives/PaginateDirective.php", "line": 86, "call": "Nuwave\\Lighthouse\\Execution\\Builder::apply(instance of Illuminate\\Database\\Eloquent\\Builder, array(3))" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/nuwave/lighthouse/src/Schema/Factories/FieldFactory.php", "line": 221, "call": "Nuwave\\Lighthouse\\Schema\\Directives\\PaginateDirective::Nuwave\\Lighthouse\\Schema\\Directives\\{closure}(null, array(3), instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 632, "call": "Nuwave\\Lighthouse\\Schema\\Factories\\FieldFactory::Nuwave\\Lighthouse\\Schema\\Factories\\{closure}(null, array(3), instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 555, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, null, instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1247, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Query, null, instance of ArrayObject(1), array(1))" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 257, "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: Query, null, array(0), instance of ArrayObject(1))" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 208, "call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/webonyx/graphql-php/src/Executor/Executor.php", "line": 155, "call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/webonyx/graphql-php/src/GraphQL.php", "line": 165, "call": "GraphQL\\Executor\\Executor::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/webonyx/graphql-php/src/GraphQL.php", "line": 90, "call": "GraphQL\\GraphQL::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, '{\n assets(count: 1000, where: {column: \"asset_number\", operator: EQ, value: \"\"}, station_roles: {calibration_types: {where: {column: \"id\", value: 1}}}) {\n paginatorInfo {\n total\n }\n data {\n id\n serial_number\n id_sku\n sku {\n model_name\n }\n station_roles(count: 100) {\n data {\n id\n get_name\n slug\n }\n }\n station_slots(count: 100) {\n data {\n id\n get_name\n }\n }\n }\n }\n}\n', null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null, array(29))" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/nuwave/lighthouse/src/GraphQL.php", "line": 191, "call": "GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, '{\n assets(count: 1000, where: {column: \"asset_number\", operator: EQ, value: \"\"}, station_roles: {calibration_types: {where: {column: \"id\", value: 1}}}) {\n paginatorInfo {\n total\n }\n data {\n id\n serial_number\n id_sku\n sku {\n model_name\n }\n station_roles(count: 100) {\n data {\n id\n get_name\n slug\n }\n }\n station_slots(count: 100) {\n data {\n id\n get_name\n }\n }\n }\n }\n}\n', null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null, array(29))" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/nuwave/lighthouse/src/GraphQL.php", "line": 130, "call": "Nuwave\\Lighthouse\\GraphQL::executeQuery('{\n assets(count: 1000, where: {column: \"asset_number\", operator: EQ, value: \"\"}, station_roles: {calibration_types: {where: {column: \"id\", value: 1}}}) {\n paginatorInfo {\n total\n }\n data {\n id\n serial_number\n id_sku\n sku {\n model_name\n }\n station_roles(count: 100) {\n data {\n id\n get_name\n slug\n }\n }\n station_slots(count: 100) {\n data {\n id\n get_name\n }\n }\n }\n }\n}\n', instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/nuwave/lighthouse/src/Support/Http/Controllers/GraphQLController.php", "line": 79, "call": "Nuwave\\Lighthouse\\GraphQL::executeRequest(instance of Nuwave\\Lighthouse\\Execution\\LighthouseRequest)" }, { "call": "Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController::query(instance of Nuwave\\Lighthouse\\Execution\\LighthouseRequest)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Controller.php", "line": 54, "function": "call_user_func_array(array(2), array(1))" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php", "line": 45, "call": "Illuminate\\Routing\\Controller::callAction('query', array(1))" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 219, "call": "Illuminate\\Routing\\ControllerDispatcher::dispatch(instance of Illuminate\\Routing\\Route, instance of Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController, 'query')" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 176, "call": "Illuminate\\Routing\\Route::runController()" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 682, "call": "Illuminate\\Routing\\Route::run()" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 30, "call": "Illuminate\\Routing\\Router::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/app/Http/Middleware/SentinelAuth.php", "line": 29, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 163, "call": "App\\Http\\Middleware\\SentinelAuth::handle(instance of Illuminate\\Http\\Request, instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 104, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 684, "call": "Illuminate\\Pipeline\\Pipeline::then(instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 659, "call": "Illuminate\\Routing\\Router::runRouteWithinStack(instance of Illuminate\\Routing\\Route, instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 625, "call": "Illuminate\\Routing\\Router::runRoute(instance of Illuminate\\Http\\Request, instance of Illuminate\\Routing\\Route)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 614, "call": "Illuminate\\Routing\\Router::dispatchToRoute(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 176, "call": "Illuminate\\Routing\\Router::dispatch(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 30, "call": "Illuminate\\Foundation\\Http\\Kernel::Illuminate\\Foundation\\Http\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php", "line": 65, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 163, "call": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar::handle(instance of Illuminate\\Http\\Request, instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php", "line": 75, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 163, "call": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken::handle(instance of Illuminate\\Http\\Request, instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php", "line": 49, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 163, "call": "Illuminate\\View\\Middleware\\ShareErrorsFromSession::handle(instance of Illuminate\\Http\\Request, instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php", "line": 63, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 163, "call": "Illuminate\\Session\\Middleware\\StartSession::handle(instance of Illuminate\\Http\\Request, instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php", "line": 37, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 163, "call": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse::handle(instance of Illuminate\\Http\\Request, instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php", "line": 66, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 163, "call": "Illuminate\\Cookie\\Middleware\\EncryptCookies::handle(instance of Illuminate\\Http\\Request, instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php", "line": 62, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 163, "call": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode::handle(instance of Illuminate\\Http\\Request, instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 104, "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 151, "call": "Illuminate\\Pipeline\\Pipeline::then(instance of Closure)" }, { "file": "/home/adam/Documents/work/aqmdata2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 116, "call": "Illuminate\\Foundation\\Http\\Kernel::sendRequestThroughRouter(instance of Illuminate\\Http\\Request)" }, { "file": "/home/adam/Documents/work/aqmdata2/public/index.php", "line": 51, "call": "Illuminate\\Foundation\\Http\\Kernel::handle(instance of Illuminate\\Http\\Request)" } ] } ], "data": { "assets": null } }
Environment
Lighthouse Version: 3.6 Laravel Version: 5.7 PHP Version: 7.3.5
Additional context
The text was updated successfully, but these errors were encountered:
lighthouse/src/WhereConstraints/WhereConstraintsDirective.php
Line 64 in 1eafde0
isset
Sorry, something went wrong.
Thanks, I'll get working on that
@whereConstraints
Successfully merging a pull request may close this issue.
Describe the bug
When I search for an empty string using where constraints it seems to treats it as null.
The query returns the following error "Did not receive a value to match the WhereConstraints for column asset_number."
Expected behavior
I Would expect that searching by an empty string would be the same as searching by a non-empty string.
Schema
Output/Logs
Click to expand
Environment
Lighthouse Version: 3.6
Laravel Version: 5.7
PHP Version: 7.3.5
Additional context
The text was updated successfully, but these errors were encountered: