Hello,
I’m working on application based on rest json api.
I’ve found method on JSON component which from description should validate json data againt json schema, and I thought I’ll use it to make sure data I’m sending are correct, but what ever data I’ll use validation method (coldbox.system.core.conversion.JSON) returns true.
schema I’m used for test looks like that:
{
“$schema”: “http://json-schema.org/draft-04/schema#”,
“title”: “Product”,
“description”: “A product from Acme’s catalog”,
“type”: “object”,
“properties”: {
“id”: {
“description”: “The unique identifier for a product”,
“type”: “integer”
},
“name”: {
“description”: “Name of the product”,
“type”: “string”
},
“price”: {
“type”: “number”,
“minimum”: 0,
“exclusiveMinimum”: true
}
},
“required”: [“id”, “name”, “price”]
}
test data:
var data = {“tName” = 1};
jsonPlugin.encode(data);
Given data are completely different then required by schema, but method still returns positive result of validation.
Can you tell me where is a problem ?
Best regards
MW