Skip to content

Commit

Permalink
fix: parameter.required field coming as nil (#205)
Browse files Browse the repository at this point in the history
With recent deck changes that attemp to skip
filling defaults before sending to CP, the cmd
deck file openapi2kong had issues with the required
field coming up as null, if it was not filled by
the user. With this change, we fill it with
false by default.

Fixes: #203
  • Loading branch information
Prashansa-K committed Sep 12, 2024
1 parent 66febca commit 256107c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openapi2kong/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ func generateParameterSchema(operation *v3.Operation, insoCompat bool) []map[str
} else {
paramConf["name"] = parameter.Name
}
paramConf["required"] = parameter.Required

if parameter.Required != nil {
paramConf["required"] = parameter.Required
} else {
paramConf["required"] = false
}

schema := extractSchema(parameter.Schema)
if schema != "" {
Expand Down

0 comments on commit 256107c

Please sign in to comment.