childSchema finds the schema for one step into a value: an array index or an object key. It looks through allOf, oneOf and anyOf.
(ref *openapi3.SchemaRef, seg string)
| 399 | // childSchema finds the schema for one step into a value: an array index or |
| 400 | // an object key. It looks through allOf, oneOf and anyOf. |
| 401 | func childSchema(ref *openapi3.SchemaRef, seg string) *openapi3.SchemaRef { |
| 402 | if ref == nil || ref.Value == nil { |
| 403 | return nil |
| 404 | } |
| 405 | s := ref.Value |
| 406 | if s.Items != nil { |
| 407 | if _, err := strconv.Atoi(seg); err == nil { |
| 408 | return s.Items |
| 409 | } |
| 410 | } |
| 411 | if p := s.Properties[seg]; p != nil { |
| 412 | return p |
| 413 | } |
| 414 | for _, group := range []openapi3.SchemaRefs{s.AllOf, s.OneOf, s.AnyOf} { |
| 415 | for _, alt := range group { |
| 416 | if c := childSchema(alt, seg); c != nil { |
| 417 | return c |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | return s.AdditionalProperties.Schema |
| 422 | } |
| 423 | |
| 424 | func missingChild(ref *openapi3.SchemaRef, walked, seg string) error { |
| 425 | place := where(walked) |