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

Method GetOpenAPI

lib/httpapi/server.go:80–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78}
79
80func (s *Server) GetOpenAPI() string {
81 jsonBytes, err := s.api.OpenAPI().Downgrade()
82 if err != nil {
83 return ""
84 }
85 // unmarshal the json and pretty print it
86 var jsonObj any
87 if err := json.Unmarshal(jsonBytes, &jsonObj); err != nil {
88 return ""
89 }
90
91 // Normalize
92 normalized := s.NormalizeSchema(jsonObj)
93
94 prettyJSON, err := json.MarshalIndent(normalized, "", " ")
95 if err != nil {
96 return ""
97 }
98 return string(prettyJSON)
99}
100
101// That's about 40 frames per second. It's slightly less
102// because the action of taking a snapshot takes time too.

Callers 2

TestOpenAPISchemaFunction · 0.95
runServerFunction · 0.95

Calls 1

NormalizeSchemaMethod · 0.95

Tested by 1

TestOpenAPISchemaFunction · 0.76