-
Notifications
You must be signed in to change notification settings - Fork 13
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
How to do validation? #47
Comments
I don't have the use case yet of checking the input but if I require something I require it in my database / schema so We have soon a new release where it will be a lot easier to override converts/resolvers. For the max=30 you could create your custom resolver. In the later version we will automically detect other resolver in files other than the generated one's and use the version the developer made. But I think we need a better validation hook or something, I will make it if I have a use case for it. For now empty fields checking in database/schema is good enough for me since I make mostly internal apps for companies and do the validation frontend |
Yes, but it's not scalable. What if I need that struct embedded in another?
Yep, but for the case with empty string the user can use empty space, e.g.: I wanna remove validations from frontend for RAD (rapid application development) and generate as much as possible on the server side. |
I agree I think we need something for this maybe schema input validations
and a resolver validation or a function like
ValidateCreateUserInput(input *graphql.models.User, resolverName string)
[]graphql.Error {}
Which you can override or something.
But I don't have time for this yet, maybe in the future or if you make a PR
for this
|
It will be on my list, but after a better customization story and multiple graphql files and multiple resolvers |
Since you are fighting my own battles (gqlgen and go) can I ask you how are you dealing with the hot topic of validations?
E.g. from your example:
how to validate that e.g.
views
ismax = 30
ororiginalUrl != ""
?The text was updated successfully, but these errors were encountered: