schemaProps returns the properties map of a named component schema.
(t *testing.T, doc map[string]any, schemaName string)
| 46 | |
| 47 | // schemaProps returns the properties map of a named component schema. |
| 48 | func schemaProps(t *testing.T, doc map[string]any, schemaName string) map[string]any { |
| 49 | t.Helper() |
| 50 | comps, _ := doc["components"].(map[string]any) |
| 51 | schemas, _ := comps["schemas"].(map[string]any) |
| 52 | sc, ok := schemas[schemaName].(map[string]any) |
| 53 | if !ok { |
| 54 | t.Fatalf("schema %q not found in spec", schemaName) |
| 55 | } |
| 56 | props, _ := sc["properties"].(map[string]any) |
| 57 | return props |
| 58 | } |
| 59 | |
| 60 | // enumOf returns the enum string slice for a property, or nil if absent. |
| 61 | func enumOf(props map[string]any, field string) []string { |
no outgoing calls
no test coverage detected