@@ -215,16 +215,15 @@ func unwrapSearchParameters(m *yml) {
215
215
newMap ["in" ] = query
216
216
newMap ["schema" ] = make (yml )
217
217
if obj .Value .(yml )["oneOf" ] == nil {
218
+ switch {
218
219
// if the param is referencing a schema
219
- if obj .Value .(yml )["type" ] == nil {
220
+ case obj .Value .(yml )["type" ] == nil :
220
221
newMap ["schema" ].(yml )["$ref" ] = obj .Value .(yml )["$ref" ].(string )
221
- } else {
222
- if obj .Value .(yml )["type" ].(string ) == array {
223
- newMap ["schema" ].(yml )["type" ] = array
224
- newMap ["schema" ].(yml )["items" ] = obj .Value .(yml )["items" ]
225
- } else {
226
- newMap ["schema" ].(yml )["type" ] = obj .Value .(yml )["type" ].(string )
227
- }
222
+ case obj .Value .(yml )["type" ].(string ) == array :
223
+ newMap ["schema" ].(yml )["type" ] = array
224
+ newMap ["schema" ].(yml )["items" ] = obj .Value .(yml )["items" ]
225
+ default :
226
+ newMap ["schema" ].(yml )["type" ] = obj .Value .(yml )["type" ].(string )
228
227
}
229
228
} else {
230
229
newMap ["schema" ].(yml )["oneOf" ] = obj .Value .(yml )["oneOf" ]
@@ -246,15 +245,15 @@ func unwrapMultiSearchParameters(m *yml) {
246
245
newMap ["in" ] = query
247
246
newMap ["schema" ] = make (yml )
248
247
if obj .Value .(yml )["oneOf" ] == nil {
249
- if obj .Value .(yml )["type" ] == nil {
248
+ switch {
249
+ // if the param is referencing a schema
250
+ case obj .Value .(yml )["type" ] == nil :
250
251
newMap ["schema" ].(yml )["$ref" ] = obj .Value .(yml )["$ref" ].(string )
251
- } else {
252
- if obj .Value .(yml )["type" ].(string ) == array {
253
- newMap ["schema" ].(yml )["type" ] = array
254
- newMap ["schema" ].(yml )["items" ] = obj .Value .(yml )["items" ]
255
- } else {
256
- newMap ["schema" ].(yml )["type" ] = obj .Value .(yml )["type" ].(string )
257
- }
252
+ case obj .Value .(yml )["type" ].(string ) == array :
253
+ newMap ["schema" ].(yml )["type" ] = array
254
+ newMap ["schema" ].(yml )["items" ] = obj .Value .(yml )["items" ]
255
+ default :
256
+ newMap ["schema" ].(yml )["type" ] = obj .Value .(yml )["type" ].(string )
258
257
}
259
258
} else {
260
259
newMap ["schema" ].(yml )["oneOf" ] = obj .Value .(yml )["oneOf" ]
0 commit comments