camunda / element-templates-json-schema

JSON Schema for (Camunda) Element Templates
10 stars 7 forks source link

Error message provides insufficient context #110

Open nikku opened 1 year ago

nikku commented 1 year ago

Describe the Bug

Our validation reports errors that are hard to impossible to comprehend by a user. For example, given the following template what is broken is that feel is not compatible to type=Dropdown. What is reported is that (without context) type=String|Text are the only compatible options, rather than highlighting that feel is not supported for Dropdown:

{
  "$schema": "https://unpkg.com/browse/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
  "name": "Connector Name",
  "id": "connector-id",
  "appliesTo": ["bpmn:Task"],
  "properties": [
    {
      "label": "Some label",
      "type": "Dropdown",
      "feel": "optional",
      "binding": {
          "type": "zeebe:input",
          "name": "variableName",
          "key": "asd"
      },
      "choices": [],
      "value": "=default expression"
    }
  ]
}

Steps to Reproduce

  1. Open above template
  2. See that validation marks property.type=Dropdown as invalid

Expected Behavior

We validate feel instead; it is not compatible with property.type=Dropdown.

Environment

barmac commented 10 months ago

Something like:

{
 "if": {
   "language": {
      "const": "feel"
    }
  },
  "then": {
      "type": {
        "not": {
          "const": "Dropdown"
        }
      }
   }
}