Repository of all schemas for JSON structures compatible with Postman (such as the Postman Collection Format)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
json/collection
LICENSE.md
README.md

README.md

Postman Schemas

Repository of all schemas for JSON structures compatible with Postman (such as the Postman Collection Format). The schemas are also hosted online, at schema.getpostman.com.

Usage

All the schemas in this repository are valid JSON Schemas, compliant with the JSON-Schema, Draft 4. As such, they can be used with a number of tools to validate arbitrary JSON blobs, as show below:

Examples: JavaScript

is-my-json-valid

var https = require('https'),
    validate = require('is-my-json-valid');

var input = {
    /* JSON of a collection V1 */
};

// we fetch the schema from server and when it is received, 
// validate our input JSON against it.
https.get('https://schema.getpostman.com/json/collection/v1/', function (response) {
    var body = '';

    response.on('data', function (d) {
        body += d;
    });

    response.on('end', function () {
        var validate = validator(JSON.parse(body));
        console.log(validate(input) ? 'It is a valid collection!' : 'It is not a valid collection!');
    });
});

tv4

var https = require('https'),
    tv4 = require('tv4');

var input = {
    /* JSON of a collection V1 */
};

// we fetch the schema from server and when it is received,
// validate our input JSON against it.
https.get('https://schema.getpostman.com/json/collection/v1/', function (response) {
    var body = '';

    response.on('data', function (d) {
        body += d;
    });

    response.on('end', function () {
        var result = tv4.validate(input, JSON.parse(body));
        console.log((result) ? 'It is a valid collection!' : 'It is not a valid collection!');
    });
});

Example: Python

jsonschema

import requests  # make sure this is installed
from jsonschema import validate
from jsonschema.exceptions import ValidationError

schema = requests.get('https://schema.getpostman.com/json/collection/v1/').json()

test_input = {}  # Whatever needs to be validated.

try:
    validate(test_input, schema)
except ValidationError:
    print 'It is not a valid collection!'
else:
    print 'It is a valid collection!'