forked from Mermade/widdershins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (29 loc) · 854 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
'use strict';
const openapi2 = require('./openapi2.js');
const openapi3 = require('./openapi3.js');
const asyncapi = require('./asyncapi.js');
const semoasa = require('./semoasa.js');
function convert(api, options, callback) {
if (typeof api === 'string') {
let apiblueprint = require('./apiblueprint.js');
apiblueprint.convert(api, options, callback);
}
else if (api.swagger) {
openapi2.convert(api, options, callback);
}
else if (api.openapi) {
openapi3.convert(api, options, callback);
}
else if (api.asyncapi) {
asyncapi.convert(api, options, callback);
}
else if (api.openapiExtensionFormat) {
semoasa.convert(api, options, callback);
}
else {
callback(new Error('Unrecognised input format'));
}
}
module.exports = {
convert: convert
};