[BUG] Cannot use nested filters out of the box
PedroD opened this issue · 2 comments
PedroD commented
I have seen that we can either use filters in the root of a query, or nest them, as illustrated in the README:
However, when I try to use the nested filters, it says that the syntax is not valid.
This is how I setup my test environment for this:
Within the same folder I have this Dockerfile:
FROM node:alpine
LABEL description="Instant high-performance GraphQL API for your PostgreSQL database https://github.com/graphile/postgraphile"
# Install PostGraphile and PostGraphile connection filter plugin
RUN npm install -g postgraphile
RUN npm install -g postgraphile-plugin-connection-filter
RUN npm install -g graphile-build-pg @graphile-contrib/pg-many-to-many
ADD .postgraphilerc.js .postgraphilerc.js
EXPOSE 5000
ENTRYPOINT ["postgraphile", "-n", "0.0.0.0"]
Then my .postgraphilerc.js:
module.exports = {
options: {
connection: "postgres://postgres:test@host.docker.internal:5432/conso", // Put here your test DB credentials
schema: ["public"],
port: 5000,
watch: true,
appendPlugins: "postgraphile-plugin-connection-filter,@graphile-contrib/pg-many-to-many",
disableDefaultMutations: true,
graphileBuildOptions: {
connectionFilterRelations: true, // default: false
connectionFilterComputedColumns:true
},
},
};
Then my docker-compose.yml
version: "3.3"
services:
graphql_pgsql:
container_name: graphql_pgsql
restart: always
image: graphql_pgsql
build: .
ports:
- 5000:5000
So, for this two tables:
If I try:
{
allMarkFors{
nodes{
markForPartnerByMarkForPartnerId(filter:{
name: {
startsWith: "Maria"
}
}) {
id
name
}
}
}
}
I will get as a result:
{
"errors": [
{
"message": "Unknown argument \"filter\" on field \"markForPartnerByMarkForPartnerId\" of type \"MarkFor\".",
"locations": [
{
"line": 4,
"column": 38
}
]
}
]
}
mattbretl commented
This is caused by using an invalid appendPlugins
syntax, as described here: #141 (comment)
mattbretl commented
[semi-automated message] I'm going to close this issue because it's not a bug in the plugin, but please feel free to continue the conversation below. 🙂