forked from Mermade/openapi_optimise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
44 lines (35 loc) · 1.18 KB
/
index.js
File metadata and controls
44 lines (35 loc) · 1.18 KB
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
38
39
40
41
42
43
44
var _ = require('lodash');
var parameters = require('./parameters.js');
var responses = require('./responses.js');
var tags = require('./tags.js');
var prodcons = require('./prodcons.js');
var definitions = require('./definitions.js');
var security = require('./security.js');
var empty = require('./empty.js');
var actions = require('./actions.js');
var models = require('./models.js');
module.exports = {
defaultOptimisations : function(swagger,options) {
var opt = _.cloneDeep(swagger);
opt = empty.optimise(opt,options);
opt = actions.optimise(opt,options);
opt = parameters.optimise(opt,options);
opt = responses.optimise(opt,options);
opt = tags.optimise(opt,options);
opt = prodcons.optimise(opt,options);
opt = security.optimise(opt,options);
opt = definitions.optimise(opt,options);
return opt;
},
minimumOptimisations : function(swagger,options) {
var opt = _.cloneDeep(swagger);
options.minimum = true;
opt = parameters.optimise(opt,options);
return opt;
},
nonDefaultOptimisations: function(swagger,options) {
var opt = _.cloneDeep(swagger);
opt = models.optimise(opt,options); // optionally handles expand
return opt;
}
};