fix(api): validate path parameter schemas

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 08:30:44 +00:00
parent 152645489b
commit 172a98f73a

View file

@ -604,14 +604,10 @@ func operationParameterLocation(op openAPIOperation, name string) string {
}
func validateParameterValues(op openAPIOperation, params map[string]any) error {
pathKeys := pathParameterNames(op.pathTemplate)
for _, param := range op.parameters {
if len(param.schema) == 0 {
continue
}
if containsString(pathKeys, param.name) {
continue
}
if nested, ok := nestedMap(params, param.in); ok {
if value, exists := nested[param.name]; exists {
@ -651,9 +647,6 @@ func validateRequiredParameters(op openAPIOperation, params map[string]any, path
if !param.required {
continue
}
if containsString(pathKeys, param.name) {
continue
}
if parameterProvided(params, param.name, param.in) {
continue
}
@ -664,7 +657,7 @@ func validateRequiredParameters(op openAPIOperation, params map[string]any, path
func parameterProvided(params map[string]any, name, location string) bool {
if nested, ok := nestedMap(params, location); ok {
if _, exists := nested[name]; exists {
if value, exists := nested[name]; exists && value != nil {
return true
}
}