camunda / element-templates-json-schema

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

Valid "allOf" condition marked as invalid #133

Closed marstamm closed 9 months ago

marstamm commented 9 months ago

Describe the Bug

With https://github.com/camunda/element-templates-json-schema/pull/128 we disallow a property to reference itself.

Even when I have a condition that is not referncial, it is marked as invalid when it is nested in allOf

Steps to Reproduce

Create a JSON schema with a Property that has:

  1. any ID
  2. any allMatch Condtion
  3. it is marked as invalid

Test case here: https://github.com/camunda/element-templates-json-schema/commit/f77d5f330e1e15ef58101cfb46a260b8c6613405

Expected Behavior

It is a valid Template.

Environment

@camunda/zeebe-element-templates-json-schema@0.19.0

marstamm commented 9 months ago

@philippfromme and me investigated this bug. We were not able to fix it, but at least add more information.

This is the failing condition: https://github.com/camunda/element-templates-json-schema/blob/dc53035102f343d34d2a9f677c2109aa6f334e9d/packages/element-templates-json-schema-shared/src/defs/condition.json#L79-L94

It always evaluates to true when allMatch is set, even when the array is empty. We were not able to figure out why that happens. We will revert the changes from https://github.com/camunda/element-templates-json-schema/pull/128 for now, as this breaks existing functionality

marstamm commented 9 months ago

Never mind, fixed it ==> #135

marstamm commented 9 months ago

X-Posting from #135

I just found out that all choices with conditions always fail as well. I added testcases to the branch. We should revert this Feature until we are sure it works as intended.