API: generate /api/state documentation from UI types (#32431)
Co-authored-by: Michael Geers <michael@geers.tv>
This commit is contained in:
parent
c7c744f54e
commit
c3f3384bfc
44 changed files with 8757 additions and 3347 deletions
|
|
@ -1,28 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
)
|
||||
|
||||
func main() {
|
||||
doc, err := openapi3.NewLoader().LoadFromFile(os.Args[1])
|
||||
if err != nil {
|
||||
log.Fatal("failed to load OpenAPI spec:", err)
|
||||
}
|
||||
|
||||
// omit servers
|
||||
doc.Servers = nil
|
||||
|
||||
b, err := json.MarshalIndent(doc, "", " ")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(os.Args[2], b, 0o644); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue