1 of 9

Json Schema Generation Rule 1

As per JSON schema open API standards every layer of JSON Validation Schema Start with two JSON element. 1st element is "properties“ and 2nd element is "required“. “properties” contain JSON object of all the element in this layer and "required“ is array structure that contain mandatory element name in this layer. If no mandatory element is there in this layer no need add “required” element in the JSON schema.

{

"properties": { },

"required": []

}

2 of 9

Json Schema Generation Rule 2

All the element for this layer placed inside "properties“ element. In this example element name is “id” which placed inside the "properties“ element. If “id” is mandatory element in incoming or outgoing JSON or in PEGA screen put the “id” element in “required” array.

{

"properties": {

"id": {

"type": "integer"

}

},

"required": [“id”]

}

3 of 9

Json Schema Generation Rule 3

Each property contain JSON object of validation attribute name and its corresponding value. Like in this example “type” is validation attribute and type of “id” element is “integer”.

“type” is mandatory attribute for each element in JSON Schema

Below are the primitive data type supported .

“string”, ”integer”, ”decimal”, “double”, “boolean”, “date” , “datetime”.

Below are the complex data type supported .

“object”, “array” .

“type” attribute value is “object” or “array” create one more descendent layer like pega clipboard structure pages , pagelist inside top level page and contain “properties” and “required”. This is same clipboard data structure concept of PEGA , page containing page and page List and creating tree structure.

For PEGA page group presentation provide “type” attribute value as “object” and another attribute name “Subscript” and value should be pega “pxSubscript” property value.

{

"properties": {

"id": {

"type": "integer"

}

},

"required": []

}

{

"properties": {

“category": {

"type": “object“,

"properties": { },

"required": []

}

},

"required": []

}

{

"properties": {

“category": {

"type": “array“,

"properties": { },

"required": []

}

},

"required": []

}

{

"properties": {

“category": {

"type": “object“,

“Subscript”: “Customer”

"properties": { },

"required": []

}

},

"required": []

}

4 of 9

Json Schema Generation Rule 4

Like “type” attribute another validation attribute is “mode” . If “mode” is set to array to represent the data structure of array of scaler values . In this example “photoUrls” element contain array of string.

With mode array 3 more attribute can be associated.

  1. “minItems” 🡪 Contain the number of minimum items of the List.
  2. “maxItems” 🡪 Contain the number of maximum items of the List.
  3. “isUnique” 🡪 If set as true check for duplicate entries in the list.

{

"properties": {

"photoUrls": {

"type": "string",

"mode": "array",

"minItems" : 2,

"maxItems" : 4,

"isUnique" : "true",

"EditValidate": "pxIsValidURL"

}

},

"required": []

}

5 of 9

Json Schema Generation Rule 5

“minimum” is another validation attribute for a property . It contain integer value to specify lower bound of any numeric data type like “integer”, ”Double” , “Decimal” . For “string” type element its represent minimum length of the string.

For “date” or “DateTime” please add one valid date value which represent the lower bound of the date range .

{

"properties": {

"id": {

"type": "integer“,

“minimum” : 5

}

},

"required": []

}

6 of 9

Json Schema Generation Rule 6

“maximum” is another validation attribute for a property . It contain integer value to specify upper bound of any numeric data type like “integer”, ”Double” , “Decimal” . For “string” type element its represent maximum length of the string.

For “date” or “DateTime” please add one valid date value which represent the upper bound of the date range .

{

"properties": {

"id": {

"type": "integer“,

“minimum” : 5,

“maximum” : 10

}

},

"required": []

}

7 of 9

Json Schema Generation Rule 7

“enum” is another validation attribute for a property. It contains the array of allowable values of the property.

If the “enum” list is dynamic then need to mention a Pega List type data page containing the dynamic enum values and need to pass data page parameter using “parameter” attribute. Please refer to the Dynamic “enum” attribute example for complete syntax.

Static “enum” attribute

{

"properties": {

"status": {

"type": “string“,

“minimum” : 5,

“maximum” : 10,

“enum” : [“available”,” pending”,” sold”]

}

},

"required": []

}

Dynamic “enum” attribute

{

"properties": {

"status": {

"type": “string“,

“enum” : {

"datapage": "D_ClassList",

"lookat": "pyClassName" ,

“parameter” : [ {

“name”: "param1",

“value”: "Page1.prop1",

“isProperty”: true

},

{

“name”: "param2",

“value”: 123,

“isProperty”: false

}

]}

}

}

},

"required": []

}

8 of 9

Json Schema Generation Rule 8

EditValidate” is another validation attribute for a property. In contain PEGA edit validate rule name for pattern checking of the property etc.

In this example it is checking all the URL passed under “photoUrls” element is a valid URL or not.

{

"properties": {

"photoUrls": {

"type": "string",

"mode": "array",

"EditValidate": "pxIsValidURL"

}

},

"required": []

}

9 of 9

Json Schema Generation Rule 9

“ValidateRule” is another validation attribute for a property. In contain PEGA validate rule name and its applies to class for dependency check or other complex validation rule.

{

"properties": {

"SchemaVersion": {

"type": "String",

"ValidateRule" : {

"ruleName" : "CheckSchemaVersion",

"appliesTo" : "OZ8SSN-JSONSche-Work-JSONSchemaValidation"

}

}

},

"required": []

}