Skip to content
This repository was archived by the owner on Dec 7, 2022. It is now read-only.

Commit 1bc12c1

Browse files
authored
Update README.md
1 parent a52096d commit 1bc12c1

File tree

1 file changed

+2
-86
lines changed

1 file changed

+2
-86
lines changed

README.md

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,3 @@
1-
# A JSON-schema $ref faker
2-
3-
[![Build Status](https://travis-ci.org/json-schema-faker/refaker.png?branch=master)](https://travis-ci.org/json-schema-faker/refaker) [![NPM version](https://badge.fury.io/js/refaker.png)](http://badge.fury.io/js/refaker) [![Coverage Status](https://coveralls.io/repos/json-schema-faker/refaker/badge.png?branch=master)](https://coveralls.io/r/json-schema-faker/refaker?branch=master)
4-
5-
Inspired on [json-schema-validator](https://github.com/fge/json-schema-validator) for JAVA, the `--fakeroot` option, actually.
6-
7-
If you're validating some RAML (like me) then you should validate your JSON-schemas and examples also.
8-
9-
For this purpose I'm using [ramlev](https://github.com/cybertk/ramlev) which is using [tv4](https://github.com/geraintluff/tv4), but you're encouraged to download any `$ref` manually before validating.
10-
11-
## Solution?
12-
13-
```javascript
14-
var tv4 = require('tv4'),
15-
refaker = require('refaker');
16-
17-
var data = { /* ... */ },
18-
schema = { /* ... */ };
19-
20-
refaker({
21-
schema: schema,
22-
fakeroot: 'http://example.com',
23-
directory: '/path/to/schemas'
24-
}, function(err, refs, schemas) {
25-
if (err) {
26-
console.log(err);
27-
} else {
28-
for (var id in refs) {
29-
// register resolved refs
30-
tv4.addSchema(id, refs[id]);
31-
}
32-
33-
// validates the first passed schema
34-
console.log(tv4.validateResult(data, schemas[0]));
35-
}
36-
});
37-
```
38-
39-
That's it.
40-
41-
## Options
42-
43-
- **schema** (object|aray)
44-
45-
The JSON-schema to validate.
46-
47-
- **schemas** (object|array)
48-
49-
Multiple JSON-schemas to validate at once.
50-
51-
This is an alias for the **schema** option.
52-
53-
- **fakeroot** (string)
54-
55-
If provided, any matching `$ref` will be resolved under the specified `directory`.
56-
57-
- **directory** (string)
58-
59-
A local path containing the JSON-schemas.
60-
61-
If missing, will use `process.cwd()` instead.
62-
63-
- **timeout** (number)
64-
65-
Timeout when resolving remote schemas, default to 200ms.
66-
67-
Any `$ref` found will be downloaded or faked locally.
68-
69-
## Callback
70-
71-
The given callback will receive three arguments:
72-
73-
- **err** (mixed)
74-
75-
Empty means success.
76-
77-
- **refs** (object)
78-
79-
Hash of resolved `$ref`s.
80-
81-
- **schemas** (array)
82-
83-
Normalized schemas if success (same order as input).
84-
85-
86-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/json-schema-faker/refaker/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
1+
# DEPRECATED
872

3+
Please use [json-schema-ref-parser](https://github.com/BigstickCarpet/json-schema-ref-parser) instead

0 commit comments

Comments
 (0)