Skip to content

Commit

Permalink
fix: validating cookie parameter for req-validator
Browse files Browse the repository at this point in the history
At the moment, we do not support cookie parameters in request-validator
plugin. However, `deck file openapi2kong` command generates the yaml file
even if it is present in the parameter schema. Thus, adding a validation
layer over it to ensure deck does not create invalid specs.

For: #223
  • Loading branch information
Prashansa-K committed Nov 11, 2024
1 parent a214fdd commit 9bbc21c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openapi2kong/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ func generateParameterSchema(operation *v3.Operation, path *v3.PathItem,
paramConf["style"] = style
paramConf["explode"] = explode
paramConf["in"] = parameter.In

if parameter.In == "cookie" {
return nil, fmt.Errorf(`cookie parameters are not supported for request-validator plugin;
choose either path, query or header`)
}

if parameter.In == "path" {
paramConf["name"] = sanitizeRegexCapture(parameter.Name, insoCompat)
} else {
Expand Down

0 comments on commit 9bbc21c

Please sign in to comment.