Closed bfelbo closed 1 year ago
Hi! Could you please provide a bit more details about the project structure and config files you have?
Sure! Here's our full config file:
{
"projects": {
"api": {
"schemaPath": "build/postgraphile_schema.graphql",
"excludes": ["src/api/plugins/**"]
}
}
}
We only have a single schema and it's fully specified in build/postgraphile_schema.graphql
. Since the GraphQL schema is specified through our DB and JS code, the code inside src/api/plugins/**
has duplicate GraphQL schema definitions to the fully-exported schema in build/postgraphile_schema.graphql
.
Both src
and build
are on the same level in the FS, and the .graphqlconfig is also in the same folder?
I mean does it have this structure or something more complicated?
/root
/build
/src
.graphqlconfig
And also, could you please try to write a configuration file that way first (without projects):
{
"schemaPath": "build/postgraphile_schema.graphql",
"excludes": [
"src/api/plugins/**"
]
}
and next
{
"schemaPath": "build/postgraphile_schema.graphql",
"excludes": [
"./src/api/plugins/**"
]
}
Does it prevent type conflicts?
Both src and build are on the same level in the FS, and the .graphqlconfig is also in the same folder? mean does it have this structure or something more complicated?
Yes, that's the structure.
Thanks for providing those configs. However, they don't seem to work. See screenshot below, especially the message saying The .graphqlconfig associated with this file does not include it. Schema discovery and language tooling will use entire project.
Facing similar issues. Is there any update on this?
Same here, schemaPath
seems to be completly ignored and all graphql schema files in any subfolder of the directory containing the .graphqlconfig
file are read.
What seems to work 🙏:
schemaPath
set to the location of my schema file (file ending .graphqls
) includes
to include only .graphql
files (no .graphqls
) {
"name": "Publy WS Backend",
"schemaPath": "./publy-backend/src/main/resources/graphql/publy.graphqls",
"includes": ["./**/*.graphql"]
}
Describe the bug We use the popular PostGraphile library to export our GraphQL schema. As such, our exported GraphQL schema is our source of truth.
PostGraphile generates the GraphQL schema through a combination of Postgres DB schema and JS code extending the schema. These GraphQL schema extensions defined in JS are part of the exported schema. However, despite marking these plugins as
excludes
(e.g."excludes": ["src/api/plugins/**"]
), they're still included in schema discovery, thereby causingtype tried to redefine field
errors.Expected behavior Any files in
excludes
should not be included in schema discovery.