propertyNames lists every key a schema allows, including in oneOf and anyOf alternatives.
(s *openapi3.Schema)
| 573 | // propertyNames lists every key a schema allows, including in oneOf and anyOf |
| 574 | // alternatives. |
| 575 | func propertyNames(s *openapi3.Schema) []string { |
| 576 | if s == nil { |
| 577 | return nil |
| 578 | } |
| 579 | seen := map[string]bool{} |
| 580 | var names []string |
| 581 | var add func(*openapi3.Schema) |
| 582 | add = func(s *openapi3.Schema) { |
| 583 | if s == nil { |
| 584 | return |
| 585 | } |
| 586 | for name := range s.Properties { |
| 587 | if !seen[name] { |
| 588 | seen[name] = true |
| 589 | names = append(names, name) |
| 590 | } |
| 591 | } |
| 592 | for _, group := range []openapi3.SchemaRefs{s.AllOf, s.OneOf, s.AnyOf} { |
| 593 | for _, alt := range group { |
| 594 | add(alt.Value) |
| 595 | } |
| 596 | } |
| 597 | } |
| 598 | add(s) |
| 599 | return names |
| 600 | } |
| 601 | |
| 602 | func writeDescription(w io.Writer, text string) { |
| 603 | if text = strings.TrimSpace(text); text != "" { |