Skip to content

Commit aaec696

Browse files
committed
Update README with new buttons and indent for code examples.
1 parent c95e457 commit aaec696

File tree

1 file changed

+62
-60
lines changed

1 file changed

+62
-60
lines changed

README.md

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# chai-json-schema
22

3-
[![Build Status](https://secure.travis-ci.org/Bartvds/chai-json-schema.png?branch=master)](http://travis-ci.org/Bartvds/chai-json-schema) [![Dependency Status](https://gemnasium.com/Bartvds/chai-json-schema.png)](https://gemnasium.com/Bartvds/chai-json-schema) [![NPM version](https://badge.fury.io/js/chai-json-schema.png)](http://badge.fury.io/js/chai-json-schema)
3+
[![build:?](https://travis-ci.org/chaijs/chai-json-schema.svg?branch=master&style=flat-square)](https://travis-ci.org/chaijs/chai-json-schema)
4+
[![dependencies:?](https://img.shields.io/npm/dm/chai-json-schema.svg?style=flat-square)](https://www.npmjs.com/packages/chai-json-schema)
5+
[![npm:](https://img.shields.io/npm/v/chai-json-schema.svg?style=flat-square)](https://www.npmjs.com/packages/chai-json-schema)
46

57
> [Chai](http://chaijs.com/) plugin with assertions to validate values against [JSON Schema v4](http://json-schema.org/).
68
@@ -63,36 +65,36 @@ Validate that the given javascript value conforms to the specified JSON Schema.
6365

6466
````js
6567
var goodApple = {
66-
skin: "thin",
67-
colors: ["red", "green", "yellow"],
68-
taste: 10
68+
skin: 'thin',
69+
colors: ['red', 'green', 'yellow'],
70+
taste: 10
6971
};
7072
var badApple = {
71-
colors: ["brown"],
72-
taste: 0,
73-
worms: 2
73+
colors: ['brown'],
74+
taste: 0,
75+
worms: 2
7476
};
7577
var fruitSchema = {
76-
"title": "fresh fruit schema v1",
77-
"type": "object",
78-
"required": ["skin", "colors", "taste"],
79-
"properties": {
80-
"colors": {
81-
"type": "array",
82-
"minItems": 1,
83-
"uniqueItems": true,
84-
"items": {
85-
"type": "string"
86-
}
87-
},
88-
"skin": {
89-
"type": "string"
90-
},
91-
"taste": {
92-
"type": "number",
93-
"minimum": 5
94-
}
95-
}
78+
title: 'fresh fruit schema v1',
79+
type: 'object',
80+
required: ['skin', 'colors', 'taste'],
81+
properties: {
82+
colors: {
83+
type: 'array',
84+
minItems: 1,
85+
uniqueItems: true,
86+
items: {
87+
type: 'string'
88+
}
89+
},
90+
skin: {
91+
type: 'string'
92+
},
93+
taste: {
94+
type: 'number',
95+
minimum: 5
96+
}
97+
}
9698
};
9799

98100
//bdd style
@@ -164,41 +166,41 @@ Use the asynchronous preparation feature of your favourite test runner to preloa
164166

165167
before(function (done) {
166168

167-
// iterate missing
168-
var checkMissing = function (callback) {
169-
var missing = chai.tv4.getMissingUris();
170-
if (missing.length === 0) {
171-
// all $ref's solved
172-
callback();
173-
return;
174-
}
175-
// load a schema using your favourite JSON loader
176-
// (jQuery, request, SuperAgent etc)
177-
var uri = missing.pop();
178-
myFavoriteJsonLoader.load(uri, function (err, schema) {
179-
if (err || !schema) {
180-
callback(err || 'no data loaded');
181-
return;
182-
}
183-
// add it
184-
chai.tv4.addSchema(uri, schema);
185-
// iterate
186-
checkMissing(callback);
187-
});
188-
};
189-
190-
// load first instance manually
169+
// iterate missing
170+
var checkMissing = function (callback) {
171+
var missing = chai.tv4.getMissingUris();
172+
if (missing.length === 0) {
173+
// all $ref's solved
174+
callback();
175+
return;
176+
}
177+
// load a schema using your favourite JSON loader
178+
// (jQuery, request, SuperAgent etc)
179+
var uri = missing.pop();
191180
myFavoriteJsonLoader.load(uri, function (err, schema) {
192-
if (err || !schema) {
193-
done(err || 'no data loaded');
194-
return;
195-
}
196-
// add it
197-
chai.tv4.addSchema(uri, schema);
198-
199-
// start checking
200-
checkMissing(done);
181+
if (err || !schema) {
182+
callback(err || 'no data loaded');
183+
return;
184+
}
185+
// add it
186+
chai.tv4.addSchema(uri, schema);
187+
// iterate
188+
checkMissing(callback);
201189
});
190+
};
191+
192+
// load first instance manually
193+
myFavoriteJsonLoader.load(uri, function (err, schema) {
194+
if (err || !schema) {
195+
done(err || 'no data loaded');
196+
return;
197+
}
198+
// add it
199+
chai.tv4.addSchema(uri, schema);
200+
201+
// start checking
202+
checkMissing(done);
203+
});
202204
});
203205
````
204206

0 commit comments

Comments
 (0)