Slide 1

Slide 1 text

JSON Schema Validation @Camunda Modeler Why we chose ajv for our utility and why it's maybe not a good idea (anymore) Niklas

Slide 2

Slide 2 text

2 Element Templates Validation in the Camunda Modeler

Slide 3

Slide 3 text

3 How it’s done (v1) ElementTemplatesLoader#setTemplates Validator#_validateTemplates - validate Versioning - validate Compatibility - validate for missing id, name, appliesTo, ... - validate all properties - validate all scopes - ... validTemplates errors bpmn-js-properties-panel @camunda/element-templates-json-schema only compatibility

Slide 4

Slide 4 text

4 How it’s done (v1) ElementTemplatesLoader#setTemplates Validator#_validateTemplates - validate Versioning - validate Compatibility - validate for missing id, name, appliesTo, ... - validate all properties - validate all scopes - ... validTemplates errors bpmn-js-properties-panel @camunda/element-templates-json-schema only compatibility Element-Templates-Modal

Slide 5

Slide 5 text

5

Slide 6

Slide 6 text

6 How it’s done (v1) ElementTemplatesLoader#setTemplates Validator#_validateTemplates - validate Versioning - validate Compatibility - validate for missing id, name, appliesTo, ... - validate all properties - validate all scopes - ... validTemplates errors bpmn-js-properties-panel @camunda/element-templates-json-schema only compatibility

Slide 7

Slide 7 text

7 How it’s done (v2) ElementTemplatesLoader#setTemplates Validator#_validateTemplates - validate Versioning - validate Compatibility - validate for missing id, name, appliesTo, ... - validate all properties - validate all scopes - ... validTemplates errors bpmn-js-properties-panel @camunda/element-templates-json-schema only compatibility

Slide 8

Slide 8 text

8 How it’s done (v2) ElementTemplatesLoader#setTemplates Validator#_validateTemplates - validate Versioning - validate Compatibility - validate Schema compliant validTemplates errors bpmn-js-properties-panel @camunda/element-templates-json-schema @bpmn-io/json-schema-validator ajv

Slide 9

Slide 9 text

9

Slide 10

Slide 10 text

10

Slide 11

Slide 11 text

11 How it’s done (v2) ElementTemplatesLoader#setTemplates Validator#_validateTemplates - validate Versioning - validate Compatibility - validate Schema compliant validTemplates errors bpmn-js-properties-panel @camunda/element-templates-json-schema @bpmn-io/json-schema-validator ajv

Slide 12

Slide 12 text

12 How it’s done (v2) ElementTemplatesLoader#setTemplates Validator#_validateTemplates - validate Versioning - validate Compatibility - validate Schema compliant validTemplates errors bpmn-js-properties-panel @camunda/element-templates-json-schema @bpmn-io/json-schema-validator ajv One Template at a time

Slide 13

Slide 13 text

13 How it’s done (v2) ElementTemplatesLoader#setTemplates Validator#_validateTemplates - validate Versioning - validate Compatibility - validate Schema compliant validTemplates errors bpmn-js-properties-panel @camunda/element-templates-json-schema @bpmn-io/json-schema-validator ajv One Template at a time

Slide 14

Slide 14 text

14 What is “ajv”?

Slide 15

Slide 15 text

15 Why we chose it in the past ● Customizable error messages ● Configurable ● Extendable ● Community ● Performance ● Support the latest JSON Schema definition (we use draft-07) + features

Slide 16

Slide 16 text

16 https://ajv.js.org/guide/why-ajv.html#super-fast-secure

Slide 17

Slide 17 text

17

Slide 18

Slide 18 text

18 Why we chose it in the past @camunda/element-templates-json-schema

Slide 19

Slide 19 text

19 Problems

Slide 20

Slide 20 text

20 Alternatives? https://json-schema.org/implementations.html#validator-javascript ● tdegrunt/jsonschema ● hyperjump-io/json-schema-validator ● mafintosh/is-my-json-valid ● korzio/djv ● build our own

Slide 21

Slide 21 text

21 Why we chose it in the past ● Customizable error messages ● Configurable ● Extendable ● Community ● Performance ● Support the latest JSON Schema definition (we use draft-07) + features Reminder

Slide 22

Slide 22 text

22 Why we chose it in the past ● Customizable error messages ● Configurable ● Extendable ● Community ● Performance ● Support the latest JSON Schema definition (we use draft-07) + features Reminder

Slide 23

Slide 23 text

Thank you!