drizzle-team / drizzle-graphql

Automatically generate GraphQL schema or customizable schema config fields from Drizzle ORM schema
https://www.npmjs.com/package/drizzle-graphql
Apache License 2.0
48 stars 4 forks source link

Added buildSchema config #9

Closed Edsol closed 4 months ago

Edsol commented 4 months ago

Added configuration to buildSchema to disable creation of mutations

Sukairo-02 commented 4 months ago

Is it necessary though? You could already disable mutations (or, any query at all) by using custom schema with reused types\resolvers. Is it that much more convenient to pass a flag instead?

Edsol commented 4 months ago

rather than starting with manual schema construction, I am trying to create an automatic generator from an existing database (see here).

I did something like this to generate a mutationless schema:

const noMutationsSchema = new GraphQLSchema({
    query: schema.getQueryType(),
    subscription: schema.getSubscriptionType(),
  });

it seems unnecessary to me to generate a new scheme, I have not found a faster alternative solution.

Sukairo-02 commented 4 months ago

I see, that's more convenient it seems. I'll be adding ability do enable\disable queries (UPD: that crashes schema, will stick to mutations only) to that as well, thanks for your contribution.