Files
dtoro febc153b7f
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
ci / web (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled
fix: add involves edge from task to agent:nomos at creation
Plus sync vendor directory for Docker build compatibility.
2026-08-11 22:03:12 +02:00

37 lines
1.0 KiB
Go

package openapi3
import (
"context"
"strings"
)
// validateExtensions reports any non-`x-` keys in the given extensions
// map that are not explicitly allowed by the validation context. The
// origin argument is attached to the resulting ExtraSiblingFieldsError
// so callers can pin the finding to the parent object that carries the
// unknown keys; pass nil when the parent has no Origin (the loader was
// run with IncludeOrigin = false, or the parent was constructed
// programmatically without an Origin set).
func validateExtensions(ctx context.Context, extensions map[string]any, origin *Origin) error { // FIXME: newtype + Validate(...)
allowed := getValidationOptions(ctx).extraSiblingFieldsAllowed
var unknowns []string
for _, k := range componentNames(extensions) {
if strings.HasPrefix(k, "x-") {
continue
}
if allowed != nil {
if _, ok := allowed[k]; ok {
continue
}
}
unknowns = append(unknowns, k)
}
if len(unknowns) != 0 {
return newExtraSiblingFields(unknowns, origin)
}
return nil
}