From 256107c40c447d9adaa75e4e40d3b21cb45d749c Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Thu, 12 Sep 2024 18:03:52 +0530 Subject: [PATCH] fix: parameter.required field coming as nil (#205) 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: https://github.com/Kong/go-apiops/issues/203 --- openapi2kong/validator.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openapi2kong/validator.go b/openapi2kong/validator.go index 2dbc750..b4d2f9e 100644 --- a/openapi2kong/validator.go +++ b/openapi2kong/validator.go @@ -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 != "" {