postmanlabs/schemas

Name: schemas

Owner: Postman

Description: Repository of all schemas for JSON structures compatible with Postman (such as the Postman Collection Format)

Created: 2015-07-02 18:53:04.0

Updated: 2018-03-07 01:05:29.0

Pushed: 2018-01-24 15:30:15.0

Homepage: https://schema.getpostman.com/

Size: 222

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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
https = require('https'),
validate = require('is-my-json-valid');

input = {
/* JSON of a collection V1 */


e fetch the schema from server and when it is received, 
alidate our input JSON against it.
s.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
https = require('https'),
tv4 = require('tv4');

input = {
/* JSON of a collection V1 */


e fetch the schema from server and when it is received,
alidate our input JSON against it.
s.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
rt requests  # make sure this is installed
 jsonschema import validate
 jsonschema.exceptions import ValidationError

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

_input = {}  # Whatever needs to be validated.


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

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.