operationResponses finds the operation with the given operationId anywhere in paths and returns its responses map.
(t *testing.T, doc map[string]any, operationID string)
| 25 | // operationResponses finds the operation with the given operationId anywhere in |
| 26 | // paths and returns its responses map. |
| 27 | func operationResponses(t *testing.T, doc map[string]any, operationID string) map[string]any { |
| 28 | t.Helper() |
| 29 | paths, _ := doc["paths"].(map[string]any) |
| 30 | for _, pi := range paths { |
| 31 | item, _ := pi.(map[string]any) |
| 32 | for _, op := range item { |
| 33 | opm, ok := op.(map[string]any) |
| 34 | if !ok { |
| 35 | continue |
| 36 | } |
| 37 | if opm["operationId"] == operationID { |
| 38 | resp, _ := opm["responses"].(map[string]any) |
| 39 | return resp |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | t.Fatalf("operation %q not found in spec", operationID) |
| 44 | return nil |
| 45 | } |
| 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 { |
no outgoing calls
no test coverage detected