This commit is contained in:
techknowlogick 2021-02-28 18:08:33 -05:00 committed by GitHub
parent 030646eea4
commit 47f6a4ec3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
947 changed files with 26119 additions and 7062 deletions

View file

@ -37,7 +37,7 @@ type SpecFile struct {
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:"the file to use as input"`
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)"`

View file

@ -24,7 +24,7 @@ type SpecFile struct {
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:"the file to use as input"`
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)"`

View file

@ -19,16 +19,10 @@ import (
"log"
"os"
"github.com/go-openapi/loads"
"github.com/go-openapi/loads/fmts"
"github.com/go-swagger/go-swagger/cmd/swagger/commands"
flags "github.com/jessevdk/go-flags"
)
func init() {
loads.AddLoader(fmts.YAMLMatcher, fmts.YAMLDoc)
}
var opts struct {
// General options applicable to all commands
Quiet func() `long:"quiet" short:"q" description:"silence logs"`

File diff suppressed because one or more lines are too long

View file

@ -635,7 +635,7 @@ func pascalize(arg string) string {
return "Empty"
case 1: // handle special case when we have a single rune that is not handled by swag.ToGoName
switch runes[0] {
case '+', '-', '#', '_': // those cases are handled differently than swag utility
case '+', '-', '#', '_', '*', '/', '=': // those cases are handled differently than swag utility
return prefixForName(arg)
}
}
@ -654,6 +654,12 @@ func prefixForName(arg string) string {
return "Minus"
case '#':
return "HashTag"
case '*':
return "Asterisk"
case '/':
return "ForwardSlash"
case '=':
return "EqualSign"
// other cases ($,@ etc..) handled by swag.ToGoName
}
return "Nr"

View file

@ -583,7 +583,7 @@ func (t *typeResolver) resolveObject(schema *spec.Schema, isAnonymous bool) (res
// only complex map elements are nullable (when not forced by x-nullable)
// TODO: figure out if required to check when not discriminated like arrays?
et.IsNullable = t.isNullable(schema.AdditionalProperties.Schema)
et.IsNullable = !et.IsArray && t.isNullable(schema.AdditionalProperties.Schema)
if et.IsNullable {
result.GoType = "map[string]*" + et.GoType
} else {
@ -866,6 +866,7 @@ func (t *typeResolver) ResolveSchema(schema *spec.Schema, isAnonymous, isRequire
// non-embedded external type: by default consider that validation is enabled (SkipExternalValidation: false)
result.SkipExternalValidation = swag.BoolValue(extType.Hints.NoValidation)
}
if nullable, ok := t.isNullableOverride(schema); ok {
result.IsNullable = nullable
}