Questions tagged [tv4]

tv4 is a tiny Validator for v4 JSON Schema.

tv4 is a tiny Validator for v4 JSON Schema.

https://github.com/geraintluff/tv4

30 questions
1
vote
1 answer

Postman: schema validation passes even with a wrong response

I have the following schema for bellow happy path response var responseSchema = { "type": "object", "properties": { "value": { "type": "object", "properties":{ "items": { "type": "array", …
ChinS
  • 199
  • 2
  • 11
0
votes
1 answer

Postman Trouble Validating All Objects in JSON Schema

It seems like it should be straight-forward enough, but I'm having problems fully validating JSON response data within Postman (Tiny Validator 4) when there is more than one object returned. When doing negative testing, I found it is only checking…
THansenite
  • 57
  • 4
0
votes
1 answer

Optional Json validation using tv4 - Javascript

I am trying to validate my JSON Schema using tv4. It is working and validation returns True. But, in my case the the JSON collection "first, second, and third" will not be available all time. How do I write the schema in this situation? My JSON…
Vineesh TP
  • 7,755
  • 12
  • 66
  • 130
0
votes
1 answer

json schema validation using patternProprties with tv4

I have a json like: {"post": {"someKey": {"anotherKey":"anotherValue"}}} and where the first key is a valid http method and can be either of - post, get etc all valid http method at runtime. Here is my schema var schema = { "type": "object", …
user8479984
  • 451
  • 2
  • 9
  • 23
0
votes
1 answer

Can I validate json Schema draft-7 with tv4?

I have to upgrade a javascript application that validates json with json schema. The old version is using tv4 to validate json schema draft 4. I need to use draft-7 in the new software. I just replace a draft-7 json file in the current code. It…
James Hameson
  • 331
  • 1
  • 4
  • 10
0
votes
1 answer

Validating JSON schema in Postman

When using Postman I validate the JSON response like so: tv4.addSchema(globalSchema); const valResult = tv4.validate(data, schema); // schema is an object, which is a subschema from the larger globalSchema which works fine,…
Friso
  • 1,080
  • 6
  • 37
0
votes
1 answer

How can I log all failures in tv4.validateMultiple to Test Results tab with correct fail status

I have been able to get the error messages produced from tv4.validateMultiple to show in the Test Results, but I cannot figure out how to set them to show fail status. var jsonData = JSON.parse(responseBody); var schema = {...contains…
SleepyD
  • 39
  • 1
  • 2
  • 9
0
votes
1 answer

Postman: JSON schema validation always passes even if wrong schema given

I am using Postman and its built-in Json schema validator library (tv4). There are many earlier posts on the same issue and yet I see that only in some cases issue is resolved. Here is my Test Script code: var data =…
NKM
  • 602
  • 1
  • 6
  • 18
0
votes
0 answers

JSON Schema validation using tv4 or any other validator

I have a some kind JSON structure within an array. The requirement is: 1. All the JSON object within the array can be optional. 2. Each JSON can have its own set of properties and can be complex and nested. 3. Each JSON object will have a set of…
user8479984
  • 451
  • 2
  • 9
  • 23
0
votes
1 answer

JSON schema validation is failing in Postman even if it's valid

I need to validate following response against JSON schema. The problem is it's always failing even if schema is valid. { "items": [ { "uuid": "f68ad4ba-a11e-485d-a2d7-17b9b07bd8d3", "name": "Code", …
Julia
  • 1
  • 2
0
votes
1 answer

TV4: to get more details of detected errors

I am using tv4 to detect schema errors. I tried getting all results using: tv4.validateMultiple call which detected multiple errors but did not say where or why. Is there any way in tv4 to provide more elaborate information of failures? var res =…
Ulysses
  • 5,616
  • 7
  • 48
  • 84
0
votes
1 answer

Trying to use external reference in Postman with tv4

I'm trying to use an external reference in Postman and validating that with tv4. This is my code: var schema = tv4.getSchema('https://schema.getpostman.com/json/collection/v1/'); console.log(tv4.validate(responseBody, schema); and after testing…
John
  • 87
  • 11
0
votes
1 answer

json schema doesn't work for empty response body

I have write one schema to validate the response body. And set all the items as "required". But when the body return empty array, it till PASS, which supposed should be FAIL. Schema like this: var schema = { "$schema":…
0
votes
3 answers

JsonSchema is not validated with oneOf

Need help to find the bug with this schema. It has oneOf operator. Schema is here : `{ "type": "object", "required": [ "type", "body" ], "properties": { "type": { "description": "type of the…
Bhoomi
  • 781
  • 6
  • 22
0
votes
3 answers

How to validate that json object fields are equal with nodeJS tv4 validation lib?

I'm writing code for validation of json request for user creation method. Validator have to check whether the email field is equal to field confirmEmail. Request example: { "firstName":"Homer", "lastName":"Simpson", …
Vladimir
  • 12,753
  • 19
  • 62
  • 77
1
2