Skip to content

Commit

Permalink
feat: add feel property
Browse files Browse the repository at this point in the history
  • Loading branch information
marstamm authored and merge-me[bot] committed Mar 14, 2022
1 parent b015a59 commit ac43f50
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,31 @@
],
"errorMessage": "must provide choices=[] with \"Dropdown\" type"
}
},
{
"if": {
"not": {
"properties": {
"type": {
"enum": [
"String",
"Text"
]
}
},
"required": [
"type"
]
}
},
"then": {
"not": {
"required": [
"feel"
]
},
"errorMessage": "feel is only valid for \"String\" and \"Text\" type"
}
}
],
"properties": {
Expand Down Expand Up @@ -134,6 +159,18 @@
}
}
},
"feel": {
"$id": "#/properties/property/feel",
"type": "string",
"default": null,
"title": "property feel",
"description": "Indicates whether the property can be a feel expression",
"enum": [
null,
"optional",
"required"
]
},
"group": {
"$id": "#/properties/property/group",
"type": "string",
Expand Down
37 changes: 37 additions & 0 deletions packages/element-templates-json-schema/resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@
],
"errorMessage": "must provide choices=[] with \"Dropdown\" type"
}
},
{
"if": {
"not": {
"properties": {
"type": {
"enum": [
"String",
"Text"
]
}
},
"required": [
"type"
]
}
},
"then": {
"not": {
"required": [
"feel"
]
},
"errorMessage": "feel is only valid for \"String\" and \"Text\" type"
}
}
],
"properties": {
Expand Down Expand Up @@ -160,6 +185,18 @@
}
}
},
"feel": {
"$id": "#/properties/property/feel",
"type": "string",
"default": null,
"title": "property feel",
"description": "Indicates whether the property can be a feel expression",
"enum": [
null,
"optional",
"required"
]
},
"group": {
"$id": "#/properties/property/group",
"type": "string",
Expand Down
37 changes: 37 additions & 0 deletions packages/zeebe-element-templates-json-schema/resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@
],
"errorMessage": "must provide choices=[] with \"Dropdown\" type"
}
},
{
"if": {
"not": {
"properties": {
"type": {
"enum": [
"String",
"Text"
]
}
},
"required": [
"type"
]
}
},
"then": {
"not": {
"required": [
"feel"
]
},
"errorMessage": "feel is only valid for \"String\" and \"Text\" type"
}
}
],
"properties": {
Expand Down Expand Up @@ -160,6 +185,18 @@
}
}
},
"feel": {
"$id": "#/properties/property/feel",
"type": "string",
"default": null,
"title": "property feel",
"description": "Indicates whether the property can be a feel expression",
"enum": [
null,
"optional",
"required"
]
},
"group": {
"$id": "#/properties/property/group",
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
export const template = {
'name': 'Pattern Template',
'id': 'com.example.PatternTemplate',
'appliesTo': [
'bpmn:Task'
],
'properties': [
{
'label': 'Feel (Boolean)',
'type': 'Boolean',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'required'
}
]
};

export const errors = [
{
keyword: 'errorMessage',
dataPath: '/properties/0',
schemaPath: '#/definitions/properties/allOf/0/items/allOf/1/then/errorMessage',
params: {
errors: [
{
dataPath: '/properties/0',
emUsed: true,
keyword: 'not',
message: 'should NOT be valid',
params: {},
schemaPath: '#/definitions/properties/allOf/0/items/allOf/1/then/not'
}
]
},
message: 'feel is only valid for "String" and "Text" type'
},
{
keyword: 'if',
dataPath: '/properties/0',
schemaPath: '#/definitions/properties/allOf/0/items/allOf/1/if',
params: { failingKeyword: 'then' },
message: 'should match "then" schema'
},
{
keyword: 'type',
dataPath: '',
schemaPath: '#/oneOf/1/type',
params: { type: 'array' },
message: 'should be array'
},
{
keyword: 'oneOf',
dataPath: '',
schemaPath: '#/oneOf',
params: { passingSchemas: null },
message: 'should match exactly one schema in oneOf'
}
];
47 changes: 47 additions & 0 deletions packages/zeebe-element-templates-json-schema/test/fixtures/feel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export const template = {
'name': 'Pattern Template',
'id': 'com.example.PatternTemplate',
'appliesTo': [
'bpmn:Task'
],
'properties': [
{
'label': 'Feel Required (String)',
'type': 'String',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'required'
},
{
'label': 'Feel Optional (String)',
'type': 'String',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'optional'
},
{
'label': 'Feel Required (Text)',
'type': 'Text',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'required'
},
{
'label': 'Feel Optional (Text)',
'type': 'Text',
'binding': {
'type': 'property',
'name': 'prop'
},
'feel': 'optional'
}
]
};

export const errors = null;
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ describe('validation', function() {
testTemplate('entries-visible-boolean');


testTemplate('feel');


testTemplate('feel-type-mismatch');


testTemplate('pattern-string');


Expand Down

0 comments on commit ac43f50

Please sign in to comment.