Text
This schema snippet shows how to add text properties and includes some of the different types of validation available to you, including patterns and enums.
The
dateWithPattern
andurlslug
properties demonstrate how to constrain the value entered using a regular expression defined by the pattern keyword. You can find out more about regular expressions in JSON Schema in the JSON Schema documentation.The
color
property shows how to define a property that allows the user to choose a color using the color picker. This is a Dynamic Content specific addition to JSON Schema. The color is returned in RGB format, for example: rgb(64, 100, 127).The
dateFormat
property defines a date using the "date" format introduced in JSON Schema draft 7. We use theexamples
keyword to give the user some example dates in the correct format.
Pre-requisitesLink copied!
None. This is a self contained schema.
How to useLink copied!
This example demonstrates most of the available string formats and validations. You should be able to modify any of these properties for use in your own schemas.
Text schema exampleLink copied!
Content form previewLink copied!
An example of creating a content item using a content type registered from the text example schema is shown in the image below.