mergedProperties collects an object's properties and required names, including those from allOf.
(s *openapi3.Schema)
| 547 | // mergedProperties collects an object's properties and required names, |
| 548 | // including those from allOf. |
| 549 | func mergedProperties(s *openapi3.Schema) (map[string]*openapi3.SchemaRef, map[string]bool) { |
| 550 | props := map[string]*openapi3.SchemaRef{} |
| 551 | required := map[string]bool{} |
| 552 | var add func(*openapi3.Schema) |
| 553 | add = func(s *openapi3.Schema) { |
| 554 | if s == nil { |
| 555 | return |
| 556 | } |
| 557 | for name, p := range s.Properties { |
| 558 | if _, ok := props[name]; !ok { |
| 559 | props[name] = p |
| 560 | } |
| 561 | } |
| 562 | for _, r := range s.Required { |
| 563 | required[r] = true |
| 564 | } |
| 565 | for _, a := range s.AllOf { |
| 566 | add(a.Value) |
| 567 | } |
| 568 | } |
| 569 | add(s) |
| 570 | return props, required |
| 571 | } |
| 572 | |
| 573 | // propertyNames lists every key a schema allows, including in oneOf and anyOf |
| 574 | // alternatives. |