How do I update a schema definition?
Once a schema is created, it might be necessary at some point to edit it.
In this example, we will update the Administrator's persona (schema) by adding the SecurityPIN field. This field is used to validate a user of the voice application. This validation will secure sensitive data from unauthorized access.
First, be sure you are in the Experience Manager. Also, open an online JSON editor in another browser window. We recommend JSON Editor Online (http://www.jsoneditoronline.org/).
Adding the SecurityPIN field
Click User Management and then Personas
In the middle panel, click Administrators
Doing so populates the right-most panel with the Administrators persona.In the bar above the Schema edit window, click the Expand icon (the left-most icon) to show the contents of the schema.
Scroll through the Schema and notice there is no field with the label “SecurityPIN
Click the Hamburger menu in the lower left-hand corner and then the Pencil icon
Copy any field from the open curly bracket (“{”) before the label attribute to the closed curly bracket (“}”) after the type attribute
Toggle to your JSON editor and paste the field attributes
Note: if you included the comma in the last line you copied, the JSON editor may note there is an error in that line. Since we will place the SecurityPIN filed at the end of our field list, the comma is not necessary, so delete it.In the JSON editor, replicate the field definition as noted below
Copy the field definition you just created
The validation section includes three attributes. Pattern requires the SecurityPIN to be a number ([0-9]) that is 4 digits long. Maxlength specifies that SecurityPIN can be no more than 4 digits. Minlength specifies that SecurityPIN can be no fewer than 4 digits.
Case sensitivity is important. Refer to the table below the Schema edit window to ensure values are entered properly.
Adding the field definition to the Administrators Schema
Toggle back to the Administrators Persona
Scroll down to the bottom and place your cursor at the second to last line (“]”)
Paste the schema definition
Be sure the last square bracket doesn’t end up on the same line as the last curly bracket
Click the checkmark icon to save your work
View the new SecurityPIN field
Go back into the Administrators schema and click the Expand icon on the bar of the Schema edit window
Scroll down the list of fields until you find the SecurityPIN field
Note that when you saved the schema, Experience Manager added an automatically generated ID field