Setting validation constraints
It is possible to add validation constraints to the JSON objects defined in file activityAPI-1.0.schema.json. For example, you can define a certain JSON property as being required, or, stipulate the maximum length of a user-supplied field.
File activityAPI-1.0.schema.json exists in the following directory in
the Studio Project window:
Adding validation constraints to the JSON schema
The following example code updates the NewActivity object defined in file
activityAPI-1.0.schema.json to set the length of the
subject property to a maximum of 64 characters
"NewActivity" : {
"properties" : {
"activityPattern" : {
"type" : "string"
},
"accountNumber" : {
"type" : "string"
},
"subject" : {
"type" : "string",
"maxLength" : 64
},
"description" : {
"type" : "string"
},
"jobNumber" : {
"type" : "string"
},
"priority" : {
"type" : "string",
"x-gw-type" : "typekey.Priority"
},
"mandatory" : {
"type" : "boolean"
},
"targetDate" : {
"type" : "string",
"format" : "date-time"
},
"escalationDate" : {
"type" : "string",
"format" : "date-time"
}
}
}
