Skip to content

Commit cfb683b

Browse files
author
Dom Harrington
committed
Removing openap.is stuff
1 parent 79d907c commit cfb683b

File tree

1 file changed

+1
-67
lines changed

1 file changed

+1
-67
lines changed

api.js

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ exports.api = function(args, opts) {
1818
// a file name will always have a "."
1919
if (action && action.indexOf('.') >= 0) {
2020
action = 'push';
21-
opts['in'] = args[0];
2221
}
2322

2423
var actionObj = exports.load(action);
@@ -32,72 +31,7 @@ exports.api = function(args, opts) {
3231
'opts': opts,
3332
};
3433

35-
if(actionObj.swagger) {
36-
utils.findSwagger(info, function(err, swagger, file) {
37-
if(err) {
38-
console.error(err);
39-
return;
40-
}
41-
42-
var apiId = swagger.info.title ? uslug(swagger.info.title) : crypto.randomBytes(7).toString('hex');
43-
44-
request.get('https://openap.is/check/' + apiId, {json: true}, (err, check) => {
45-
if(!swagger['x-api-id']) {
46-
47-
if(check.body.exists) {
48-
// If this already exists, rather than giving a confusing
49-
// "permissions" error, we just add a suffix
50-
apiId += '-' + crypto.randomBytes(2).toString('hex');
51-
}
52-
53-
console.log('Your Swagger file needs a unique "x-api-id" property to work. Do you want us to add it automatically?');
54-
var add = prompt('Add automatically? ' + '(y/n) '.grey);
55-
if(add.trim()[0] != 'y') {
56-
console.log("");
57-
console.log("Okay! To do it yourself, edit "+file.split('/').slice(-1)[0].yellow+" and add the following 'x-api-id' line:");
58-
exampleId(file, apiId);
59-
60-
console.log("");
61-
console.log("Make sure you commit the changes so your team is all using the same ID.");
62-
63-
process.exit();
64-
} else {
65-
66-
if(utils.addId(file, apiId)) {
67-
console.log("Success! ".green + "We added it to your Swagger file! Make sure you commit the changes so your team is all using the same ID.");
68-
console.log("");
69-
swagger['x-api-id'] = apiId;
70-
} else {
71-
console.log("We weren't able to add the ID automatically. In "+file.split('/').slice(-1)[0].yellow+", add the following 'x-api-id' line:");
72-
73-
exampleId(file, apiId);
74-
75-
console.log("Make sure you commit the changes so your team is all using the same ID.");
76-
77-
process.exit();
78-
}
79-
80-
}
81-
}
82-
83-
utils.removeMetadata(swagger);
84-
85-
info.swagger = swagger;
86-
87-
if(actionObj.swaggerUrl) {
88-
utils.getSwaggerUrl(config, info, function(url) {
89-
info.swaggerUrl = url;
90-
actionObj.run(config, info);
91-
});
92-
} else {
93-
actionObj.run(config, info);
94-
}
95-
});
96-
});
97-
} else {
98-
actionObj.run(config, info);
99-
}
100-
34+
actionObj.run(config, info);
10135
};
10236

10337
exports.load = function(action) {

0 commit comments

Comments
 (0)