Currently, add_definition/2 hardcodes the the type <<"object">>. It's annoying when I have response as a list of objects such as [{"apple": 1, "banana": 2}, {"apple": 3, "banana": 4}, ...] (Swagger Data Types: Arrays)
Currently I have to write this:
DefinitionName = <<"my_basket">>,
DefinitionProperties =
#{ apple => #{ type => "string"}
, banana => #{ type => "string"}
},
ok = cowboy_swagger:add_definition(DefinitionName, DefinitionProperties),
[...]
, responses =>
#{ <<"200">> =>
#{ description => "Gets echo var from the server 200 OK"
, schema =>
#{ type => <<"array">>
, items => cowboy_swagger:schema(<<"my_basket">>)
}
With add_definition_array/2 I can just simply do this:
DefinitionName = <<"my_basket">>,
DefinitionProperties =
#{ apple => #{ type => "string"}
, banana => #{ type => "string"}
},
ok = cowboy_swagger:add_definition_array(DefinitionName, DefinitionProperties),
...
, responses =>
#{ <<"200">> =>
#{ description => "Gets echo var from the server 200 OK"
, schema => cowboy_swagger:schema(<<"my_basket">>)
}
}
Currently,
add_definition/2
hardcodes the the type<<"object">>
. It's annoying when I have response as a list of objects such as[{"apple": 1, "banana": 2}, {"apple": 3, "banana": 4}, ...]
(Swagger Data Types: Arrays)Currently I have to write this:
With
add_definition_array/2
I can just simply do this: