mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
38 lines
815 B
JavaScript
38 lines
815 B
JavaScript
'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
|
|
};
|