JSON schema v4 validation

GET https://postman-echo.com/get?foo1=bar1&foo2=bar2

A schema is simply a declaration describing the structure of data. Some teams use a specific schema and would like to validate their server responses against this schema. You can define a custom schema, and validate your your server responses against this schema.

One of the API tests that we previously talked about is validating that the response payloads returned from the server are well-formed. You can do that by making assertions that elements in the response match your expectations.

Review the test written under the Tests tab to validate that response payloads returned from the server are well-formed.

This example uses Tiny Validator for JSON Schema v4. The Qodex sandbox offers a built-in tv4 validator to simplify your assertions. Use json-schema draft v4 to validate simple values and complex objects using a rich validation vocabulary (examples).

Request Params

KeyDatatypeRequiredDescription
foo1string
foo2string

RESPONSES

status: OK

{"args":{"foo1":"bar1","foo2":"bar2"},"headers":{"x-forwarded-proto":"https","host":"postman-echo.com","accept":"*/*","accept-encoding":"gzip, deflate","cache-control":"no-cache","cookie":"sails.sid=s%3AwJjqwuZdKqKOiQ9FVnzMr8QoFaPFxpfD.ldt8sflpZLQkRbE1yyJtcIZIuirLfn4yFsVxtvFolWY","postman-token":"9dd498fe-4233-4512-a506-974f85cab10d","user-agent":"PostmanRuntime/7.3.0","x-forwarded-port":"443"},"url":"https://postman-echo.com/get?foo1=bar1\u0026foo2=bar2"}