Files
coder/scripts/apidocgen/swaginit/main.go
T
Spike Curtis 8dc4d76890 chore: add agent-connection-watch for workspaces (#24507)
<!--

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.
2026-05-20 13:09:11 -04:00

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)
}
}