MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / operationResponses

Function operationResponses

internal/httpapi/spec_review_test.go:27–45  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

25// operationResponses finds the operation with the given operationId anywhere in
26// paths and returns its responses map.
27func 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.
48func schemaProps(t *testing.T, doc map[string]any, schemaName string) map[string]any {

Calls

no outgoing calls

Tested by

no test coverage detected