Skip to content

Commit

Permalink
fix dbox schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Xziy committed Apr 28, 2024
1 parent 07a1d4f commit b9b22dc
Showing 1 changed file with 52 additions and 35 deletions.
87 changes: 52 additions & 35 deletions libs/schemas/dialogBoxConfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"askId": { "type": "string" },
Expand All @@ -14,48 +15,64 @@
"enum": ["button", "product"]
},
"timeout": { "type": "number" },
"defaultOptionId": { "type": "string" },
"options": {
"defaultOptionId": { "type": "string" }
},
"required": ["message", "title", "optionsType"],
"if": {
"properties": { "optionsType": { "const": "button" } }
},
"then": {
"properties": {
"options": { "$ref": "#/definitions/ButtonOptions" }
},
"required": ["options"]
},
"else": {
"properties": {
"options": { "$ref": "#/definitions/ProductOptions" }
},
"required": ["options"]
},
"definitions": {
"ButtonOptions": {
"type": "array",
"minItems": 2,
"items": {
"type": "object",
"additionalProperties": true,
"if": {
"properties": { "optionsType": { "const": "button" } }
"properties": {
"id": { "type": "string" },
"button": {
"type": "object",
"additionalProperties": true,
"properties": {
"label": { "type": "string" },
"type": {
"type": "string",
"enum": ["primary", "secondary", "link", "abort"]
}
},
"required": ["type", "label"]
}
},
"then": {
"properties": {
"id": { "type": "string" },
"button": {
"type": "object",
"additionalProperties": true,
"properties": {
"label": { "type": "string" },
"type": {
"type": "string",
"enum": ["primary", "secondary", "link", "abort"]
}
},
"required": ["type", "label"]
}
},
"additionalProperties": true,
"required": ["id", "button"]
"required": ["id", "button"]
}
},
"ProductOptions": {
"type": "array",
"minItems": 2,
"items": {
"type": "object",
"additionalProperties": true,
"properties": {
"id": { "type": "string" },
"product": {
"type": "object",
"additionalProperties": true
}
},
"else": {
"properties": {
"id": { "type": "string" },
"product": {
"type": "object",
"additionalProperties": true
}
},
"additionalProperties": true,
"required": ["id", "product"]
}
"required": ["id", "product"]
}
}
},
"required": ["message", "title", "optionsType", "options"]
}
}

0 comments on commit b9b22dc

Please sign in to comment.