feat(httpapi): the API is described by an OpenAPI document generated with Huma (#2028)
Every /api operation is registered with Huma behind one admin-token middleware, served at /api/openapi.json with a docs page at /api/docs, and committed as api/openapi.yaml, which task check keeps current.
This commit is contained in:
32 files changed
+4467
-1105
No files matched your search
@@ -25,11 +25,27 @@ func run() error {
|
||||
configPath := flag.String("config", archie.DefaultConfigPath(), "path to the bootstrap config file")
|
||||
newIdentity := flag.Bool("new-age-identity", false, "print a new age identity for age_identity and exit")
|
||||
showVersion := buildinfo.RegisterVersionFlag("archie")
|
||||
flag.Usage = func() {
|
||||
_, _ = fmt.Fprintln(flag.CommandLine.Output(), "usage: archie [flags]\n archie openapi print the API's OpenAPI document")
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
flag.Parse()
|
||||
showVersion()
|
||||
if *newIdentity {
|
||||
return archie.NewAgeIdentity(os.Stdout)
|
||||
}
|
||||
switch flag.Arg(0) {
|
||||
case "":
|
||||
case "openapi":
|
||||
doc, err := archie.Document()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = os.Stdout.Write(doc)
|
||||
return err
|
||||
default:
|
||||
return fmt.Errorf("unknown command %q", flag.Arg(0))
|
||||
}
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
Reference in new issue
Block a user