From 47f95fa38015e52b984d95751696e380020d432c Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Mon, 13 Jul 2020 13:59:16 -0700 Subject: [PATCH] add ui.schema (#5955) * add ui.schema * add better title and description to placeholder and subtitle * add widget to ui schema * refactor ui schema to make way for flow & menu schema * add editorconfig * add first iteration of the flow schema * un-nest options * add menu options * expand ability to nest menu items * update copy * move ui schema into ui directory * update $id * move additionalProperties into the definition * remove flow schema for now --- .editorconfig | 12 +++ schemas/ui/v1.0/ui.schema | 149 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 .editorconfig create mode 100644 schemas/ui/v1.0/ui.schema diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..1864e6bd58 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +insert_final_newline = true + +[*.json] +indent_style = space +indent_size = 4 + +[*.schema] +indent_style = space +indent_size = 4 diff --git a/schemas/ui/v1.0/ui.schema b/schemas/ui/v1.0/ui.schema new file mode 100644 index 0000000000..f4d60e4da8 --- /dev/null +++ b/schemas/ui/v1.0/ui.schema @@ -0,0 +1,149 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://schemas.botframework.com/schemas/ui/v1.0/ui.schema", + "title": "UI Schema", + "description": "Visual customization options for BotFramework SDK components.", + "type": "object", + "additionalProperties": true, + "properties": { + "form": { + "title": "Form UI Options", + "description": "UI Options object describing form UI customizations for this $kind.", + "$ref": "#/definitions/FormUIOptions" + }, + "menu": { + "title": "Menu Options", + "description": "Configure how this component appears in the menu.", + "$ref": "#/definitions/MenuOptions" + } + }, + "definitions": { + "FormUIOptions": { + "type": "object", + "properties": { + "description": { + "title": "Description", + "description": "Description override. Used in tooltips.", + "type": "string" + }, + "helpLink": { + "title": "Help Link", + "description": "URI to component or property documentation. Used in tooltips.", + "type": "string", + "format": "uri" + }, + "hidden": { + "title": "Hidden Properties", + "description": "An array of property names to hide in the UI.", + "type": "array", + "items": { + "type": "string" + } + }, + "label": { + "title": "Label", + "description": "Label override. Can either be a string or false to hide the label.", + "oneOf": [ + { + "type": "string" + }, + { + "const": false + } + ] + }, + "order": { + "title": "Property Order", + "description": "Set the order of fields. Use \"*\" for all other fields. ex. [\"foo\", \"*\", \"bar\"]", + "type": "array", + "items": { + "type": "string" + }, + "examples": [ + [ + "*" + ] + ] + }, + "placeholder": { + "title": "Placeholder", + "description": "Placeholder override. Default is `examples` property in the schema.", + "type": "string" + }, + "properties": { + "title": "Properties", + "description": "A map of component property names to UI options with customizations for each property.", + "type": "object", + "additionalProperties": { + "title": "Property Name", + "description": "UI Options object describing UI customizations for this property.", + "$ref": "#/definitions/FormUIOptions" + } + }, + "subtitle": { + "title": "Subtitle", + "description": "Subtitle rendered in form title, defaults to schema.$kind", + "type": "string" + }, + "widget": { + "title": "Field Widget", + "description": "Override default field widget.", + "type": "string", + "enum": [ + "checkbox", + "date", + "datetime", + "input", + "number", + "radio", + "select", + "textarea" + ] + } + }, + "additionalProperties": false + }, + "MenuOptions": { + "type": "object", + "properties": { + "label": { + "title": "Menu Item Label", + "description": "Text that appears as the menu item. Defaults to $kind.", + "type": "string" + }, + "submenu": { + "title": "Submenu", + "description": "An array of menu item labels which get mapped to a menu hierarchy. Set to false to leave the component un-grouped. To have a component appear in multiple submenus, provide multiple arrays.", + "oneOf": [ + { + "$ref": "#/definitions/SubmenuOptions" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/SubmenuOptions" + } + }, + { + "const": false + } + ] + } + }, + "additionalProperties": false + }, + "SubmenuOptions": { + "type": "array", + "items": { + "title": "Group Name", + "type": "string" + }, + "examples": [ + [ + "Top Level Menu", + "Secondary Menu" + ] + ] + } + } +}