MCPcopy Create free account
hub / github.com/getkin/kin-openapi / TestLoadFromRemoteURL

Function TestLoadFromRemoteURL

openapi3/loader_test.go:279–294  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

277}
278
279func TestLoadFromRemoteURL(t *testing.T) {
280 fs := http.FileServer(http.Dir("testdata"))
281 ts := createTestServer(t, fs)
282 ts.Start()
283 defer ts.Close()
284
285 loader := NewLoader()
286 loader.IsExternalRefsAllowed = true
287 url, err := url.Parse("http://" + addr + "/test.openapi.json")
288 require.NoError(t, err)
289
290 doc, err := loader.LoadFromURI(url)
291 require.NoError(t, err)
292
293 require.Equal(t, &Types{"string"}, doc.Components.Schemas["TestSchema"].Value.Type)
294}
295
296func TestLoadWithReferenceInReference(t *testing.T) {
297 loader := NewLoader()

Callers

nothing calls this directly

Calls 3

LoadFromURIMethod · 0.95
createTestServerFunction · 0.85
NewLoaderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…