forked from postmanlabs/openapi-to-postman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (29 loc) · 815 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
const SchemaPack = require('./lib/schemapack.js').SchemaPack;
module.exports = {
// Old API wrapping the new API
convert: function(input, options, cb) {
var schema = new SchemaPack(input, options);
if (schema.validated) {
return schema.convert(cb);
}
return cb(null, schema.validationResult);
},
validate: function (input) {
var schema = new SchemaPack(input);
return schema.validationResult;
},
getMetaData: function (input, cb) {
var schema = new SchemaPack(input);
schema.getMetaData(cb);
},
mergeAndValidate: function (input, cb) {
var schema = new SchemaPack(input);
schema.mergeAndValidate(cb);
},
getOptions: function(mode, criteria) {
return SchemaPack.getOptions(mode, criteria);
},
// new API
SchemaPack
};