Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binding allows invalid values #109

Open
nikku opened this issue Aug 28, 2023 · 4 comments
Open

binding allows invalid values #109

nikku opened this issue Aug 28, 2023 · 4 comments
Labels
backlog Queued in backlog bug Something isn't working Camunda Cloud element templates spring cleaning Could be cleaned up one day

Comments

@nikku
Copy link
Member

nikku commented Aug 28, 2023

Describe the Bug

The schema validation for binding is insufficient, allowing to set properties not actually relevant to the existing binding type.

Steps to Reproduce

Validate the following template:

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

See that binding.key is an allowed property, despite only allowed if binding.type === 'zeebe:taskHeader'.

Expected Behavior

We validate known properties of binding, and ensure they are used correctly.

Environment

  • Host (Browser/Node version), if applicable: Any
  • OS: Any
  • Library version: v0.12.0
@pinussilvestrus
Copy link
Contributor

For transparency, in our draft forms JSON schema, we tried out a more modular approach of defining rules, e.g., also for allowed properties of sub schemas. One way to comprehend the fairly high complexity of these if-then-rules. Maybe this helps as an inspiration 👍

@nikku
Copy link
Member Author

nikku commented Sep 18, 2023

Would your approach directly contribute to better validation?

@pinussilvestrus
Copy link
Contributor

This approach validates invalid properties for form field types, such as "if NOT this type, then this property is not allowed". IDEs with JSON schema support as VS Code then create such error messages.

image

@nikku
Copy link
Member Author

nikku commented Sep 19, 2023

Thanks for the update. So this would indeed fix #110.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog bug Something isn't working Camunda Cloud element templates spring cleaning Could be cleaned up one day
Projects
None yet
Development

No branches or pull requests

2 participants