Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// The JSON Schema that we place into the Initial Script
// section of the Runscope API test.
var rosterResponse = {
"definitions": {
"player": {
"id": "player",
"type": "object",
"required": ["player_number","guid","name"],
"properties": {
"player_number": { "type": "integer" },
"guid": { "type": "string" },
"name": { "type": "string" }
"title": "roster schema v1",
"type": "object",
"required": ["roster"],
"properties": {
"roster": {
"type": "array",
"items": { "$ref": "#/definitions/player" }
// The JavaScript assertion that picks up the rosterResponse
// global variable from above, and the Chai-JSON assertion..
// This we paste into the Scripts section of the request
// step.
var rosterResponse = variables.get("rosterResponse");
var data = JSON.parse(response.body);
assert.jsonSchema(data, rosterResponse);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.