ConnectEverything / nats-by-example

Collection of runnable, reference examples using NATS (https://nats.io)
https://natsbyexample.com
157 stars 37 forks source link

data validation #112

Closed gedw99 closed 3 months ago

gedw99 commented 1 year ago

One thing i keep on getting asked is "whats is the best way to do validation"...

This is really for Producers / Mutations, but also perhaps for Consumers too.

I tend to go for either JSON Schema, just like NATS JSM uses.

But there seems to be pretty good frameworks too:

i see many people using outside NATS is https://ajv.js.org/guide/schema-language.html.

There is 2 options:

Language for JSON Type Def:

https://github.com/orgs/jsontypedef/repositories

https://github.com/jsontypedef/json-typedef-go

scottf commented 3 months ago

@gedw99 Please post this question to the Architecture and Design repo where this discussion can be better addressed.