Skip to content

Commit

Permalink
feat(zeebe): allow number and boolean everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
marstamm committed Feb 6, 2024
1 parent 4bdee3b commit 92022b2
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"Text",
"Hidden",
"Dropdown",
"Boolean"
"Boolean",
"Number"
]
}
}
Expand Down Expand Up @@ -76,7 +77,9 @@
"String",
"Text",
"Hidden",
"Dropdown"
"Dropdown",
"Boolean",
"Number"
]
}
}
Expand Down Expand Up @@ -157,7 +160,9 @@
"type": {
"enum": [
"String",
"Text"
"Text",
"Number",
"Boolean"
]
}
},
Expand Down Expand Up @@ -224,6 +229,56 @@
]
}
}
},
{
"if": {
"properties": {
"type": {
"enum": [
"String",
"Text"
]
}
},
"required": [
"feel"
]
},
"then": {
"properties": {
"feel": {
"enum": [
"optional",
"required"
]
}
}
}
},
{
"if": {
"properties": {
"type": {
"enum": [
"Boolean",
"Number"
]
}
},
"required": [
"feel"
]
},
"then": {
"properties": {
"feel": {
"enum": [
"optional",
"staticValue"
]
}
}
}
}
],
"properties": {
Expand Down Expand Up @@ -406,12 +461,11 @@
"feel": {
"$id": "#/properties/property/feel",
"type": "string",
"default": null,
"description": "Indicates whether the property can be a feel expression",
"enum": [
null,
"optional",
"required"
"required",
"staticValue"
]
},
"language": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"properties",
"type"
],
"errorMessage": "invalid property type ${0} for binding type \"property\"; must be any of { String, Text, Hidden, Dropdown, Boolean }"
"errorMessage": "invalid property type ${0} for binding type \"property\"; must be any of { String, Text, Hidden, Dropdown, Boolean, Number }"
},
{
"path": [
Expand All @@ -41,7 +41,7 @@
"properties",
"type"
],
"errorMessage": "invalid property type ${0} for binding type ${1/binding/type}; must be any of { String, Text, Hidden, Dropdown }"
"errorMessage": "invalid property type ${0} for binding type ${1/binding/type}; must be any of { String, Text, Hidden, Dropdown, Boolean, Number }"
},
{
"path": [
Expand Down Expand Up @@ -90,7 +90,7 @@
"properties",
"type"
],
"errorMessage": "feel is only supported for \"String\" and \"Text\" type"
"errorMessage": "feel is only supported for \"String\", \"Text\", \"Number\" and \"Boolean\" type"
},
{
"path": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,91 @@
export const template = {
'name': 'Pattern Template',
'id': 'com.example.PatternTemplate',
'appliesTo': [
name: 'Pattern Template',
id: 'com.example.PatternTemplate',
appliesTo: [
'bpmn:Task'
],
'properties': [
properties: [
{
'label': 'Feel (Boolean)',
'type': 'Boolean',
'binding': {
'type': 'property',
'name': 'prop'
label: 'Text (staticValue)',
type: 'Text',
binding: {
type: 'property',
name: 'prop'
},
'feel': 'required'
feel: 'staticValue'
},
{
label: 'Number (required)',
type: 'Number',
binding: {
type: 'property',
name: 'prop'
},
feel: 'required'
}
]
};

export const errors = [
export const errors =
[
{
keyword: 'errorMessage',
dataPath: '/properties/0/type',
schemaPath: '#/allOf/1/items/allOf/4/then/properties/type/errorMessage',
dataPath: '/properties/0/feel',
keyword: 'enum',
message: 'should be equal to one of the allowed values',
params: {
errors: [
{
keyword: 'enum',
dataPath: '/properties/0/type',
schemaPath: '#/allOf/1/items/allOf/4/then/properties/type/enum',
params: {
allowedValues: [
'String',
'Text'
]
},
message: 'should be equal to one of the allowed values',
emUsed: true
}
allowedValues: [
'optional',
'required'
]
},
message: 'feel is only supported for "String" and "Text" type'
schemaPath: '#/allOf/1/items/allOf/8/then/properties/feel/enum'
},
{
keyword: 'if',
dataPath: '/properties/0',
schemaPath: '#/allOf/1/items/allOf/4/if',
keyword: 'if',
message: 'should match "then" schema',
params: {
failingKeyword: 'then',
},
schemaPath: '#/allOf/1/items/allOf/8/if'
},
{
dataPath: '/properties/1/feel',
keyword: 'enum',
message: 'should be equal to one of the allowed values',
params: {
allowedValues: [
'optional',
'staticValue'
]
},
schemaPath: '#/allOf/1/items/allOf/9/then/properties/feel/enum'
},
{
dataPath: '/properties/1',
keyword: 'if',
message: 'should match "then" schema',
params: {
failingKeyword: 'then'
},
message: 'should match "then" schema'
schemaPath: '#/allOf/1/items/allOf/9/if'
},
{
keyword: 'type',
dataPath: '',
schemaPath: '#/oneOf/1/type',
keyword: 'type',
message: 'should be array',
params: {
type: 'array'
},
message: 'should be array'
schemaPath: '#/oneOf/1/type'
},
{
keyword: 'oneOf',
dataPath: '',
schemaPath: '#/oneOf',
keyword: 'oneOf',
message: 'should match exactly one schema in oneOf',
params: {
passingSchemas: null
},
message: 'should match exactly one schema in oneOf'
schemaPath: '#/oneOf'
}
];
36 changes: 36 additions & 0 deletions packages/zeebe-element-templates-json-schema/test/fixtures/feel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,42 @@ export const template = {
'name': 'prop'
},
'feel': 'optional'
},
{
'label': 'Feel staticValue (Number)',
'type': 'Number',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'staticValue'
},
{
'label': 'Feel optional (Number)',
'type': 'Number',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'optional'
},
{
'label': 'Feel staticValue (Boolean)',
'type': 'Boolean',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'staticValue'
},
{
'label': 'Feel optional (Boolean)',
'type': 'Boolean',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'optional'
}
]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ export const errors = [
'Text',
'Hidden',
'Dropdown',
'Boolean'
'Boolean',
'Number'
]
},
message: 'should be equal to one of the allowed values'
}
]
},
message: 'invalid property type "Foo" for binding type "property"; must be any of { String, Text, Hidden, Dropdown, Boolean }'
message: 'invalid property type "Foo" for binding type "property"; must be any of { String, Text, Hidden, Dropdown, Boolean, Number }'
},
{
keyword: 'if',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,61 +20,16 @@ export const template = {
'type': 'zeebe:input',
'name': 'bar'
}
},
{
'label': 'baz',
'type': 'Number',
'binding': {
'type': 'zeebe:input',
'name': 'baz'
}
}
]
};

export const errors = [
{
keyword: 'errorMessage',
dataPath: '/properties/1/type',
schemaPath: '#/allOf/1/items/allOf/1/then/properties/type/errorMessage',
params: {
errors: [
{
keyword: 'enum',
emUsed: true,
dataPath: '/properties/1/type',
schemaPath: '#/allOf/1/items/allOf/1/then/properties/type/enum',
params: {
'allowedValues': [
'String',
'Text',
'Hidden',
'Dropdown'
]
},
message: 'should be equal to one of the allowed values'
}
]
},
message: 'invalid property type "Boolean" for binding type "zeebe:input"; must be any of { String, Text, Hidden, Dropdown }'
},
{
keyword: 'if',
dataPath: '/properties/1',
schemaPath: '#/allOf/1/items/allOf/1/if',
params: {
'failingKeyword': 'then'
},
message: 'should match "then" schema'
},
{
dataPath: '',
keyword: 'type',
message: 'should be array',
params: {
type: 'array',
},
schemaPath: '#/oneOf/1/type',
},
{
dataPath: '',
keyword: 'oneOf',
message: 'should match exactly one schema in oneOf',
params: {
passingSchemas: null
},
schemaPath: '#/oneOf'
}
];
export const errors = null;
Loading

0 comments on commit 92022b2

Please sign in to comment.