Skip to content
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

Add request validation middleware #4

Closed
deanefrati opened this issue Jun 18, 2024 · 2 comments · Fixed by #19
Closed

Add request validation middleware #4

deanefrati opened this issue Jun 18, 2024 · 2 comments · Fixed by #19
Assignees
Labels
enhancement New feature or request

Comments

@deanefrati
Copy link
Contributor

No description provided.

@deanefrati deanefrati added the enhancement New feature or request label Jun 18, 2024
@UjwalaK UjwalaK self-assigned this Jun 18, 2024
@Lutherwaves
Copy link
Contributor

Sample middleware https://github.com/tink3rlabs/example-app/blob/main/internal/middleware/middleware.go#L37

@UjwalaK
Copy link
Contributor

UjwalaK commented Jun 19, 2024

I was looking into inbuilt validators and Gin framework has builtin validators where you can do request payload validation and also write custom validators
https://blog.logrocket.com/gin-binding-in-go-a-tutorial-with-examples/

Reading more on Gin, its a heavy weight thats why most prefer something light weight framework like Chi the one we are using

Chi doesn't have its own inbuilt validator and its usually paired with package Validator which Gin also uses internally

For json schema there is a package gojsonschema that allows you to validate JSON payloads against a predefined JSON schema.
I will look into these two libraries

@UjwalaK UjwalaK closed this as completed Jun 28, 2024
@UjwalaK UjwalaK linked a pull request Jun 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants