tstor/cmd/generate-graphql-schema/main.go
royalcat d8ee8a3a24
All checks were successful
docker / build-docker (linux/amd64) (push) Successful in 1m34s
docker / build-docker (linux/386) (push) Successful in 1m37s
docker / build-docker (linux/arm64/v8) (push) Successful in 7m37s
docker / build-docker (linux/arm64) (push) Successful in 7m44s
docker / build-docker (linux/arm/v7) (push) Successful in 8m12s
update
2024-04-24 20:36:33 +03:00

27 lines
539 B
Go

package main
import (
"fmt"
"log"
"os"
graph "git.kmsign.ru/royalcat/tstor/src/delivery/graphql"
"github.com/vektah/gqlparser/v2/formatter"
)
func main() {
outFile := "schema.graphql"
if len(os.Args) > 1 {
outFile = os.Args[1]
}
file, err := os.OpenFile(outFile, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm)
if err != nil {
log.Panic(fmt.Errorf("Failed to open %s: %w", outFile, err))
}
defer file.Close()
fmt := formatter.NewFormatter(file)
fmt.FormatSchema(graph.NewExecutableSchema(graph.Config{}).Schema())
}