MCPcopy Create free account
hub / github.com/goadesign/goa / renderOpenAPIJSON

Function renderOpenAPIJSON

http/codegen/cookie_security_test.go:106–132  ·  view source on GitHub ↗
(
	t *testing.T,
	build func(*expr.RootExpr) ([]*codegen.File, error),
	root *expr.RootExpr,
)

Source from the content-addressed store, hash-verified

104}
105
106func renderOpenAPIJSON(
107 t *testing.T,
108 build func(*expr.RootExpr) ([]*codegen.File, error),
109 root *expr.RootExpr,
110) []byte {
111 t.Helper()
112
113 files, err := build(root)
114 require.NoError(t, err)
115 for _, f := range files {
116 if filepath.Ext(f.Path) != ".json" {
117 continue
118 }
119 require.Len(t, f.SectionTemplates, 1)
120 section := f.SectionTemplates[0]
121 require.NotEmpty(t, section.Source)
122 require.NotNil(t, section.Data)
123
124 var buf bytes.Buffer
125 tmpl := template.Must(template.New("openapi").Funcs(section.FuncMap).Parse(section.Source))
126 require.NoError(t, tmpl.Execute(&buf, section.Data))
127 return buf.Bytes()
128 }
129
130 t.Fatalf("no JSON OpenAPI file generated")
131 return nil
132}
133
134var cookieAPIKeySecurityDSL = func() {
135 var browserSessionCookie = dsl.APIKeySecurity("browser_session_cookie", func() {

Callers 1

TestCookieAPIKeySecurityFunction · 0.85

Calls 1

ExecuteMethod · 0.80

Tested by

no test coverage detected