Skip to content

Commit e304fea

Browse files
committed
Fixed panic when type on schema is empty. #22
A panic was being thrown when a schema is missing a type and checking for a query param. All schemas should always have a type, assumption however is the mother of all f**kups. Signed-off-by: Dave Shanley <[email protected]>
1 parent 8b01e92 commit e304fea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

parameters/query_parameters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ doneLooking:
217217
if params[p].Schema != nil {
218218
sch := params[p].Schema.Schema()
219219

220-
if sch.Type[0] == helpers.Object && params[p].IsDefaultFormEncoding() {
220+
if len(sch.Type) > 0 && sch.Type[0] == helpers.Object && params[p].IsDefaultFormEncoding() {
221221
// if the param is an object, and we're using default encoding, then we need to
222222
// validate the schema.
223223
decoded := helpers.ConstructParamMapFromQueryParamInput(queryParams)

0 commit comments

Comments
 (0)