generate

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cli

type Cli struct {
	// generate a cli includes all client code
	Client
	// cmd/<cli-app-name>/main.go will be generated. This ensures that go install will compile the app with desired name.
	CliAppName string `long:"cli-app-name" description:"the app name for the cli executable. useful for go install." default:"cli"`
}

func (*Cli) Execute

func (c *Cli) Execute(args []string) error

Execute runs this command

type Client

type Client struct {
	WithShared
	WithModels
	WithOperations

	SkipModels     bool `long:"skip-models" description:"no models will be generated when this flag is specified"`
	SkipOperations bool `long:"skip-operations" description:"no operations will be generated when this flag is specified"`

	Name string `long:"name" short:"A" description:"the name of the application, defaults to a mangled value of info.title"`
	// contains filtered or unexported fields
}

Client the command to generate a swagger client

func (*Client) Execute

func (c *Client) Execute(args []string) error

Execute runs this command

type FlattenCmdOptions

type FlattenCmdOptions struct {
	WithExpand  bool     `` /* 132-byte string literal not displayed */
	WithFlatten []string `` // nolint: staticcheck
	/* 238-byte string literal not displayed */
}

FlattenCmdOptions determines options to the flatten spec preprocessing

func (*FlattenCmdOptions) SetFlattenOptions

func (f *FlattenCmdOptions) SetFlattenOptions(dflt *analysis.FlattenOpts) (res *analysis.FlattenOpts)

SetFlattenOptions builds flatten options from command line args

type Markdown

type Markdown struct {
	WithShared
	WithModels
	WithOperations

	Output flags.Filename `long:"output" short:"" description:"the file to write the generated markdown." default:"markdown.md"`
}

Markdown generates a markdown representation of the spec

func (*Markdown) Execute

func (m *Markdown) Execute(args []string) error

Execute runs this command

type Model

type Model struct {
	WithShared
	WithModels

	NoStruct              bool     `long:"skip-struct" description:"when present will not generate the model struct" hidden:"deprecated"`
	Name                  []string `long:"name" short:"n" description:"the model to generate, repeat for multiple (defaults to all). Same as --models"`
	AcceptDefinitionsOnly bool     `long:"accept-definitions-only" description:"accepts a partial swagger spec with only the definitions key"`
}

Model the generate model file command.

Define the options that are specific to the "swagger generate model" command.

func (*Model) Execute

func (m *Model) Execute(args []string) error

Execute generates a model file

type Operation

type Operation struct {
	WithShared
	WithOperations

	ModelPackage string `long:"model-package" short:"m" description:"the package to save the models" default:"models"`

	NoHandler    bool `long:"skip-handler" description:"when present will not generate an operation handler"`
	NoStruct     bool `long:"skip-parameters" description:"when present will not generate the parameter model struct"`
	NoResponses  bool `long:"skip-responses" description:"when present will not generate the response model struct"`
	NoURLBuilder bool `long:"skip-url-builder" description:"when present will not generate a URL builder"`

	Name []string `long:"name" short:"n" description:"the operations to generate, repeat for multiple (defaults to all). Same as --operations"`
	// contains filtered or unexported fields
}

Operation the generate operation files command

func (*Operation) Execute

func (o *Operation) Execute(args []string) error

Execute generates a model file

type Server

type Server struct {
	WithShared
	WithModels
	WithOperations

	SkipModels     bool   `long:"skip-models" description:"no models will be generated when this flag is specified"`
	SkipOperations bool   `long:"skip-operations" description:"no operations will be generated when this flag is specified"`
	SkipSupport    bool   `long:"skip-support" description:"no supporting files will be generated when this flag is specified"`
	ExcludeMain    bool   `long:"exclude-main" description:"exclude main function, so just generate the library"`
	ExcludeSpec    bool   `long:"exclude-spec" description:"don't embed the swagger specification"`
	FlagStrategy   string `` // nolint: staticcheck
	/* 145-byte string literal not displayed */
	CompatibilityMode string `` // nolint: staticcheck
	/* 136-byte string literal not displayed */
	RegenerateConfigureAPI bool `long:"regenerate-configureapi" description:"Force regeneration of configureapi.go"`

	Name string `long:"name" short:"A" description:"the name of the application, defaults to a mangled value of info.title"`

	// deprecated flags
	WithContext bool `long:"with-context" description:"handlers get a context as first arg (deprecated)"`
	// contains filtered or unexported fields
}

Server the command to generate an entire server application

func (*Server) Execute

func (s *Server) Execute(args []string) error

Execute runs this command

type SpecFile

type SpecFile struct {
	WorkDir     string         `long:"work-dir" short:"w" description:"the base path to use" default:"."`
	BuildTags   string         `long:"tags" short:"t" description:"build tags" default:""`
	ScanModels  bool           `long:"scan-models" short:"m" description:"includes models that were annotated with 'swagger:model'"`
	Compact     bool           `long:"compact" description:"when present, doesn't prettify the json"`
	Output      flags.Filename `long:"output" short:"o" description:"the file to write to"`
	Input       flags.Filename `long:"input" short:"i" description:"an input swagger file with which to merge"`
	Include     []string       `long:"include" short:"c" description:"include packages matching pattern"`
	Exclude     []string       `long:"exclude" short:"x" description:"exclude packages matching pattern"`
	IncludeTags []string       `long:"include-tag" short:"" description:"include routes having specified tags (can be specified many times)"`
	ExcludeTags []string       `long:"exclude-tag" short:"" description:"exclude routes having specified tags (can be specified many times)"`
	ExcludeDeps bool           `long:"exclude-deps" short:"" description:"exclude all dependencies of project"`
}

SpecFile command to generate a swagger spec from a go application

func (*SpecFile) Execute

func (s *SpecFile) Execute(args []string) error

Execute runs this command

type Support

type Support struct {
	WithShared
	WithModels
	WithOperations

	Name string `long:"name" short:"A" description:"the name of the application, defaults to a mangled value of info.title"`
	// contains filtered or unexported fields
}

Support generates the supporting files

func (*Support) Execute

func (s *Support) Execute(args []string) error

Execute generates the supporting files file

type WithModels

type WithModels struct {
	Models modelOptions `group:"Options for model generation"`
}

WithModels adds the model options group.

This group is available to all commands that need some model generation.

type WithOperations

type WithOperations struct {
	Operations operationOptions `group:"Options for operation generation"`
}

WithOperations adds the operations options group

type WithShared

type WithShared struct {
	Shared sharedOptions `group:"Options common to all code generation commands"`
}

WithShared adds the shared options group

Jump to

Keyboard shortcuts

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