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

Function enumOf

internal/httpapi/spec_review_test.go:61–77  ·  view source on GitHub ↗

enumOf returns the enum string slice for a property, or nil if absent.

(props map[string]any, field string)

Source from the content-addressed store, hash-verified

59
60// enumOf returns the enum string slice for a property, or nil if absent.
61func enumOf(props map[string]any, field string) []string {
62 p, ok := props[field].(map[string]any)
63 if !ok {
64 return nil
65 }
66 raw, ok := p["enum"].([]any)
67 if !ok {
68 return nil
69 }
70 out := make([]string, 0, len(raw))
71 for _, v := range raw {
72 if s, ok := v.(string); ok {
73 out = append(out, s)
74 }
75 }
76 return out
77}
78
79// typeIsNullable reports whether a property's type includes "null"
80// (either as a list ["array","null"] or via a separate nullable flag).

Callers 1

TestSpecStatusEnumsFunction · 0.85

Calls 1

makeFunction · 0.85

Tested by

no test coverage detected