warning: the following keywords are unknown and will be ignored
LazyLutra opened this issue · 0 comments
LazyLutra commented
JSON essage (checkStr) :
{
"addTarget_status": "0",
"area_name": "",
"code": 1,
"data": [{"data1":"t1"},{"data2":"t2"}],
"date": 20191111,
"detail": "成功!",
"month_id": 20191111,
"periodShowFlag": "",
"provId": "012",
"report_id": "R20190102",
"report_level": "5",
"title_name": "title"
}JSON schema message (schemaStr) :
{
"properties": {
"area_name": {
"type": "string"
},
"code": {
"type": "number"
},
"data": {
"items": {
"type": "string"
},
"type": "object"
},
"date": {
"type": "number"
},
"detail": {
"type": "string"
},
"month_id": {
"type": "number"
},
"provId": {
"type": "number"
},
"report_id": {
"type": "string"
},
"report_level": {
"type": "string"
},
"target_id": {
"type": "string"
},
"target_name": {
"type": "string"
}
},
"required": [
"code",
"detail",
"provId",
"date",
"data",
"target_id",
"target_name"
],
"type": "object"
}My validation code is :
JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
JsonNode schemaNode = JsonLoader.fromString(schemaStr);
JsonNode checkNode = JsonLoader.fromString(checkStr);
JsonSchema schema = factory.getJsonSchema(schemaNode);
ProcessingReport report = schema.validate(checkNode);Using version 2.2.10
I get the error "warning: the following keywords are unknown and will be ignored: [addTarget_status, area_name, data, date, detail, month_id, periodShowFlag, provId, report_id, report_level, title_name]"
Why is it the case?