I'm totally new to raml and JSON schema so I'm still cutting my teeth and learning.
I have the following schema which has a "type":"array" but just a list of items with no properties.
schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"pushNotifDevices" : {
"type": "array",
"description" : "",
"items": {
"applicationId": {
"type": "boolean",
"example":"CTS",
"description":"This application ID identifies."
},
"deviceType":{
"type": "string",
"enum":["ANDROID"],
"description":"This enum indicates the type of device."
},
"deviceId": {
"type":"string",
"maxLength":1,
"description":"Unqiue DeviceID."
},
"notifDeviceId": {
"type":"string",
"maxLength":1,
"description":"This ID."
},
"active" : {
"type":"boolean",
"default":True,
"description":"Boolean to determine if the device is active."
},
"failureDescription" : {
"type":"string",
"maxLength":1,
"description":"This indicates the reason."
}
},
"required": [
"applicationId",
"deviceType",
"deviceId",
"notifDeviceId"
]
}
}
}
This is apparently preventing me from simply using the schema as it exists to validate against as without properties no validation occurs on this array. Looking through my various schemas I see that objects are being defined with properties, but arrays are not.
So, this brings me to my questions:
Is this an issue with my schema? I'm not seeing any documentation in regards to arrays as to whether they should have properties defined.
Or is this simply something I must manually modify in the schema to support being able to use validation?
I was really hoping for my first pass at this to be able to use the schema as provided, and have the tool find type mismatches, enums that don't bind to the list, required fields that are missing, parameters that are totally missing, etc. All of the low hanging fruit.
Many thanks.