mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-18 06:34:07 +09:00
[Vendor Update] go-swagger v0.20.1 -> v0.21.0 (#9410)
* Update go-swagger v0.20.1 -> v0.21.0 * go mod tidy
This commit is contained in:
5
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/server.go
generated
vendored
5
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/server.go
generated
vendored
@ -37,7 +37,7 @@ type Server struct {
|
||||
ExcludeSpec bool `long:"exclude-spec" description:"don't embed the swagger specification"`
|
||||
WithContext bool `long:"with-context" description:"handlers get a context as first arg (deprecated)"`
|
||||
DumpData bool `long:"dump-data" description:"when present dumps the json for the template generator instead of generating files"`
|
||||
FlagStrategy string `long:"flag-strategy" description:"the strategy to provide flags for the server" default:"go-flags" choice:"go-flags" choice:"pflag"`
|
||||
FlagStrategy string `long:"flag-strategy" description:"the strategy to provide flags for the server" default:"go-flags" choice:"go-flags" choice:"pflag" choice:"flag"`
|
||||
CompatibilityMode string `long:"compatibility-mode" description:"the compatibility mode for the tls server" default:"modern" choice:"modern" choice:"intermediate"`
|
||||
SkipValidation bool `long:"skip-validation" description:"skips validation of spec prior to generation"`
|
||||
RegenerateConfigureAPI bool `long:"regenerate-configureapi" description:"Force regeneration of configureapi.go"`
|
||||
@ -83,6 +83,7 @@ func (s *Server) getOpts() (*generator.GenOpts, error) {
|
||||
FlagStrategy: s.FlagStrategy,
|
||||
CompatibilityMode: s.CompatibilityMode,
|
||||
ExistingModels: s.ExistingModels,
|
||||
AllowTemplateOverride: s.AllowTemplateOverride,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -98,6 +99,8 @@ func (s *Server) log(rp string) {
|
||||
var flagsPackage string
|
||||
if strings.HasPrefix(s.FlagStrategy, "pflag") {
|
||||
flagsPackage = "github.com/spf13/pflag"
|
||||
} else if strings.HasPrefix(s.FlagStrategy, "flag") {
|
||||
flagsPackage = "flag"
|
||||
} else {
|
||||
flagsPackage = "github.com/jessevdk/go-flags"
|
||||
}
|
||||
|
1
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/shared.go
generated
vendored
1
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/generate/shared.go
generated
vendored
@ -81,6 +81,7 @@ type shared struct {
|
||||
CopyrightFile flags.Filename `long:"copyright-file" short:"r" description:"copyright file used to add copyright header"`
|
||||
ExistingModels string `long:"existing-models" description:"use pre-generated models e.g. github.com/foobar/model"`
|
||||
AdditionalInitialisms []string `long:"additional-initialism" description:"consecutive capitals that should be considered intialisms"`
|
||||
AllowTemplateOverride bool `long:"allow-template-override" description:"allows overriding protected templates"`
|
||||
FlattenCmdOptions
|
||||
}
|
||||
|
||||
|
6
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/mixin.go
generated
vendored
6
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/mixin.go
generated
vendored
@ -10,6 +10,8 @@ import (
|
||||
"github.com/go-openapi/loads"
|
||||
"github.com/go-openapi/spec"
|
||||
flags "github.com/jessevdk/go-flags"
|
||||
|
||||
"github.com/go-swagger/go-swagger/generator"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -24,6 +26,7 @@ type MixinSpec struct {
|
||||
ExpectedCollisionCount uint `short:"c" description:"expected # of rejected mixin paths, defs, etc due to existing key. Non-zero exit if does not match actual."`
|
||||
Compact bool `long:"compact" description:"applies to JSON formatted specs. When present, doesn't prettify the json"`
|
||||
Output flags.Filename `long:"output" short:"o" description:"the file to write to"`
|
||||
KeepSpecOrder bool `long:"keep-spec-order" description:"Keep schema properties order identical to spec file"`
|
||||
Format string `long:"format" description:"the format for the spec document" default:"json" choice:"yaml" choice:"json"`
|
||||
}
|
||||
|
||||
@ -89,6 +92,9 @@ func (c *MixinSpec) MixinFiles(primaryFile string, mixinFiles []string, w io.Wri
|
||||
|
||||
var mixins []*spec.Swagger
|
||||
for _, mixinFile := range mixinFiles {
|
||||
if c.KeepSpecOrder {
|
||||
mixinFile = generator.WithAutoXOrder(mixinFile)
|
||||
}
|
||||
mixin, lerr := loads.Spec(mixinFile)
|
||||
if lerr != nil {
|
||||
return nil, lerr
|
||||
|
16
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/serve.go
generated
vendored
16
vendor/github.com/go-swagger/go-swagger/cmd/swagger/commands/serve.go
generated
vendored
@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/go-openapi/spec"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
@ -25,6 +26,7 @@ type ServeCmd struct {
|
||||
DocURL string `long:"doc-url" description:"override the url which takes a url query param to render the doc ui"`
|
||||
NoOpen bool `long:"no-open" description:"when present won't open the the browser to show the url"`
|
||||
NoUI bool `long:"no-ui" description:"when present, only the swagger spec will be served"`
|
||||
Flatten bool `long:"flatten" description:"when present, flatten the swagger spec before serving it"`
|
||||
Port int `long:"port" short:"p" description:"the port to serve this site" env:"PORT"`
|
||||
Host string `long:"host" description:"the interface to serve this site, defaults to 0.0.0.0" env:"HOST"`
|
||||
}
|
||||
@ -39,6 +41,20 @@ func (s *ServeCmd) Execute(args []string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if s.Flatten {
|
||||
var err error
|
||||
specDoc, err = specDoc.Expanded(&spec.ExpandOptions{
|
||||
SkipSchemas: false,
|
||||
ContinueOnError: true,
|
||||
AbsoluteCircularRef: true,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
b, err := json.MarshalIndent(specDoc.Spec(), "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user