MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / LoadSwagger

Function LoadSwagger

pkg/util/loader.go:15–26  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

13)
14
15func LoadSwagger(filePath string) (swagger *openapi3.T, err error) {
16
17 loader := openapi3.NewLoader()
18 loader.IsExternalRefsAllowed = true
19
20 u, err := url.Parse(filePath)
21 if err == nil && u.Scheme != "" && u.Host != "" {
22 return loader.LoadFromURI(u)
23 } else {
24 return loader.LoadFromFile(filePath)
25 }
26}
27
28// Deprecated: In kin-openapi v0.126.0 (https://github.com/getkin/kin-openapi/tree/v0.126.0?tab=readme-ov-file#v01260) the Circular Reference Counter functionality was removed, instead resolving all references with backtracking, to avoid needing to provide a limit to reference counts.
29//

Callers 7

TestGoTypeImportFunction · 0.92
TestGoAllofTypeOverrideFunction · 0.92
TestLoaderFunction · 0.92
LoadSwaggerWithOverlayFunction · 0.85

Calls

no outgoing calls

Tested by 5

TestGoTypeImportFunction · 0.74
TestGoAllofTypeOverrideFunction · 0.74
TestLoaderFunction · 0.74