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 741d9df
Show file tree
Hide file tree
Showing 11 changed files with 200 additions and 78 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,31 @@
]
}
}
},
{
"if": {
"properties": {
"type": {
"enum": [
"String",
"Text"
]
}
},
"required": [
"feel"
]
},
"then": {
"properties": {
"feel": {
"enum": [
"optional",
"required"
]
}
}
}
}
],
"properties": {
Expand Down Expand Up @@ -406,12 +436,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",
"static"
]
},
"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,61 @@
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 (static)',
type: 'Text',
binding: {
type: 'property',
name: 'prop'
},
'feel': 'required'
feel: 'static'
}
]
};

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'
failingKeyword: 'then',
},
message: 'should match "then" schema'
schemaPath: '#/allOf/1/items/allOf/8/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 static (Number)',
'type': 'Number',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'static'
},
{
'label': 'Feel optional (Number)',
'type': 'Number',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'optional'
},
{
'label': 'Feel static (Boolean)',
'type': 'Boolean',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'static'
},
{
'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,53 +20,71 @@ export const template = {
'type': 'zeebe:input',
'name': 'bar'
}
},
{
'label': 'baz',
'type': 'Number',
'binding': {
'type': 'zeebe:input',
'name': 'baz'
}
},
{
'label': 'baz',
'type': 'Car',
'binding': {
'type': 'zeebe:input',
'name': 'baz'
}
}
]
};

export const errors = [
{
dataPath: '/properties/3/type',
keyword: 'errorMessage',
dataPath: '/properties/1/type',
schemaPath: '#/allOf/1/items/allOf/1/then/properties/type/errorMessage',
message: 'invalid property type "Car" for binding type "zeebe:input"; must be any of { String, Text, Hidden, Dropdown, Boolean, Number }',
params: {
errors: [
{
keyword: 'enum',
dataPath: '/properties/3/type',
emUsed: true,
dataPath: '/properties/1/type',
schemaPath: '#/allOf/1/items/allOf/1/then/properties/type/enum',
keyword: 'enum',
message: 'should be equal to one of the allowed values',
params: {
'allowedValues': [
allowedValues: [
'String',
'Text',
'Hidden',
'Dropdown'
'Dropdown',
'Boolean',
'Number'
]
},
message: 'should be equal to one of the allowed values'
schemaPath: '#/allOf/1/items/allOf/1/then/properties/type/enum'
}
]
},
message: 'invalid property type "Boolean" for binding type "zeebe:input"; must be any of { String, Text, Hidden, Dropdown }'
schemaPath: '#/allOf/1/items/allOf/1/then/properties/type/errorMessage'
},
{
dataPath: '/properties/3',
keyword: 'if',
dataPath: '/properties/1',
schemaPath: '#/allOf/1/items/allOf/1/if',
message: 'should match "then" schema',
params: {
'failingKeyword': 'then'
failingKeyword: 'then'
},
message: 'should match "then" schema'
schemaPath: '#/allOf/1/items/allOf/1/if'
},
{
dataPath: '',
keyword: 'type',
message: 'should be array',
params: {
type: 'array',
type: 'array'
},
schemaPath: '#/oneOf/1/type',
schemaPath: '#/oneOf/1/type'
},
{
dataPath: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ export const template = {
'source': 'foo'
}
},
{
'label': 'bar',
'type': 'Toggle',
'binding': {
'type': 'zeebe:output',
'source': 'bar'
}
},
{
'label': 'bar',
'type': 'Boolean',
Expand Down Expand Up @@ -41,14 +49,16 @@ export const errors = [
'String',
'Text',
'Hidden',
'Dropdown'
'Dropdown',
'Boolean',
'Number'
]
},
message: 'should be equal to one of the allowed values'
}
]
},
message: 'invalid property type "Boolean" for binding type "zeebe:output"; must be any of { String, Text, Hidden, Dropdown }'
message: 'invalid property type "Toggle" for binding type "zeebe:output"; must be any of { String, Text, Hidden, Dropdown, Boolean, Number }'
},
{
keyword: 'if',
Expand Down
Loading

0 comments on commit 741d9df

Please sign in to comment.