You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I use the rest-assured and encounter the issue about json-schema-validator, could you please help me resolve this issue below?
define a definitionsSchema.json like below { "$schema": "http://json-schema.org/draft-04/schema#", "title": "BasicChargeAndOrderSchema", "description": "定义一些用于校验 charge/order 的基本 schema", "balanceBonus": { "properties": { "id": { "type": "string", "pattern": "^65[0-9]{22}$" } } }, "recharge": { "properties": { "balance_bonus": { "oneOf": [ { "type": "object", "$ref": "#/balanceBonus" }, { "type": "null" } ] } } } }
2.define rechargeCreateSchema.json that will be used to validate the json file { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Recharge创建", "description": "此 schema 用于校验 recharge 的创建", "type": "object", "allOf": [ { "$ref": "definitionsSchema.json#/recharge" } ] }
3.validator the json below { "balance_bonus": null }
Actual Result: failed! because it ["matched":2,"nrSchemas":2]
Response body doesn't match expectation.
Expected: The content to match the given JSON schema.
error: instance failed to match all required schemas (matched only 0 out of 1)
level: "error"
schema: {"loadingURI":"file:/schemas/rechargeCreateSchema.json#","pointer":""}
instance: {"pointer":""}
domain: "validation"
keyword: "allOf"
matched: 0
nrSchemas: 1
reports: {"/allOf/0":[{"level":"error","schema":{"loadingURI":"file://schemas/definitionsSchema.json#","pointer":"/recharge/properties/balance_bonus"},"instance":{"pointer":"/balance_bonus"},"domain":"validation","keyword":"oneOf","message":"instance failed to match exactly one schema (matched 2 out of 2)","matched":2,"nrSchemas":2,"reports":{"/recharge/properties/balance_bonus/oneOf/0":[],"/recharge/properties/balance_bonus/oneOf/1":[]}}]}
Other info:
If the "balance_bonus" is not null, that's ok!
The text was updated successfully, but these errors were encountered:
Hello,
I use the rest-assured and encounter the issue about json-schema-validator, could you please help me resolve this issue below?
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "BasicChargeAndOrderSchema", "description": "定义一些用于校验 charge/order 的基本 schema", "balanceBonus": { "properties": { "id": { "type": "string", "pattern": "^65[0-9]{22}$" } } }, "recharge": { "properties": { "balance_bonus": { "oneOf": [ { "type": "object", "$ref": "#/balanceBonus" }, { "type": "null" } ] } } } }
2.define rechargeCreateSchema.json that will be used to validate the json file
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Recharge创建", "description": "此 schema 用于校验 recharge 的创建", "type": "object", "allOf": [ { "$ref": "definitionsSchema.json#/recharge" } ] }
3.validator the json below
{ "balance_bonus": null }
Actual Result: failed! because it ["matched":2,"nrSchemas":2]
Response body doesn't match expectation.
Expected: The content to match the given JSON schema.
error: instance failed to match all required schemas (matched only 0 out of 1)
level: "error"
schema: {"loadingURI":"file:/schemas/rechargeCreateSchema.json#","pointer":""}
instance: {"pointer":""}
domain: "validation"
keyword: "allOf"
matched: 0
nrSchemas: 1
reports: {"/allOf/0":[{"level":"error","schema":{"loadingURI":"file://schemas/definitionsSchema.json#","pointer":"/recharge/properties/balance_bonus"},"instance":{"pointer":"/balance_bonus"},"domain":"validation","keyword":"oneOf","message":"instance failed to match exactly one schema (matched 2 out of 2)","matched":2,"nrSchemas":2,"reports":{"/recharge/properties/balance_bonus/oneOf/0":[],"/recharge/properties/balance_bonus/oneOf/1":[]}}]}
Other info:
If the "balance_bonus" is not null, that's ok!
The text was updated successfully, but these errors were encountered: