bpmn-io / bpmn-js-element-templates

The element template extension for bpmn-js
MIT License
5 stars 3 forks source link

deps: update to @bpmn-io/element-templates-validator@2.0.1 #73

Closed marstamm closed 8 months ago

marstamm commented 8 months ago

closes #70

barmac commented 8 months ago

I tried this out and it seems that the implementation sets the value like "feel: static":

image

Further edits add the equal sign in the front of expression =

barmac commented 8 months ago

Consider moving test templates to test/spec/fixtures so that they are accessible via npm start script.

barmac commented 8 months ago

Alternatively, we could force the template developers to set value to expression if feel is set to required.

barmac commented 8 months ago

Something like:

{
  "if" {
    "required": [ "feel" ]
    "properties": {
      "feel": {
        "const": "required"
      }
    }
  },
  "then": {
    "properties": {
      "value": {
        "type": "string",
        "pattern": "^="
      }
    }
  }
}
marstamm commented 8 months ago

IMO, we should not do magic to default values as well, it is confusing enough as it is. If you are using feel: required, the default value should be a feel expression. This fix is to prevent blowing up the editor when an unexpected value is provided.

I think we should add this check to the schema as well

barmac commented 8 months ago

Will you add this to the JSON schema then? It will make the test case invalid.

marstamm commented 8 months ago

Yes, I will add the JSON schema

marstamm commented 8 months ago

I removed the previous implementation since it is now enforced via the schema. It would have made more sense to do the type casting at the lower level code editor implementation anyway.