lerenn / asyncapi-codegen

An AsyncAPI Golang Code generator that generates all Go code from the broker to the application/user. Just plug your application to your favorite message broker!
Apache License 2.0
82 stars 22 forks source link

validation JSON schema #131

Open Irvenae opened 5 months ago

Irvenae commented 5 months ago

Should we add validation for JSON schema core values?

https://json-schema.org/draft/2020-12/json-schema-validation

could be middleware which is automatically added or a defaultValidation middleware which is up to the client to add?

lerenn commented 5 months ago

I think that would be a great idea ! If you have any thought about the go lib that we could use, that would be great.

Also, if you want to give it a try, PR are welcome :)

Irvenae commented 5 months ago

Seems like validator v10 is the way to go https://dev.to/sanjaysinghrajpoot/adding-json-validation-to-structs-in-go-lang-4mg8.

So I guess it might be already good enough to add the tags to the struct. People could add their own validator in the middleware to check this. We could provide one in the extensions that uses validator v10.

lerenn commented 5 months ago

I'm busy on the AsyncAPI V3 support for now, but I'll take look after that :)