Skip to content

Commit

Permalink
feat(condition): add isVisible condition
Browse files Browse the repository at this point in the history
  • Loading branch information
marstamm committed Nov 16, 2023
1 parent 88f93d4 commit f9fe1a5
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,18 @@
"required": [
"oneOf"
]
}
},
{
"properties": {
"isVisible": {
"type": "boolean"

}
},
"required": [
"isVisible"
]
},
]
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ export const errors = [
params: { missingProperty: 'oneOf' },
message: "should have required property 'oneOf'"
},
{
dataPath: '/properties/1/condition',
keyword: 'required',
message: "should have required property 'isVisible'",
params: {
missingProperty: 'isVisible'
},
schemaPath: '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
keyword: 'oneOf',
dataPath: '/properties/1/condition',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ export const errors = [
params: { missingProperty: 'oneOf' },
message: "should have required property 'oneOf'"
},
{
dataPath: '/properties/1/condition',
keyword: 'required',
message: "should have required property 'isVisible'",
params: {
missingProperty: 'isVisible'
},
schemaPath: '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
keyword: 'oneOf',
dataPath: '/properties/1/condition',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ export const errors = [
params: { missingProperty: 'oneOf' },
message: "should have required property 'oneOf'"
},
{
dataPath: '/properties/1/condition',
keyword: 'required',
message: "should have required property 'isVisible'",
params: {
missingProperty: 'isVisible'
},
schemaPath: '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
keyword: 'oneOf',
dataPath: '/properties/1/condition',
Expand Down Expand Up @@ -100,6 +109,15 @@ export const errors = [
params: { type: [ 'string', 'number' ] },
message: 'should be string,number'
},
{
dataPath: '/properties/2/condition',
keyword: 'required',
message: "should have required property 'isVisible'",
params: {
missingProperty: 'isVisible'
},
schemaPath: '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
keyword: 'oneOf',
dataPath: '/properties/2/condition',
Expand Down
12 changes: 12 additions & 0 deletions packages/element-templates-json-schema/test/fixtures/condition.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ export const template = {
'type': 'property',
'name': 'input4'
}
},
{
'label': 'isVisible',
'type': 'String',
'condition': {
property: 'myId',
isVisible: true
},
'binding': {
'type': 'property',
'name': 'input4'
}
}
]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ export const errors = [
params: { missingProperty: 'oneOf' },
message: "should have required property 'oneOf'"
},
{
dataPath: '/properties/1/condition',
keyword: 'required',
message: "should have required property 'isVisible'",
params: {
missingProperty: 'isVisible'
},
schemaPath: '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
keyword: 'oneOf',
dataPath: '/properties/1/condition',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ export const errors = [
},
'schemaPath': '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/1/required'
},
{
'dataPath': '/properties/2/condition',
'keyword': 'required',
'message': "should have required property 'isVisible'",
'params': {
'missingProperty': 'isVisible'
},
'schemaPath': '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
'dataPath': '/properties/2/condition',
'keyword': 'oneOf',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ export const errors = [
params: { missingProperty: 'oneOf' },
message: "should have required property 'oneOf'"
},
{
dataPath: '/properties/1/condition',
keyword: 'required',
message: "should have required property 'isVisible'",
params: {
missingProperty: 'isVisible'
},
schemaPath: '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
keyword: 'oneOf',
dataPath: '/properties/1/condition',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ export const errors = [
params: { missingProperty: 'oneOf' },
message: "should have required property 'oneOf'"
},
{
dataPath: '/properties/1/condition',
keyword: 'required',
message: "should have required property 'isVisible'",
params: {
missingProperty: 'isVisible'
},
schemaPath: '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
keyword: 'oneOf',
dataPath: '/properties/1/condition',
Expand Down Expand Up @@ -100,6 +109,15 @@ export const errors = [
params: { type: [ 'string', 'number' ] },
message: 'should be string,number'
},
{
dataPath: '/properties/2/condition',
keyword: 'required',
message: "should have required property 'isVisible'",
params: {
missingProperty: 'isVisible'
},
schemaPath: '#/definitions/properties/allOf/0/items/properties/condition/definitions/condition/oneOf/2/required'
},
{
keyword: 'oneOf',
dataPath: '/properties/2/condition',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ export const template = {
'type': 'property',
'name': 'input4'
}
},
{
'label': 'isVisible',
'type': 'String',
'condition': {
property: 'myId',
isVisible: true
},
'binding': {
'type': 'property',
'name': 'input4'
}
}
]
};
Expand Down

0 comments on commit f9fe1a5

Please sign in to comment.