-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Use codegen on non-input types #20
Comments
@willd-i2o I'm just curious. |
I use apollo client alongside graphql-codegen |
@willd-i2o Thanks for your explanation. type Human {
name: String!
age: Int!
}
input HumanInput {
name: String!
age: Int!
} Then you want to validate only for |
Yeah that sounds about right |
@willd-i2o Thanks. Don't you use fragment also? |
I think I could do what I would like to do without the codegen supporting fragments, but not entirely sure. |
@willd-i2o I'm sorry. After due consideration, I did not feel this desperately needed to be addressed. If there are requests from others, I will revisit this issue. |
Interest here |
I use Zod to validate data from my database and other sources as well. Sure that incoming data should be in the model you expect. Of course, corrupted data or a service that broke their API contract would then cause errors in your app. I can write my own Zod schemas, of course. But I have to define my outgoing type anyway in graphQL. type User {
id: ID!
email: String!
disabled: Boolean
createdAt: String
updatedAt: String
}
input NewUser {
id: ID!
email: String!
}
type Query {
user(id: ID!): User
} At some point I am going to assemble that User JSON for my If I can auto-generate zod types from the graphql types, then I can further |
It seems that with the current version of the plugin, validation schemas are only generated for graphql
input
types found in the schema. i was wondering if it would be possible to add an option to the plugin to generate validation schemas for graphqltype
as well asinput
?The text was updated successfully, but these errors were encountered: