MCPcopy
hub / github.com/swaggo/swag / ReadDoc

Function ReadDoc

swagger.go:53–72  ·  view source on GitHub ↗

ReadDoc reads swagger document. An optional name parameter can be passed to read a specific document. The default name is "swagger".

(optionalName ...string)

Source from the content-addressed store, hash-verified

51// ReadDoc reads swagger document. An optional name parameter can be passed to read a specific document.
52// The default name is "swagger".
53func ReadDoc(optionalName ...string) (string, error) {
54 swaggerMu.RLock()
55 defer swaggerMu.RUnlock()
56
57 if swags == nil {
58 return "", errors.New("no swag has yet been registered")
59 }
60
61 name := Name
62 if len(optionalName) != 0 && optionalName[0] != "" {
63 name = optionalName[0]
64 }
65
66 swag, ok := swags[name]
67 if !ok {
68 return "", fmt.Errorf("no swag named \"%s\" was registered", name)
69 }
70
71 return swag.ReadDoc(), nil
72}

Callers 7

ReadDocFunction · 0.92
ReadDocFunction · 0.92
TestRegisterFunction · 0.70
TestRegisterByNameFunction · 0.70
TestRegisterMultipleFunction · 0.70

Calls 1

ReadDocMethod · 0.65

Tested by 5

TestRegisterFunction · 0.56
TestRegisterByNameFunction · 0.56
TestRegisterMultipleFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…