MCPcopy Create free account
hub / github.com/coder/agentapi / NormalizeSchema

Method NormalizeSchema

lib/httpapi/server.go:59–78  ·  view source on GitHub ↗
(schema any)

Source from the content-addressed store, hash-verified

57}
58
59func (s *Server) NormalizeSchema(schema any) any {
60 switch val := (schema).(type) {
61 case *any:
62 s.NormalizeSchema(*val)
63 case []any:
64 for i := range val {
65 s.NormalizeSchema(&val[i])
66 }
67 sort.SliceStable(val, func(i, j int) bool {
68 return fmt.Sprintf("%v", val[i]) < fmt.Sprintf("%v", val[j])
69 })
70 case map[string]any:
71 for k := range val {
72 valUnderKey := val[k]
73 s.NormalizeSchema(&valUnderKey)
74 val[k] = valUnderKey
75 }
76 }
77 return schema
78}
79
80func (s *Server) GetOpenAPI() string {
81 jsonBytes, err := s.api.OpenAPI().Downgrade()

Callers 1

GetOpenAPIMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected