-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
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
Generate schema.graphql without running the server #291
Comments
Take a look at https://graphql-code-generator.com :) |
Thanks but graphql-code-generator generates code from graphql and I need the other way around. Currently, my nest module looks like this: @Module({
imports: [
GraphQLModule.forRoot({
autoSchemaFile: join(process.cwd(), 'apps/api/src/graphql/schema.graphql'),
installSubscriptionHandlers: true,
tracing: true,
debug: true
}),
...other modules
]
}) With this, nestjs/graphql manages to pass all imported modules, containing their own resolvers, to type-graphql for generating a schema.graphql from the code, and that's what I would like to achieve through cli without having to run the entire application |
@matthieudesprez I think it would've been a good idea to mention that you're using |
There is no need to de facto 'run' the server to generate schema file. If you structurize your app properly - as in making separation between bootstrapping from starting the server then there is no issue. My guide: create a There are also other approaches that might work like using DynamicModule for that. |
@marcus-sa nest/graphql uses type-graphql to generate the schema.graphql @arekbal thanks for your advice, the init() will do the trick |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
schema.graphql is only generated when the serving is running
Expected behavior
it would be nice to have a way for generating the schema.graphql from command line
What is the motivation / use case for changing the behavior?
the current behavior causes troubles when merging branches which contain resolver modifications, we have to run the server to update the schema.graphql
The text was updated successfully, but these errors were encountered: