@@ -18,7 +18,6 @@ exports.api = function(args, opts) {
18
18
// a file name will always have a "."
19
19
if ( action && action . indexOf ( '.' ) >= 0 ) {
20
20
action = 'push' ;
21
- opts [ 'in' ] = args [ 0 ] ;
22
21
}
23
22
24
23
var actionObj = exports . load ( action ) ;
@@ -32,72 +31,7 @@ exports.api = function(args, opts) {
32
31
'opts' : opts ,
33
32
} ;
34
33
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 ) ;
101
35
} ;
102
36
103
37
exports . load = function ( action ) {
0 commit comments