nestjs / graphql

GraphQL (TypeScript) module for Nest framework (node.js) 🍷
https://docs.nestjs.com/graphql/quick-start
MIT License
1.45k stars 391 forks source link

Allow sortSchema via GraphQLDefinitionsFactory #3256

Open olivierlacan opened 1 month ago

olivierlacan commented 1 month ago

Is there an existing issue that is already proposing this?

Is your feature request related to a problem? Please describe it

Currently the only way to enable sortSchema: true is via the GraphQLModule's GqlModuleOption but the sortSchema option isn't available in its GenerateOptions type.

When using a schema first approach, this means the only way to generate a sorted schema is to run the NestJS app that instantiates the GraphQLModule. This is a bummer because the example script shown in the schema first documentation only uses the GraphQLDefinitionsFactory.

Describe the solution you'd like

GraphQLDefinitionsFactory should allow the same sortSchema option in its GenerateOptions.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

It should be possible to generate the same GraphQL schema via GraphQLModule and GraphQLDefinitionsFactory.

kamilmysliwiec commented 1 month ago

Would you like to create a PR for this?