Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-5798

Introduce unified validation mechanism to webhooks

    XMLWordPrintable

    Details

    • Type: New Feature Request
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 5.0.0alpha1, 5.0.0alpha2
    • Fix Version/s: None
    • Component/s: Proxy (P), Server (S)

      Description

      Most webhooks require to perform input param validation and such validations make as much as 50+% of webhook code. Additionaly there is no unification in validation logic / error messages etc.

      It would be great to introduce built-in object that will implement unified validation logic like this:

      var data = InputValidator.parse([
      	{fields: ['url', 'severity', 'title'], validator: 'required'},
      	{fields: ['url', 'title'], validator: 'string'},
      	{fields: 'title', validator: 'string', options: {'max': 100}},
      	{fields: 'severity', validator: 'integer', options: {'min': 1, 'max': 5}},
      	{fields: 'url', validator: function (value) {
      		if (!value.endsWith('/')) {
      			value += '/';
      		}
      
      		return value;
      	}},
      	{fields: 'title', validator: function (value) {
      		if (value.trim() === '') {
      			throw 'Bebebe, bad value, bebebe!';
      		}
      
      		return value;
      	}},
      	{fields: 'set', validator: 'boolean'}
      ]);

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              wiper Andris Zeila
              Reporter:
              vjaceslavs Vjaceslavs Bogdanovs
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: