Skip to content

Properties Schema Examples v1.0.0

Tom Taylor edited this page Feb 3, 2023 · 7 revisions

Examples

Following on from the property schema dissection, lets take a look at some examples of the differing types of schemas that can be used in v1.0.0 Authoring Tool schema.

String

"title": {
  "type": "string",
  "title": "Title",
  "default": "Untitled",
  "_adapt": {
    "translatable": true
  }
},
Screenshot 2023-01-16 at 17 06 30

String with Text Area

"body": {
  "type": "string",
  "title": "Body",
  "default": "",
  "_adapt": {
    "translatable": true
  },
  "_backboneForms": "TextArea"
},
Screenshot 2023-01-16 at 17 07 11

Number

"_left": {
  "type": "number",
  "title": "Pin horizontal position (%)",
  "description": "",
  "default": 0
},
Screenshot 2023-01-16 at 17 10 50

Boolean / Checkbox

"_isMobileTextBelowImage": {
  "type": "boolean",
  "title": "Move text area below image on mobile",
  "description": "If enabled, on mobile, the text area drops below the image instead of being behind the strapline button",
  "default": false,
  "_adapt": {
    "isSetting": true
  }
},
Screenshot 2023-01-16 at 17 29 09

Image

"src": {
  "type": "string",
  "isObjectId": true,
  "title": "Source",
  "description": "This is the image that appears behind the pins",
  "_backboneForms": {
    "type": "Asset",
    "media": "image"
  }
},
Screenshot 2023-01-16 at 17 29 41

Select

"_setCompletionOn": {
  "type": "string",
  "title": "Completion criteria",
  "description": "Whether completion is based on the learner having viewed all the narrative items - or just having viewed the component",
  "default": "allItems",
  "enum": [
    "inview",
    "allItems"
  ],
  "_backboneForms": "Select"
},
Screenshot 2023-01-16 at 17 31 00

Object

"_graphic": {
  "type": "object",
  "title": "Graphic",
  "default": {},
  "required": [
    "src"
  ],
  "properties": {
    ...
  }
}
Screenshot 2023-01-16 at 17 33 08

Array

"_items": {
  "type": "array",
  "title": "Items",
  "items": {
    ...
  }
}
Screenshot 2023-01-16 at 17 33 43

Adapt Specific properties

The _adapt keyword is used to group schema properties which are non-standard to the JSON schema specification and related to various Adapt-specific features.

"_adapt": {
  "editorOnly": true,
  "isSetting": true,
  "translatable": true
}
Property Type Description
editorOnly Boolean Determines whether the attribute should be included in output JSON
isSetting Boolean Attribute will appear in the ‘Settings’ section of the form
translatable Boolean Whether the attribute is a language-specific string for translation

Backbone Forms Specific properties

Backbone Forms is the library used to render forms from the input schemas. The _backboneForms keyword is used to group schema properties which are non-standard to the JSON schema specification and related to various Backbone Forms specific features.

_backboneForms": {
  "type": "Asset",
  "showInUi": false,
  "media": "image"
  "editorAttrs": {}
}

In most cases, it is only necessary to specify the type. In this case, the _backboneForms property also can also be a string value, e.g.

"_backboneForms": "Select"
Property Type Description
type String Override the type of Backbone Forms input to be used (by default, the type will be inferred from the schema property's type value). Accepted types: Asset, Text, Number, Password, TextArea, Checkbox, Checkboxes, Select, Radio, Object, Date, DateTime, List. See the Backbone Forms docs for more information.
showInUi Boolean Determines whether the attribute will be rendered in forms
media String When using a type of Asset, you can also restrict the AAT UI to only show assets of a specific type. The AAT stores the asset type based in its MIME type (e.g. files with a MIME type of image/png and image/jpeg would both have a type of image).
editorAttrs Object Extra options passed to the Backbone Forms input. See the Backbone Forms docs for more information.
Clone this wiki locally