Skip to content

Commit

Permalink
Fixed panic when type on schema is empty. #22
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
daveshanley committed Sep 18, 2023
1 parent 8b01e92 commit e304fea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parameters/query_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ doneLooking:
if params[p].Schema != nil {
sch := params[p].Schema.Schema()

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

0 comments on commit e304fea

Please sign in to comment.