The schema editor
The schema editor makes it easier to create and edit content type schemas. Schemas can still be created and stored externally to Dynamic Content in AWS, GitHub or whatever hosting service you choose, but the editor allows you to create, edit and manage schemas within your Dynamic Content hub. The schema editor includes snippets for most common property types, validates your syntax as you type and includes a preview feature that lets you see how content created using a schema will look in the content editing window. You can also use the editor for creating slot type schemas, as well as managing partials, or common definitions that can be used in many different schemas.
On this page we'll provide an overview of the features of the schema editor using the example of a simple text block. For more details about editing an existing schema, schema versioning and archiving schemas, see the viewing and editing schemas page.
There are several other examples in this section:
Using partials shows how to use the schema editor to create a partial- a schema with just a definitions section- and include these definitions in other schemas. It also shows how to include and refer to a definitions section within the same content type schema.
On this page
- Create a content type schema and give it a unique URL. The URL just needs to be valid to ensure that the schema is valid JSON schema format. The URL will not be resolved and we do not enforce any naming standards
- Choose the validation to be used by the schema editor. For a content type schema choose "content type". You can also create slot schemas and partials
- Save the schema and open the schema editing window
- Add the properties you require. The schema editor provides shortcuts for most property types. You can preview how content created from this schema will appear in the content editing form
- Save the schema. The schema editor will only allow you to the save the schema if it is valid
- Register a content type from the schema. To create a content type you specify the schema URL, label and optionally an icon, card and visualizations. You also select which repositories the content type is associated with.
- The content type is now available for the user to create content.
The following example takes you through these steps in more detail.
Creating a content type schema
To create or edit a content type schema, choose "Content type schemas" from the development menu in the Dynamic Content app. If the Development menu is not shown, contact your Custom Success Manager to ensure that you have the required permissions.
The content type schemas screen will be shown. From here you can view existing schemas or create a new one. To create a new schema click the "Create schema" button as shown in the image below.
A dialog will be displayed from which you can choose to create a schema from one of the built in schema templates, or build your own from scratch. In this section we'll show you how to build your own schema. For more information about the content type schema templates, see the schema examples page.
Select "Code from scratch" and click the "Get started" button.
Give the schema a unique ID. To ensure that it is a valid JSON Schema, the schema ID must be a valid URL. The URL will never be resolved, so it can be anything you like. In this example we're using http://example.com/simpletextblock.json and you may wish to use your own domain as a way of organizing your schema types, but we don't enforce any standard.
Choose the type of schema you wish to create: content type, slot or partial. The schema editor will validate the schema based on what it's being used for. Slots can only contain certain property types, while partials refer to schemas containing definitions that can be shared and reused between multiple schemas and will just contain a "definitions" section. In this case we're creating a content type.
Click the "Create schema" button to open the schema for editing.
From the content type schema window you can double-click a schema to open it for editing or choose "Open" from its contextual menu.
The schema editor opens with a outline of the schema already filled in. All you need to do is add the properties you require.
The editor has type ahead features that will attempt to fill in properties as you type or you can choose the properties you want to add from the "Add property" menu. From here you can choose simple properties such as strings, rich text and numbers as well as chooser properties: content links and content references, image and video types. We also support arrays and localized properties. For the simple text block we'll choose a text property.
The text property is added with default values for the property name, title and description, as well as the validation. Change these values to whatever you want, ensuring the property name is unique within the schema. In this example we want to allow the user to enter a string of up to 200 characters, so we'll change the maxLength to 200.
The content form preview
You can show a preview of how a content type registered from this schema will look in the content editing window by clicking the "preview" icon as highlighted below.
The preview also applies any validation that you have defined for a property, so in this case the text is limited to 200 characters.
Adding array properties
The add property menu also provides some shortcuts for adding lists. In the text block example we want to add an array of paragraphs, so we choose "List of text" from the menu. You can also choose images, content links or enums- which are represented in JSON Schema as enums.
An outline of the array property is added to the schema window. For this example the maximum number of items will be set to 4. Notice that the preview shows the array as it will appear in the content editing window, allowing up to 4 array items to be added.
When you've added all the properties you want in your content type schema, click the "Save" button to save it. If any validation errors are shown in the schema editor window, you'll need to correct these before the schema can be saved.
Previewing JSON output
You can view sample JSON data generated from the current schema by choosing the "Sample JSON Output" tab. The generated JSON includes sample values for all property types including strings, images, video and any localized properties. This feature helps save you time when creating your rendering code and templates by giving you example JSON output to work with.
You can configure the format of the generated JSON from the settings dialog. The "Show optional properties" setting allows you to control how optional properties, those not defined as required in your schema, are included in the JSON output. If you choose "some", then the optional properties will be chosen randomly, while if you choose "none", only the required properties will be included.
Sample names can also be included to be used for images and video, so you can include example asset names from your Content Hub account.
You can also choose the output format: either "SDK" format, which represents content as a content tree, or JSON linked data (JSON-LD). In most cases you will work with content in SDK format. See the Content Delivery API and Content Delivery SDK pages for more details.
In the image below we have chosen to display some of the optional properties. The properties displayed will be chosen at random and have random property lengths. If you choose to include all optional properties then the properties are generated to use the maximum length of each property.
Registering a content type
In order for the content type schema to be used, you first have to use it to register a content type. A content type consists of the schema URL, together with a label and optionally an icon, card and one or more visualizations. Content types are what are what the users will use to create content in the production view of the Dynamic Content app.
There are two ways of choosing to register a content type: from the schema editor, or by choosing "Register content type" in the content types window. On this page we'll show you how to register a content type from the schema editor. The registering content types page shows you how to register a content type from the content types window in detail.
When you've finished creating a content type schema, you can choose to register a schema as a content type by choosing "Save and register as content type" from the schema editor Save menu. If you've already saved your schema, then the menu item will be "Register as a content type".
The content type registration window will then open, with your schema already selected.
For the text block we'll give it a label of "Simple text block" and enable it on the repository named "content". See registering content types for more details about associating content types with repositories and adding icons, cards and visualizations. Once a content type is registered, you can update its label, icon, card and visualization, but the URL cannot be changed.
When you've filled in all the fields you require, click the "Save" button. The content type is now registered with the hub and available to use to create content in the repositories you associated it with.
In the production view choose "Create content". The simple text block is shown and you can use this to create content.
The content editing window opens and the user can fill in the fields and save the content.
Video: Creating and registering a content type schema
Using the example of a simple banner, this video shows you how to create a content type schema with the Schema Editor, how to register the schema as a content type and how this content type is used to create content.