Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add feel property #46

Merged
merged 2 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "List of properties of the element template.",
"allOf": [
{ "$ref": "examples.json#/properties" }
],
],
"items": {
"type": "object",
"default": {},
Expand Down
39 changes: 39 additions & 0 deletions packages/zeebe-element-templates-json-schema/resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,34 @@
}
}
}
},
{
"if": {
"properties": {
"feel": {
"not": {
"const": null
}
}
},
"required": [
"feel"
]
},
"then": {
"properties": {
"type": {
"enum": [
"String",
"Text"
],
"errorMessage": "feel is only supported for \"String\" and \"Text\" type"
}
},
"required": [
"type"
]
}
}
],
"properties": {
Expand Down Expand Up @@ -437,6 +465,17 @@
"$id": "#/optional",
"type": "boolean",
"description": "Indicates whether a property is optional. Optional bindings do not persist empty values in the underlying BPMN 2.0 XML."
},
"feel": {
"$id": "#/properties/property/feel",
"type": "string",
"default": null,
"description": "Indicates whether the property can be a feel expression",
"enum": [
null,
"optional",
"required"
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,34 @@
}
}
}
},
{
"if": {
"properties": {
"feel": {
"not": {
"const": null
}
}
},
"required": [
"feel"
]
},
"then": {
"properties": {
"type": {
"enum": [
"String",
"Text"
],
"errorMessage": "feel is only supported for \"String\" and \"Text\" type"
}
},
"required": [
"type"
]
}
}
],
"properties": {
Expand Down Expand Up @@ -247,6 +275,17 @@
"$id": "#/optional",
"type": "boolean",
"description": "Indicates whether a property is optional. Optional bindings do not persist empty values in the underlying BPMN 2.0 XML."
},
"feel": {
"$id": "#/properties/property/feel",
"type": "string",
"default": null,
"description": "Indicates whether the property can be a feel expression",
"enum": [
null,
"optional",
"required"
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
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/type',
schemaPath: '#/definitions/properties/allOf/1/items/allOf/4/then/properties/type/errorMessage',
params: {
errors: [
{
keyword: 'enum',
dataPath: '/properties/0/type',
schemaPath: '#/definitions/properties/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
}
]
},
message: 'feel is only supported for "String" and "Text" type'
},
{
keyword: 'if',
dataPath: '/properties/0',
schemaPath: '#/definitions/properties/allOf/1/items/allOf/4/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