senecajs / seneca

A microservices toolkit for Node.js.
http://senecajs.org
MIT License
3.95k stars 314 forks source link

built-in message validation inspired by Vue.js props validation #875

Open rjrodger opened 3 years ago

rjrodger commented 3 years ago

Except validation is deep. This:

seneca.add({
  foo: 'bar',
  count: Number,
  what: String,
  obj: {
     zed: Boolean,
     list: [String]
  }
}, action)
lilsweetcaligula commented 3 years ago

@rjrodger Is it currently planned for the implementation of such message validation system to support union types? E.g. if, as a user, I want to match on ‘:foo‘ when it's either 'bar' or 'baz' or null. If yes, then what is the syntax envisioned to be like?