[Vendor] Update directly used dependencys (#15593)
* update github.com/blevesearch/bleve v2.0.2 -> v2.0.3 * github.com/denisenkom/go-mssqldb v0.9.0 -> v0.10.0 * github.com/editorconfig/editorconfig-core-go v2.4.1 -> v2.4.2 * github.com/go-chi/cors v1.1.1 -> v1.2.0 * github.com/go-git/go-billy v5.0.0 -> v5.1.0 * github.com/go-git/go-git v5.2.0 -> v5.3.0 * github.com/go-ldap/ldap v3.2.4 -> v3.3.0 * github.com/go-redis/redis v8.6.0 -> v8.8.2 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/go-swagger/go-swagger v0.26.1 -> v0.27.0 * github.com/lib/pq v1.9.0 -> v1.10.1 * github.com/mattn/go-sqlite3 v1.14.6 -> v1.14.7 * github.com/go-testfixtures/testfixtures v3.5.0 -> v3.6.0 * github.com/issue9/identicon v1.0.1 -> v1.2.0 * github.com/klauspost/compress v1.11.8 -> v1.12.1 * github.com/mgechev/revive v1.0.3 -> v1.0.6 * github.com/microcosm-cc/bluemonday v1.0.7 -> v1.0.8 * github.com/niklasfasching/go-org v1.4.0 -> v1.5.0 * github.com/olivere/elastic v7.0.22 -> v7.0.24 * github.com/pelletier/go-toml v1.8.1 -> v1.9.0 * github.com/prometheus/client_golang v1.9.0 -> v1.10.0 * github.com/xanzy/go-gitlab v0.44.0 -> v0.48.0 * github.com/yuin/goldmark v1.3.3 -> v1.3.5 * github.com/6543/go-version v1.2.4 -> v1.3.1 * do github.com/lib/pq v1.10.0 -> v1.10.1 again ...
This commit is contained in:
parent
834fc74873
commit
792b4dba2c
558 changed files with 32080 additions and 24669 deletions
1
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate.go
generated
vendored
1
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate.go
generated
vendored
|
@ -24,5 +24,6 @@ type Generate struct {
|
|||
Server *generate.Server `command:"server"`
|
||||
Spec *generate.SpecFile `command:"spec"`
|
||||
Client *generate.Client `command:"client"`
|
||||
Cli *generate.Cli `command:"cli"`
|
||||
Markdown *generate.Markdown `command:"markdown"`
|
||||
}
|
||||
|
|
23
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/cli.go
generated
vendored
Normal file
23
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/cli.go
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
package generate
|
||||
|
||||
import "github.com/go-swagger/go-swagger/generator"
|
||||
|
||||
type Cli struct {
|
||||
// generate a cli includes all client code
|
||||
Client
|
||||
}
|
||||
|
||||
func (c Cli) apply(opts *generator.GenOpts) {
|
||||
c.Client.apply(opts)
|
||||
opts.IncludeCLi = true
|
||||
opts.CliPackage = "cli" // hardcoded for now, can be exposed via cmd opt later
|
||||
}
|
||||
|
||||
func (c *Cli) generate(opts *generator.GenOpts) error {
|
||||
return c.Client.generate(opts)
|
||||
}
|
||||
|
||||
// Execute runs this command
|
||||
func (c *Cli) Execute(args []string) error {
|
||||
return createSwagger(c)
|
||||
}
|
7
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/server.go
generated
vendored
7
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/server.go
generated
vendored
|
@ -22,8 +22,9 @@ import (
|
|||
)
|
||||
|
||||
type serverOptions struct {
|
||||
ServerPackage string `long:"server-package" short:"s" description:"the package to save the server specific code" default:"restapi"`
|
||||
MainTarget string `long:"main-package" short:"" description:"the location of the generated main. Defaults to cmd/{name}-server" default:""`
|
||||
ServerPackage string `long:"server-package" short:"s" description:"the package to save the server specific code" default:"restapi"`
|
||||
MainTarget string `long:"main-package" short:"" description:"the location of the generated main. Defaults to cmd/{name}-server" default:""`
|
||||
ImplementationPackage string `long:"implementation-package" short:"" description:"the location of the backend implementation of the server, which will be autowired with api" default:""`
|
||||
}
|
||||
|
||||
func (cs serverOptions) apply(opts *generator.GenOpts) {
|
||||
|
@ -82,6 +83,8 @@ func (s Server) apply(opts *generator.GenOpts) {
|
|||
|
||||
opts.Name = s.Name
|
||||
opts.MainPackage = s.MainTarget
|
||||
|
||||
opts.ImplementationPackage = s.ImplementationPackage
|
||||
}
|
||||
|
||||
func (s *Server) generate(opts *generator.GenOpts) error {
|
||||
|
|
3
vendor/github.com/go-swagger/go-swagger/cmd/swagger/swagger.go
generated
vendored
3
vendor/github.com/go-swagger/go-swagger/cmd/swagger/swagger.go
generated
vendored
|
@ -120,6 +120,9 @@ It aims to represent the contract of your API with a language agnostic descripti
|
|||
case "markdown":
|
||||
cmd.ShortDescription = "generate a markdown representation from the swagger spec"
|
||||
cmd.LongDescription = cmd.ShortDescription
|
||||
case "cli":
|
||||
cmd.ShortDescription = "generate a command line client tool from the swagger spec"
|
||||
cmd.LongDescription = cmd.ShortDescription
|
||||
}
|
||||
}
|
||||
|
||||
|
|
278
vendor/github.com/go-swagger/go-swagger/generator/bindata.go
generated
vendored
278
vendor/github.com/go-swagger/go-swagger/generator/bindata.go
generated
vendored
File diff suppressed because one or more lines are too long
2
vendor/github.com/go-swagger/go-swagger/generator/language.go
generated
vendored
2
vendor/github.com/go-swagger/go-swagger/generator/language.go
generated
vendored
|
@ -262,7 +262,7 @@ func GoLangOpts() *LanguageOpts {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(string(b), "}", ",}"), "[", "{"), "]", ",}"), nil
|
||||
return strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(string(b), "}", ",}"), "[", "{"), "]", ",}"), "{,}", "{}"), nil
|
||||
}
|
||||
|
||||
opts.BaseImportFunc = func(tgt string) string {
|
||||
|
|
14
vendor/github.com/go-swagger/go-swagger/generator/operation.go
generated
vendored
14
vendor/github.com/go-swagger/go-swagger/generator/operation.go
generated
vendored
|
@ -1130,6 +1130,13 @@ func (b *codeGenOpBuilder) buildOperationSchema(schemaPath, containerName, schem
|
|||
isInterface := schema.IsInterface
|
||||
hasValidations := schema.HasValidations
|
||||
|
||||
// TODO: remove this and find a better way to get package name for anonymous models
|
||||
// get the package that the param will be generated. Used by generate CLI
|
||||
pkg := "operations"
|
||||
if len(b.Operation.Tags) != 0 {
|
||||
pkg = b.Operation.Tags[0]
|
||||
}
|
||||
|
||||
// for complex anonymous objects, produce an extra schema
|
||||
if hasProperties || isAllOf {
|
||||
if b.ExtraSchemas == nil {
|
||||
|
@ -1138,6 +1145,7 @@ func (b *codeGenOpBuilder) buildOperationSchema(schemaPath, containerName, schem
|
|||
schema.Name = schemaName
|
||||
schema.GoType = schemaName
|
||||
schema.IsAnonymous = false
|
||||
schema.Pkg = pkg
|
||||
b.ExtraSchemas[schemaName] = schema
|
||||
|
||||
// constructs new schema to refer to the newly created type
|
||||
|
@ -1147,6 +1155,7 @@ func (b *codeGenOpBuilder) buildOperationSchema(schemaPath, containerName, schem
|
|||
schema.SwaggerType = schemaName
|
||||
schema.HasValidations = hasValidations
|
||||
schema.GoType = schemaName
|
||||
schema.Pkg = pkg
|
||||
} else if isInterface {
|
||||
schema = GenSchema{}
|
||||
schema.IsAnonymous = false
|
||||
|
@ -1288,3 +1297,8 @@ func renameAPIPackage(pkg string) string {
|
|||
// favors readability over perfect deconfliction
|
||||
return "swagger" + pkg
|
||||
}
|
||||
|
||||
func renameImplementationPackage(pkg string) string {
|
||||
// favors readability over perfect deconfliction
|
||||
return "swagger" + pkg + "impl"
|
||||
}
|
||||
|
|
98
vendor/github.com/go-swagger/go-swagger/generator/shared.go
generated
vendored
98
vendor/github.com/go-swagger/go-swagger/generator/shared.go
generated
vendored
|
@ -40,13 +40,14 @@ import (
|
|||
|
||||
const (
|
||||
// default generation targets structure
|
||||
defaultModelsTarget = "models"
|
||||
defaultServerTarget = "restapi"
|
||||
defaultClientTarget = "client"
|
||||
defaultOperationsTarget = "operations"
|
||||
defaultClientName = "rest"
|
||||
defaultServerName = "swagger"
|
||||
defaultScheme = "http"
|
||||
defaultModelsTarget = "models"
|
||||
defaultServerTarget = "restapi"
|
||||
defaultClientTarget = "client"
|
||||
defaultOperationsTarget = "operations"
|
||||
defaultClientName = "rest"
|
||||
defaultServerName = "swagger"
|
||||
defaultScheme = "http"
|
||||
defaultImplementationTarget = "implementation"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -62,7 +63,7 @@ func init() {
|
|||
func DefaultSectionOpts(gen *GenOpts) {
|
||||
sec := gen.Sections
|
||||
if len(sec.Models) == 0 {
|
||||
sec.Models = []TemplateOpts{
|
||||
opts := []TemplateOpts{
|
||||
{
|
||||
Name: "definition",
|
||||
Source: "asset:model",
|
||||
|
@ -70,11 +71,20 @@ func DefaultSectionOpts(gen *GenOpts) {
|
|||
FileName: "{{ (snakize (pascalize .Name)) }}.go",
|
||||
},
|
||||
}
|
||||
if gen.IncludeCLi {
|
||||
opts = append(opts, TemplateOpts{
|
||||
Name: "clidefinitionhook",
|
||||
Source: "asset:cliModelcli",
|
||||
Target: "{{ joinFilePath .Target (toPackagePath .CliPackage) }}",
|
||||
FileName: "{{ (snakize (pascalize .Name)) }}_model.go",
|
||||
})
|
||||
}
|
||||
sec.Models = opts
|
||||
}
|
||||
|
||||
if len(sec.Operations) == 0 {
|
||||
if gen.IsClient {
|
||||
sec.Operations = []TemplateOpts{
|
||||
opts := []TemplateOpts{
|
||||
{
|
||||
Name: "parameters",
|
||||
Source: "asset:clientParameter",
|
||||
|
@ -88,6 +98,15 @@ func DefaultSectionOpts(gen *GenOpts) {
|
|||
FileName: "{{ (snakize (pascalize .Name)) }}_responses.go",
|
||||
},
|
||||
}
|
||||
if gen.IncludeCLi {
|
||||
opts = append(opts, TemplateOpts{
|
||||
Name: "clioperation",
|
||||
Source: "asset:cliOperation",
|
||||
Target: "{{ joinFilePath .Target (toPackagePath .CliPackage) }}",
|
||||
FileName: "{{ (snakize (pascalize .Name)) }}_operation.go",
|
||||
})
|
||||
}
|
||||
sec.Operations = opts
|
||||
} else {
|
||||
ops := []TemplateOpts{}
|
||||
if gen.IncludeParameters {
|
||||
|
@ -143,7 +162,7 @@ func DefaultSectionOpts(gen *GenOpts) {
|
|||
|
||||
if len(sec.Application) == 0 {
|
||||
if gen.IsClient {
|
||||
sec.Application = []TemplateOpts{
|
||||
opts := []TemplateOpts{
|
||||
{
|
||||
Name: "facade",
|
||||
Source: "asset:clientFacade",
|
||||
|
@ -151,15 +170,23 @@ func DefaultSectionOpts(gen *GenOpts) {
|
|||
FileName: "{{ snakize .Name }}Client.go",
|
||||
},
|
||||
}
|
||||
if gen.IncludeCLi {
|
||||
// include a commandline tool app
|
||||
opts = append(opts, []TemplateOpts{{
|
||||
Name: "commandline",
|
||||
Source: "asset:cliCli",
|
||||
Target: "{{ joinFilePath .Target (toPackagePath .CliPackage) }}",
|
||||
FileName: "cli.go",
|
||||
}, {
|
||||
Name: "climain",
|
||||
Source: "asset:cliMain",
|
||||
Target: "{{ joinFilePath .Target \"cmd\" (toPackagePath .CliPackage) }}",
|
||||
FileName: "main.go",
|
||||
}}...)
|
||||
}
|
||||
sec.Application = opts
|
||||
} else {
|
||||
sec.Application = []TemplateOpts{
|
||||
{
|
||||
Name: "configure",
|
||||
Source: "asset:serverConfigureapi",
|
||||
Target: "{{ joinFilePath .Target (toPackagePath .ServerPackage) }}",
|
||||
FileName: "configure_{{ (snakize (pascalize .Name)) }}.go",
|
||||
SkipExists: !gen.RegenerateConfigureAPI,
|
||||
},
|
||||
opts := []TemplateOpts{
|
||||
{
|
||||
Name: "main",
|
||||
Source: "asset:serverMain",
|
||||
|
@ -191,6 +218,25 @@ func DefaultSectionOpts(gen *GenOpts) {
|
|||
FileName: "doc.go",
|
||||
},
|
||||
}
|
||||
if gen.ImplementationPackage != "" {
|
||||
// Use auto configure template
|
||||
opts = append(opts, TemplateOpts{
|
||||
Name: "autoconfigure",
|
||||
Source: "asset:serverAutoconfigureapi",
|
||||
Target: "{{ joinFilePath .Target (toPackagePath .ServerPackage) }}",
|
||||
FileName: "auto_configure_{{ (snakize (pascalize .Name)) }}.go",
|
||||
})
|
||||
|
||||
} else {
|
||||
opts = append(opts, TemplateOpts{
|
||||
Name: "configure",
|
||||
Source: "asset:serverConfigureapi",
|
||||
Target: "{{ joinFilePath .Target (toPackagePath .ServerPackage) }}",
|
||||
FileName: "configure_{{ (snakize (pascalize .Name)) }}.go",
|
||||
SkipExists: !gen.RegenerateConfigureAPI,
|
||||
})
|
||||
}
|
||||
sec.Application = opts
|
||||
}
|
||||
}
|
||||
gen.Sections = sec
|
||||
|
@ -248,6 +294,7 @@ type GenOpts struct {
|
|||
IncludeURLBuilder bool
|
||||
IncludeMain bool
|
||||
IncludeSupport bool
|
||||
IncludeCLi bool
|
||||
ExcludeSpec bool
|
||||
DumpData bool
|
||||
ValidateSpec bool
|
||||
|
@ -263,9 +310,11 @@ type GenOpts struct {
|
|||
ModelPackage string
|
||||
ServerPackage string
|
||||
ClientPackage string
|
||||
CliPackage string
|
||||
ImplementationPackage string
|
||||
Principal string
|
||||
PrincipalCustomIface bool // user-provided interface for Principal (non-nullable)
|
||||
Target string
|
||||
PrincipalCustomIface bool // user-provided interface for Principal (non-nullable)
|
||||
Target string // dir location where generated code is written to
|
||||
Sections SectionOpts
|
||||
LanguageOpts *LanguageOpts
|
||||
TypeMapping map[string]string
|
||||
|
@ -488,16 +537,17 @@ func (g *GenOpts) location(t *TemplateOpts, data interface{}) (string, string, e
|
|||
}
|
||||
|
||||
d := struct {
|
||||
Name, Package, APIPackage, ServerPackage, ClientPackage, ModelPackage, MainPackage, Target string
|
||||
Tags []string
|
||||
UseTags bool
|
||||
Context interface{}
|
||||
Name, Package, APIPackage, ServerPackage, ClientPackage, CliPackage, ModelPackage, MainPackage, Target string
|
||||
Tags []string
|
||||
UseTags bool
|
||||
Context interface{}
|
||||
}{
|
||||
Name: name,
|
||||
Package: pkg,
|
||||
APIPackage: g.APIPackage,
|
||||
ServerPackage: g.ServerPackage,
|
||||
ClientPackage: g.ClientPackage,
|
||||
CliPackage: g.CliPackage,
|
||||
ModelPackage: g.ModelPackage,
|
||||
MainPackage: g.MainPackage,
|
||||
Target: g.Target,
|
||||
|
|
57
vendor/github.com/go-swagger/go-swagger/generator/structs.go
generated
vendored
57
vendor/github.com/go-swagger/go-swagger/generator/structs.go
generated
vendored
|
@ -146,6 +146,8 @@ func (g GenSchema) PrintTags() string {
|
|||
if tag == "example" && len(g.Example) > 0 {
|
||||
// only add example tag if it's contained in the struct tags
|
||||
tags["example"] = g.Example // json representation of the example object
|
||||
} else if tag == "description" && len(g.Description) > 0 {
|
||||
tags["description"] = g.Description
|
||||
} else {
|
||||
tags[tag] = tags["json"]
|
||||
}
|
||||
|
@ -645,33 +647,34 @@ func (g GenOperations) Swap(i, j int) { g[i], g[j] = g[j], g[i] }
|
|||
// from a swagger spec
|
||||
type GenApp struct {
|
||||
GenCommon
|
||||
APIPackage string
|
||||
ServerPackageAlias string
|
||||
APIPackageAlias string
|
||||
Package string
|
||||
ReceiverName string
|
||||
Name string
|
||||
Principal string
|
||||
PrincipalIsNullable bool
|
||||
DefaultConsumes string
|
||||
DefaultProduces string
|
||||
Host string
|
||||
BasePath string
|
||||
Info *spec.Info
|
||||
ExternalDocs *spec.ExternalDocumentation
|
||||
Tags []spec.Tag
|
||||
Imports map[string]string
|
||||
DefaultImports map[string]string
|
||||
Schemes []string
|
||||
ExtraSchemes []string
|
||||
Consumes GenSerGroups
|
||||
Produces GenSerGroups
|
||||
SecurityDefinitions GenSecuritySchemes
|
||||
SecurityRequirements []analysis.SecurityRequirement // original security requirements as per the spec (for doc)
|
||||
Models []GenDefinition
|
||||
Operations GenOperations
|
||||
OperationGroups GenOperationGroups
|
||||
SwaggerJSON string
|
||||
APIPackage string
|
||||
ServerPackageAlias string
|
||||
ImplementationPackageAlias string
|
||||
APIPackageAlias string
|
||||
Package string
|
||||
ReceiverName string
|
||||
Name string
|
||||
Principal string
|
||||
PrincipalIsNullable bool
|
||||
DefaultConsumes string
|
||||
DefaultProduces string
|
||||
Host string
|
||||
BasePath string
|
||||
Info *spec.Info
|
||||
ExternalDocs *spec.ExternalDocumentation
|
||||
Tags []spec.Tag
|
||||
Imports map[string]string
|
||||
DefaultImports map[string]string
|
||||
Schemes []string
|
||||
ExtraSchemes []string
|
||||
Consumes GenSerGroups
|
||||
Produces GenSerGroups
|
||||
SecurityDefinitions GenSecuritySchemes
|
||||
SecurityRequirements []analysis.SecurityRequirement // original security requirements as per the spec (for doc)
|
||||
Models []GenDefinition
|
||||
Operations GenOperations
|
||||
OperationGroups GenOperationGroups
|
||||
SwaggerJSON string
|
||||
// Embedded specs: this is important for when the generated server adds routes.
|
||||
// NOTE: there is a distinct advantage to having this in runtime rather than generated code.
|
||||
// We are not ever going to generate the router.
|
||||
|
|
69
vendor/github.com/go-swagger/go-swagger/generator/support.go
generated
vendored
69
vendor/github.com/go-swagger/go-swagger/generator/support.go
generated
vendored
|
@ -217,6 +217,12 @@ func (a *appGenerator) GenerateSupport(ap *GenApp) error {
|
|||
app.DefaultImports[pkgAlias] = serverPath
|
||||
app.ServerPackageAlias = pkgAlias
|
||||
|
||||
// add client import for cli generation
|
||||
clientPath := path.Join(baseImport,
|
||||
a.GenOpts.LanguageOpts.ManglePackagePath(a.ClientPackage, defaultClientTarget))
|
||||
clientPkgAlias := importAlias(clientPath)
|
||||
app.DefaultImports[clientPkgAlias] = clientPath
|
||||
|
||||
return a.GenOpts.renderApplication(app)
|
||||
}
|
||||
|
||||
|
@ -260,6 +266,12 @@ func (a *appGenerator) makeCodegenApp() (GenApp, error) {
|
|||
baseImport,
|
||||
a.GenOpts.LanguageOpts.ManglePackagePath(a.OperationsPackage, defaultOperationsTarget))
|
||||
|
||||
implAlias := ""
|
||||
if a.GenOpts.ImplementationPackage != "" {
|
||||
implAlias = deconflictPkg(a.GenOpts.LanguageOpts.ManglePackageName(a.GenOpts.ImplementationPackage, defaultImplementationTarget), renameImplementationPackage)
|
||||
imports[implAlias] = a.GenOpts.ImplementationPackage
|
||||
}
|
||||
|
||||
log.Printf("planning definitions (found: %d)", len(a.Models))
|
||||
|
||||
genModels := make(GenDefinitions, 0, len(a.Models))
|
||||
|
@ -434,34 +446,35 @@ func (a *appGenerator) makeCodegenApp() (GenApp, error) {
|
|||
Copyright: a.GenOpts.Copyright,
|
||||
TargetImportPath: baseImport,
|
||||
},
|
||||
APIPackage: a.GenOpts.LanguageOpts.ManglePackageName(a.ServerPackage, defaultServerTarget),
|
||||
APIPackageAlias: alias,
|
||||
Package: a.Package,
|
||||
ReceiverName: receiver,
|
||||
Name: a.Name,
|
||||
Host: host,
|
||||
BasePath: basePath,
|
||||
Schemes: schemeOrDefault(collectedSchemes, a.DefaultScheme),
|
||||
ExtraSchemes: extraSchemes,
|
||||
ExternalDocs: trimExternalDoc(sw.ExternalDocs),
|
||||
Tags: trimTags(sw.Tags),
|
||||
Info: trimInfo(sw.Info),
|
||||
Consumes: consumes,
|
||||
Produces: produces,
|
||||
DefaultConsumes: a.DefaultConsumes,
|
||||
DefaultProduces: a.DefaultProduces,
|
||||
DefaultImports: defaultImports,
|
||||
Imports: imports,
|
||||
SecurityDefinitions: security,
|
||||
SecurityRequirements: securityRequirements(a.SpecDoc.Spec().Security), // top level securityRequirements
|
||||
Models: genModels,
|
||||
Operations: genOps,
|
||||
OperationGroups: opGroups,
|
||||
Principal: a.GenOpts.PrincipalAlias(),
|
||||
SwaggerJSON: generateReadableSpec(jsonb),
|
||||
FlatSwaggerJSON: generateReadableSpec(flatjsonb),
|
||||
ExcludeSpec: a.GenOpts.ExcludeSpec,
|
||||
GenOpts: a.GenOpts,
|
||||
APIPackage: a.GenOpts.LanguageOpts.ManglePackageName(a.ServerPackage, defaultServerTarget),
|
||||
APIPackageAlias: alias,
|
||||
ImplementationPackageAlias: implAlias,
|
||||
Package: a.Package,
|
||||
ReceiverName: receiver,
|
||||
Name: a.Name,
|
||||
Host: host,
|
||||
BasePath: basePath,
|
||||
Schemes: schemeOrDefault(collectedSchemes, a.DefaultScheme),
|
||||
ExtraSchemes: extraSchemes,
|
||||
ExternalDocs: trimExternalDoc(sw.ExternalDocs),
|
||||
Tags: trimTags(sw.Tags),
|
||||
Info: trimInfo(sw.Info),
|
||||
Consumes: consumes,
|
||||
Produces: produces,
|
||||
DefaultConsumes: a.DefaultConsumes,
|
||||
DefaultProduces: a.DefaultProduces,
|
||||
DefaultImports: defaultImports,
|
||||
Imports: imports,
|
||||
SecurityDefinitions: security,
|
||||
SecurityRequirements: securityRequirements(a.SpecDoc.Spec().Security), // top level securityRequirements
|
||||
Models: genModels,
|
||||
Operations: genOps,
|
||||
OperationGroups: opGroups,
|
||||
Principal: a.GenOpts.PrincipalAlias(),
|
||||
SwaggerJSON: generateReadableSpec(jsonb),
|
||||
FlatSwaggerJSON: generateReadableSpec(flatjsonb),
|
||||
ExcludeSpec: a.GenOpts.ExcludeSpec,
|
||||
GenOpts: a.GenOpts,
|
||||
|
||||
PrincipalIsNullable: a.GenOpts.PrincipalIsNullable(),
|
||||
}, nil
|
||||
|
|
41
vendor/github.com/go-swagger/go-swagger/generator/template_repo.go
generated
vendored
41
vendor/github.com/go-swagger/go-swagger/generator/template_repo.go
generated
vendored
|
@ -137,6 +137,7 @@ func DefaultFuncMap(lang *LanguageOpts) template.FuncMap {
|
|||
"httpStatus": httpStatus,
|
||||
"cleanupEnumVariant": cleanupEnumVariant,
|
||||
"gt0": gt0,
|
||||
"hasfield": hasField,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -179,15 +180,16 @@ func defaultAssets() map[string][]byte {
|
|||
"swagger_json_embed.gotmpl": MustAsset("templates/swagger_json_embed.gotmpl"),
|
||||
|
||||
// server templates
|
||||
"server/parameter.gotmpl": MustAsset("templates/server/parameter.gotmpl"),
|
||||
"server/urlbuilder.gotmpl": MustAsset("templates/server/urlbuilder.gotmpl"),
|
||||
"server/responses.gotmpl": MustAsset("templates/server/responses.gotmpl"),
|
||||
"server/operation.gotmpl": MustAsset("templates/server/operation.gotmpl"),
|
||||
"server/builder.gotmpl": MustAsset("templates/server/builder.gotmpl"),
|
||||
"server/server.gotmpl": MustAsset("templates/server/server.gotmpl"),
|
||||
"server/configureapi.gotmpl": MustAsset("templates/server/configureapi.gotmpl"),
|
||||
"server/main.gotmpl": MustAsset("templates/server/main.gotmpl"),
|
||||
"server/doc.gotmpl": MustAsset("templates/server/doc.gotmpl"),
|
||||
"server/parameter.gotmpl": MustAsset("templates/server/parameter.gotmpl"),
|
||||
"server/urlbuilder.gotmpl": MustAsset("templates/server/urlbuilder.gotmpl"),
|
||||
"server/responses.gotmpl": MustAsset("templates/server/responses.gotmpl"),
|
||||
"server/operation.gotmpl": MustAsset("templates/server/operation.gotmpl"),
|
||||
"server/builder.gotmpl": MustAsset("templates/server/builder.gotmpl"),
|
||||
"server/server.gotmpl": MustAsset("templates/server/server.gotmpl"),
|
||||
"server/configureapi.gotmpl": MustAsset("templates/server/configureapi.gotmpl"),
|
||||
"server/autoconfigureapi.gotmpl": MustAsset("templates/server/autoconfigureapi.gotmpl"),
|
||||
"server/main.gotmpl": MustAsset("templates/server/main.gotmpl"),
|
||||
"server/doc.gotmpl": MustAsset("templates/server/doc.gotmpl"),
|
||||
|
||||
// client templates
|
||||
"client/parameter.gotmpl": MustAsset("templates/client/parameter.gotmpl"),
|
||||
|
@ -196,6 +198,15 @@ func defaultAssets() map[string][]byte {
|
|||
"client/facade.gotmpl": MustAsset("templates/client/facade.gotmpl"),
|
||||
|
||||
"markdown/docs.gotmpl": MustAsset("templates/markdown/docs.gotmpl"),
|
||||
|
||||
// cli templates
|
||||
"cli/cli.gotmpl": MustAsset("templates/cli/cli.gotmpl"),
|
||||
"cli/main.gotmpl": MustAsset("templates/cli/main.gotmpl"),
|
||||
"cli/modelcli.gotmpl": MustAsset("templates/cli/modelcli.gotmpl"),
|
||||
"cli/operation.gotmpl": MustAsset("templates/cli/operation.gotmpl"),
|
||||
"cli/registerflag.gotmpl": MustAsset("templates/cli/registerflag.gotmpl"),
|
||||
"cli/retrieveflag.gotmpl": MustAsset("templates/cli/retrieveflag.gotmpl"),
|
||||
"cli/schema.gotmpl": MustAsset("templates/cli/schema.gotmpl"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -830,3 +841,15 @@ func gt0(in *int64) bool {
|
|||
// with a pointer
|
||||
return in != nil && *in > 0
|
||||
}
|
||||
|
||||
// returns struct v has field of name
|
||||
func hasField(v interface{}, name string) bool {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.Kind() == reflect.Ptr {
|
||||
rv = rv.Elem()
|
||||
}
|
||||
if rv.Kind() != reflect.Struct {
|
||||
return false
|
||||
}
|
||||
return rv.FieldByName(name).IsValid()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue