You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So far I'm really digging GQLoom. It's ideal for a lot of what I'm looking for.
I'm trying to break a bad habit we have at the company I'm working for where they expose the database directly to their schema, so I don't want to use the Drizzle/Prisma/etc. dabs weavers. (Those a great, but for larger projects like this one with federation, we need separation of concerns and changing of the GQL schema and the DB schema to be independent.)
Anyway, I have a great little sample setup, and I'm loving it so far. I'm using Zod and (for now) Drizzle. It's the Zod part I think I'm having issues with.
I just have one small issue that I can't figure out: In order to use getResolvingFields() (actually a modified version I made that traces derived fields and only returns the necessary dependencies) I'll need the Typescript type of the output to have all the fields as optional.
If I try to use .output(...) (I've tried many options in there) I get the following out of the GraphQL library:
Schema must contain uniquely named types but contains multiple types named "User".
Oddly enough, I don't want it to make a new GraphQL type, I don't want the GraphQL schema to be changed. It makes the right thing for User right now, with the id, name, and email as non-nullable, I just need the typing to allow me to not have to return them.
I looked through how it's done in the Drizzle and Prisma weavers, and the best I can ascertain is that it just casts to any or some similar 🤷 type. (Maybe I missed something?) I'd prefer to avoid that, as another bad habit I'm trying to prevent is people (or agents) abusing any and as-casts, which both have effects that spread like a virus.
Thank you.
P.S. If you'd like the deriveAwareRequestedFields()) I'd be happy to put it in a PR, but I'm not sure where to put it. It's basically the same as getResolvingFields() except it tracks returnType too to see DERIVED_DEPENDENCIES and instead of adding the requested field it adds the dependencies of those fields.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hello,
So far I'm really digging GQLoom. It's ideal for a lot of what I'm looking for.
I'm trying to break a bad habit we have at the company I'm working for where they expose the database directly to their schema, so I don't want to use the Drizzle/Prisma/etc. dabs weavers. (Those a great, but for larger projects like this one with federation, we need separation of concerns and changing of the GQL schema and the DB schema to be independent.)
Anyway, I have a great little sample setup, and I'm loving it so far. I'm using Zod and (for now) Drizzle. It's the Zod part I think I'm having issues with.
I just have one small issue that I can't figure out: In order to use
getResolvingFields()(actually a modified version I made that traces derived fields and only returns the necessary dependencies) I'll need the Typescript type of the output to have all the fields as optional.Here's the setup code:
If I try to use
.output(...)(I've tried many options in there) I get the following out of the GraphQL library:Oddly enough, I don't want it to make a new GraphQL type, I don't want the GraphQL schema to be changed. It makes the right thing for
Userright now, with theid,name, andemailas non-nullable, I just need the typing to allow me to not have to return them.I looked through how it's done in the Drizzle and Prisma weavers, and the best I can ascertain is that it just casts to
anyor some similar 🤷 type. (Maybe I missed something?) I'd prefer to avoid that, as another bad habit I'm trying to prevent is people (or agents) abusinganyandas-casts, which both have effects that spread like a virus.Thank you.
P.S. If you'd like the
deriveAwareRequestedFields())I'd be happy to put it in a PR, but I'm not sure where to put it. It's basically the same asgetResolvingFields()except it tracksreturnTypetoo to seeDERIVED_DEPENDENCIESand instead of adding the requested field it adds the dependencies of those fields.All reactions