Automatically generate GraphQL schema or customizable schema config fields from Drizzle ORM schema
by drizzle-teamTypeScript
Last 12 weeks · 0 commits
2 of 6 standards met
Hi there. I am using drizzle graphql for my application. My drizzle schema is getting pretty complex as the app grows, but nothing out of the ordinary. When I am generating the graphql schema using drizzle, the ram consumption sky rockets, and crashes the app because it eats up all the allocated ram (I have allocated 12 GB!). I geuss this is because of all the nested relations that is generated for each model in the database. Maybe there is an obvious quick fix for this? Otherwise it would be nice with a solution. What about a setting for buildSchema, where you can declare how deeply nested the relations in the generated schema should go?
I am watching this project with great hopes. From experience, an auto-generated db-to-api systems needs two crucial things: Extension with custom logic (here it's a given as we can select what to expose and expand the schema with custom resolvers) Integrating some authorization scheme There used to be projects like that tried to offer that as universal third party, but is not maintained anymore. Some framework like postgraphile or pg_graphql rely on RLS, but I always thought Authr should live in the codebase, plus column based security is hard to nail. So my question would be - what do you recommend as good practice to add authorization in a stack ? Is there a plan to include something in the library itself ? Cheers
Repository: drizzle-team/drizzle-graphql. Description: Automatically generate GraphQL schema or customizable schema config fields from Drizzle ORM schema Stars: 87, Forks: 18. Primary language: TypeScript. Languages: TypeScript (100%). License: Apache-2.0. Homepage: https://www.npmjs.com/package/drizzle-graphql Topics: drizzle-orm, graphql, nodejs, typescript. Latest release: 0.8.5 (1y ago). Open PRs: 7, open issues: 19. Last activity: 1y ago. Community health: 37%. Top contributors: Sukairo-02, dankochetov, Edsol.
Mainly, wanted to add customizable naming to GraphQL schema and don't break existing code, so single entity suffix is still "Single", list suffix is "" by default. My projects use singular naming for entities (eg "user", "account"), so naturally I'd like to see suffixes like this as default behavior is a bit confusing:
I went ahead and added support for JSON data for PostgreSQL. Should address #25 Note there's currently a bug in Drizzle-ORM that prevents some of the tests from passing. I've temporarily set those tests to so that the tests pass. I understand that's not ideal, but having tests fail for a PR for unrelated reasons is also not ideal. I did test a completely clean version of the repo, and the same tests still failed.