File tree 1 file changed +14
-4
lines changed
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,21 @@ function addDataToSwaggerObject(swaggerObject, swaggerJsDocComments) {
96
96
for ( var i = 0 ; i < swaggerJsDocComments . length ; i = i + 1 ) {
97
97
var pathObject = swaggerJsDocComments [ i ] ;
98
98
var propertyNames = Object . getOwnPropertyNames ( pathObject ) ;
99
-
100
99
for ( var j = 0 ; j < propertyNames . length ; j = j + 1 ) {
101
100
var propertyName = propertyNames [ j ] ;
102
- swaggerObject . paths [ propertyName ] = objectMerge (
103
- swaggerObject . paths [ propertyName ] , pathObject [ propertyName ]
104
- ) ;
101
+ switch ( propertyName ) {
102
+ case "definition" :
103
+ var definiationNames = Object . getOwnPropertyNames ( pathObject [ propertyName ] ) ;
104
+ for ( var k = 0 ; k < definiationNames . length ; k = k + 1 ) {
105
+ var definiationName = definiationNames [ k ] ;
106
+ swaggerObject . definitions [ definiationName ] = pathObject [ propertyName ] [ definiationName ] ;
107
+ }
108
+ break ;
109
+ default :
110
+ swaggerObject . paths [ propertyName ] = objectMerge (
111
+ swaggerObject . paths [ propertyName ] , pathObject [ propertyName ]
112
+ ) ;
113
+ }
105
114
}
106
115
}
107
116
}
@@ -128,6 +137,7 @@ module.exports = function(options) {
128
137
swaggerObject = options . swaggerDefinition ;
129
138
swaggerObject . swagger = '2.0' ;
130
139
swaggerObject . paths = { } ;
140
+ swaggerObject . definitions = { } ;
131
141
132
142
// Parse the documentation in the APIs array.
133
143
for ( var i = 0 ; i < options . apis . length ; i = i + 1 ) {
You can’t perform that action at this time.
0 commit comments