I have the following schema for bellow happy path response
var responseSchema =
{
"type": "object",
"properties": {
"value": {
"type": "object",
"properties":{
"items": {
"type": "array",
…
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…
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…
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",
…
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…
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,…
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…
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 =…
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…
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",
…
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 =…
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…
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":…
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…
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",
…