chore: 项目基线(基于 WeKnora 定制版,整理文件忽略规则)
This commit is contained in:
commit
9097ee699d
5769 files changed
+1446466
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
docs "github.com/Tencent/WeKnora/docs"
|
||||
)
|
||||
|
||||
var (
|
||||
builtinOnce sync.Once
|
||||
builtinCatalog *Catalog
|
||||
builtinErr error
|
||||
)
|
||||
|
||||
// Builtin returns the catalog compiled from the Swagger document embedded in
|
||||
// the binary: every operation annotated with x-agent. It panics on an invalid
|
||||
// declaration, which tests catch before release.
|
||||
func Builtin() *Catalog {
|
||||
builtinOnce.Do(func() {
|
||||
var ops []Operation
|
||||
ops, builtinErr = FromSpec([]byte(docs.SwaggerInfo.ReadDoc()))
|
||||
if builtinErr == nil {
|
||||
builtinCatalog, builtinErr = NewCatalog(ops...)
|
||||
}
|
||||
})
|
||||
if builtinErr != nil {
|
||||
panic(builtinErr)
|
||||
}
|
||||
return builtinCatalog
|
||||
}
|
||||
Reference in new issue
Block a user