Skip to content

Commit

Permalink
feat: add protoc-gen-openapi (gnostic)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Oct 15, 2024
1 parent 4dfc9c5 commit 42d8c83
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tools/sgprotocgenopenapi/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package sgprotocgenopenapi

import (
"context"
"os/exec"

"go.einride.tech/sage/sg"
"go.einride.tech/sage/sgtool"
)

// docs:
// https://github.com/google/gnostic/tree/main/cmd/protoc-gen-openapi
// https://buf.build/gnostic/gnostic/docs/main:gnostic.openapi.v3

const (
version = "0.7.0"
name = "protoc-gen-openapi"
)

func Command(ctx context.Context, args ...string) *exec.Cmd {
sg.Deps(ctx, PrepareCommand)
return sg.Command(ctx, sg.FromBinDir(name), args...)
}

func PrepareCommand(ctx context.Context) error {
_, err := sgtool.GoInstall(ctx, "github.com/google/gnostic/cmd/"+name, "v"+version)
return err
}

0 comments on commit 42d8c83

Please sign in to comment.