Operator equalTo with boolean value
maxdhn opened this issue · 2 comments
Hi,
First all thanks for this usefull extension.
Since I'm new to GraphQL and PostGraphile, this misunderstood may be du to my lacks of knowledges.
I'm dont really understand how operator equalTo
work with boolean type.
This query :
query GetAllMaterials {
materialsList(filter: { deleted: { equalTo: false } }) {
[...]
}
}
throw a GrapQL error : Empty objects are forbidden in filter argument input.
. It's like the boolean value false
is parsed as a null or empty value.
I've also added Boolean
to connectionFilterAllowedFieldTypes
. I've try the equalTo
with others type than Boolean and it work well. So what's wrong ? It's not the right operator ?
I'm using postgraphile 4.7.0 and postgraphile-plugin-connection-filter 2.0.0 (with codegen for TypeScript)
I'm not able to reproduce this. Can you provide a minimal SQL schema and PostGraphile config that demonstrates the issue?
-- issue_128.sql
drop schema if exists app_public cascade;
create schema app_public;
create table app_public.material (
id integer primary key,
deleted boolean
);
insert into app_public.material (id, deleted) values
(1, true),
(2, false);
createdb issue_128
psql "postgres://localhost:5432/issue_128" -f issue_128.sql
yarn add postgraphile
yarn add postgraphile-plugin-connection-filter
npx postgraphile -c "postgres://localhost:5432/issue_128" -s app_public --append-plugins postgraphile-plugin-connection-filter
query GetAllMaterials {
allMaterials(filter: {deleted: {equalTo: false}}) {
nodes {
id
deleted
}
}
}
{
"data": {
"allMaterials": {
"nodes": [
{
"id": 2,
"deleted": false
}
]
}
}
}
Thank's I found it !
This issue happen when ignoreIndexes
is setted to false
.
Before I start using your plugin, I used the condition
plugin and for testing purpose,
I didn't want to think about which columns need indexes, so i set ignoreIndexes
to false
to enable filtering on any columns.
Enable ignoreIndexes
, fix it... but i don't now why