swagger

package module
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 22 Imported by: 0

README

swagger-cli

Generate updating cli's for services that provide swagger specs

rootCmd := &cobra.Command{
  Use: "swagger-cli",
}

c := swagger.Client{
	Name:               "swagger-cli",
	BaseURLDefault:     "http://localhost:8010",
	SwaggerPathDefault: "/swagger.json",
}

cobra.CheckErr(c.Bind(context.Background(), rootCmd))
cobra.CheckErr(rootCmd.Execute())

Documentation

Index

Constants

View Source
const (
	BaseURLFlag         = "base-url"
	BaseSwaggerPathFlag = "swagger-path"
	BaseHealthPathFlag  = "health-path"
)

Variables

This section is empty.

Functions

func MergeBytes added in v1.0.1

func MergeBytes(dataBuff, patchBuff []byte) (mergedBuff []byte, err error)

MergeBytes merges patch document buffer to data document buffer

Returning merged document buffer and error if any

func SetHTTP added in v1.0.1

func SetHTTP(d HTTP)

func SetTracer added in v1.0.6

func SetTracer(t trace.Tracer)

func SetupTracer

func SetupTracer(name string) io.Closer

func ToKebabCase

func ToKebabCase(str string) string

Types

type Client

type Client struct {
	Name                  string
	BaseURLDefault        string
	SwaggerPathDefault    string
	HealthPathDefault     string
	HealthCheckFailedTmpl string
	FlagOutput            io.Writer
}

func (*Client) Bind

func (c *Client) Bind(ctx context.Context, cmd *cobra.Command) error

func (*Client) CreateSubCommands

func (c *Client) CreateSubCommands(ctx context.Context) (*Command, error)

func (*Client) Flags

func (c *Client) Flags() *pflag.FlagSet

type Command

type Command struct {
	Cmds []*SubCmd
	// contains filtered or unexported fields
}

type DefaultDoer added in v1.0.1

type DefaultDoer struct{}

func (*DefaultDoer) Do added in v1.0.1

func (d *DefaultDoer) Do(ctx context.Context, req *http.Request) (*http.Response, error)

type HTTP added in v1.0.1

type HTTP interface {
	Do(ctx context.Context, req *http.Request) (*http.Response, error)
}

type SubCmd

type SubCmd struct {
	Name      string
	Path      string
	Method    string
	ServerURL string
	Default   bool

	ParsedFlags map[string]*flag
	*cobra.Command
	// contains filtered or unexported fields
}

func (*SubCmd) Run

func (s *SubCmd) Run() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL