MCPcopy
hub / github.com/danielgtaylor/huma / validateAnyOf

Function validateAnyOf

validate.go:321–335  ·  view source on GitHub ↗
(r Registry, s *Schema, path *PathBuffer, mode ValidateMode, v any, res *ValidateResult)

Source from the content-addressed store, hash-verified

319}
320
321func validateAnyOf(r Registry, s *Schema, path *PathBuffer, mode ValidateMode, v any, res *ValidateResult) {
322 matches := 0
323 subRes := &ValidateResult{}
324 for _, sub := range s.AnyOf {
325 Validate(r, sub, path, mode, v, subRes)
326 if len(subRes.Errors) == 0 {
327 matches++
328 }
329 subRes.Reset()
330 }
331
332 if matches == 0 {
333 res.Add(path, v, validation.MsgExpectedMatchAtLeastOneSchema)
334 }
335}
336
337func validateDiscriminator(r Registry, s *Schema, path *PathBuffer, mode ValidateMode, v any, res *ValidateResult) {
338 var kk any

Callers 1

ValidateFunction · 0.85

Calls 3

ResetMethod · 0.95
ValidateFunction · 0.85
AddMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…