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
Hi team, i am not able to validate my json with the provided schema. The method is returning true for any provided schema for my json. Kindly help
Below are the details:
raw json
{
"user_id": 954,
"first_name": "Claudia",
"last_name": "Hackbarth",
"user_role": "Alum",
"permission": {
"german_colleague": false,
"create_job": true,
"create_profiles": true,
"search_profile": false,
"admin": false
},
"status": {
"change_password": false
},
"exp": 1511265571,
"iss": "issuer_name",
"aud": "client"
}
for field "user_id" in json i have mentioned "wrong_entity" in my schema.
For wrong schema above, method "chakram-expectation.schema" is returning true[unexpected]. Am I missing some config changes here.
The text was updated successfully, but these errors were encountered:
Your schema is only checking that the user_id is present, which it is. The schema validation for tv4 is the same one postman uses and I have run into the same situation in the past. since wrong_entity is not required and not present, tv4 validator ignores that property. If that property was there, it would validate against your definition.
Hi team, i am not able to validate my json with the provided schema. The method is returning true for any provided schema for my json. Kindly help
Below are the details:
raw json
{
"user_id": 954,
"first_name": "Claudia",
"last_name": "Hackbarth",
"user_role": "Alum",
"permission": {
"german_colleague": false,
"create_job": true,
"create_profiles": true,
"search_profile": false,
"admin": false
},
"status": {
"change_password": false
},
"exp": 1511265571,
"iss": "issuer_name",
"aud": "client"
}
schema
var expectedSchema={
properties: {
wrong_entity: {type: "integer"},
first_name: {type: 'number'},
last_name: {type: 'string'},
user_role: {type: 'string'},
permission: {
type: "object",
properties: {
german_colleague: {type: "boolean"},
create_job: {type: "boolean"},
create_profiles: {type: "boolean"},
search_profile: {type: "boolean"},
admin: {type: "boolean"}
}
},
status: {
type: "object",
properties: {
change_password: {type: "boolean"}
}
},
exp: {type: "integer"},
iss: {type: 'string'},
aud: {type: 'string'}
},
required: ["user_id"]
};
expect(response).to.have.schema(expectedSchema);
For wrong schema above, method "chakram-expectation.schema" is returning true[unexpected]. Am I missing some config changes here.
The text was updated successfully, but these errors were encountered: