(r Registry, s *Schema, path *PathBuffer, mode ValidateMode, v any, res *ValidateResult)
| 301 | } |
| 302 | |
| 303 | func validateOneOf(r Registry, s *Schema, path *PathBuffer, mode ValidateMode, v any, res *ValidateResult) { |
| 304 | found := false |
| 305 | subRes := &ValidateResult{} |
| 306 | for _, sub := range s.OneOf { |
| 307 | Validate(r, sub, path, mode, v, subRes) |
| 308 | if len(subRes.Errors) == 0 { |
| 309 | if found { |
| 310 | res.Add(path, v, "expected value to match exactly one schema but matched multiple") |
| 311 | } |
| 312 | found = true |
| 313 | } |
| 314 | subRes.Reset() |
| 315 | } |
| 316 | if !found { |
| 317 | res.Add(path, v, validation.MsgExpectedMatchExactlyOneSchema) |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | func validateAnyOf(r Registry, s *Schema, path *PathBuffer, mode ValidateMode, v any, res *ValidateResult) { |
| 322 | matches := 0 |
no test coverage detected
searching dependent graphs…