switchboardoperator/switchboard-operator

Add a json-schema validation plugin

Opened this issue · 0 comments

Problem to solve

Allow validation of payloads using json-schema

Further details

Can be used by async applications to validate forms/data having the validation errors in a specific validtionErrors route for the exchange linked by default to the operator (or to a specified endpoint).

Proposal

This should be a plugin, i.e. Validation, properly validating respecting the json-schema specification.

It should allow configuring:

  • The json-schema to validate the payload against.
  • The scope/field to validate (by default the entire payload would be validated).
  • The exchange & route || queue. By default it should point to the exchange of the current operator + validationErrors route.
  • What to do in case of error. Here I think that we should allow defining actions the same way we do under operators, so users can decide between sending the request to a queue (default behavior), send it using a REST request, or even just a telegram message.

Links / references