mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
8dc4d76890
<!-- If you have used AI to produce some or all of this PR, please ensure you have read our [AI Contribution guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) before submitting. --> relates to GRU-18 Adds basic implementation for Workspace Agent Connection Watch and tests. Missing are handling of logs.
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
// Package main wraps swag init with Strict mode enabled.
|
|
//
|
|
// The upstream swag CLI (v1.16.2) does not expose a --strict
|
|
// flag, so warnings about duplicate routes are silently
|
|
// ignored. This wrapper calls the Go API directly with
|
|
// Strict: true, turning those warnings into hard errors.
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/swaggo/swag/gen"
|
|
)
|
|
|
|
func main() {
|
|
logger := log.New(os.Stdout, "", log.LstdFlags)
|
|
|
|
outputDir := "./coderd/apidoc"
|
|
if d := os.Getenv("SWAG_OUTPUT_DIR"); d != "" {
|
|
outputDir = d
|
|
}
|
|
|
|
err := gen.New().Build(&gen.Config{
|
|
SearchDir: "./coderd,./coderd/workspaceconnwatcher,./codersdk,./enterprise/coderd,./enterprise/wsproxy/wsproxysdk",
|
|
MainAPIFile: "coderd.go",
|
|
OutputDir: outputDir,
|
|
OutputTypes: []string{"go", "json"},
|
|
PackageName: "apidoc",
|
|
ParseDependency: 1,
|
|
Strict: true,
|
|
OverridesFile: gen.DefaultOverridesFile,
|
|
ParseGoList: true,
|
|
ParseDepth: 100,
|
|
CollectionFormat: "csv",
|
|
Debugger: logger,
|
|
LeftTemplateDelim: "{{",
|
|
RightTemplateDelim: "}}",
|
|
})
|
|
if err != nil {
|
|
log.Fatalf("swag init failed: %v", err)
|
|
}
|
|
}
|