graphql-code-generator
graphql-code-generator copied to clipboard
Support custom schema loader options
Is your feature request related to a problem? Please describe.
I want to create a custom schema loader, where I first pre-filter and prune schema before generating code files
However currently the only option - is to give a string with the loader name
So what I miss now - is the ability to give custom options, for example array of types to filter or whatever I want.
In the documentation example is recommended to read config from the loader - however i just thought that would be convenient to keep all in one place
Describe the solution you'd like
I'd like to use something like this:
const config: CodegenConfig = {
overwrite: true,
schema: {
"https://gitlab.com/api/graphql": {
loader: './schema-loader.ts',
// here we define a custom config
config: {
filterQueries: ['project']
}
}
},
...
}
};
export default config;
Alternatively and is probably even better would be option to give the instance of the loader. In this case we can inititalize it before.
If we have already option to provide the instance for document transformation - why not to introduce something to transform the schema, or at least to load it with a code.
Describe alternatives you've considered
No response
Any additional important details?
No response