[Vendor] update go-swagger v0.21.0 -> v0.25.0 (#12670)
* Update go-swagger * vendor
This commit is contained in:
parent
66843f2237
commit
3270e7a443
350 changed files with 26353 additions and 5552 deletions
75
vendor/github.com/go-openapi/validate/helpers.go
generated
vendored
75
vendor/github.com/go-openapi/validate/helpers.go
generated
vendored
|
@ -26,8 +26,67 @@ import (
|
|||
"github.com/go-openapi/spec"
|
||||
)
|
||||
|
||||
const swaggerBody = "body"
|
||||
const objectType = "object"
|
||||
const (
|
||||
swaggerBody = "body"
|
||||
swaggerExample = "example"
|
||||
swaggerExamples = "examples"
|
||||
)
|
||||
|
||||
const (
|
||||
objectType = "object"
|
||||
arrayType = "array"
|
||||
stringType = "string"
|
||||
integerType = "integer"
|
||||
numberType = "number"
|
||||
booleanType = "boolean"
|
||||
fileType = "file"
|
||||
nullType = "null"
|
||||
)
|
||||
|
||||
const (
|
||||
jsonProperties = "properties"
|
||||
jsonItems = "items"
|
||||
jsonType = "type"
|
||||
//jsonSchema = "schema"
|
||||
jsonDefault = "default"
|
||||
)
|
||||
|
||||
const (
|
||||
stringFormatDate = "date"
|
||||
stringFormatDateTime = "date-time"
|
||||
stringFormatPassword = "password"
|
||||
stringFormatByte = "byte"
|
||||
//stringFormatBinary = "binary"
|
||||
stringFormatCreditCard = "creditcard"
|
||||
stringFormatDuration = "duration"
|
||||
stringFormatEmail = "email"
|
||||
stringFormatHexColor = "hexcolor"
|
||||
stringFormatHostname = "hostname"
|
||||
stringFormatIPv4 = "ipv4"
|
||||
stringFormatIPv6 = "ipv6"
|
||||
stringFormatISBN = "isbn"
|
||||
stringFormatISBN10 = "isbn10"
|
||||
stringFormatISBN13 = "isbn13"
|
||||
stringFormatMAC = "mac"
|
||||
stringFormatBSONObjectID = "bsonobjectid"
|
||||
stringFormatRGBColor = "rgbcolor"
|
||||
stringFormatSSN = "ssn"
|
||||
stringFormatURI = "uri"
|
||||
stringFormatUUID = "uuid"
|
||||
stringFormatUUID3 = "uuid3"
|
||||
stringFormatUUID4 = "uuid4"
|
||||
stringFormatUUID5 = "uuid5"
|
||||
|
||||
integerFormatInt32 = "int32"
|
||||
integerFormatInt64 = "int64"
|
||||
integerFormatUInt32 = "uint32"
|
||||
integerFormatUInt64 = "uint64"
|
||||
|
||||
numberFormatFloat32 = "float32"
|
||||
numberFormatFloat64 = "float64"
|
||||
numberFormatFloat = "float"
|
||||
numberFormatDouble = "double"
|
||||
)
|
||||
|
||||
// Helpers available at the package level
|
||||
var (
|
||||
|
@ -205,7 +264,8 @@ func (h *paramHelper) checkExpandedParam(pr *spec.Parameter, path, in, operation
|
|||
res := new(Result)
|
||||
simpleZero := spec.SimpleSchema{}
|
||||
// Try to explain why... best guess
|
||||
if pr.In == swaggerBody && (pr.SimpleSchema != simpleZero && pr.SimpleSchema.Type != objectType) {
|
||||
switch {
|
||||
case pr.In == swaggerBody && (pr.SimpleSchema != simpleZero && pr.SimpleSchema.Type != objectType):
|
||||
if isRef {
|
||||
// Most likely, a $ref with a sibling is an unwanted situation: in itself this is a warning...
|
||||
// but we detect it because of the following error:
|
||||
|
@ -213,13 +273,12 @@ func (h *paramHelper) checkExpandedParam(pr *spec.Parameter, path, in, operation
|
|||
res.AddWarnings(refShouldNotHaveSiblingsMsg(path, operation))
|
||||
}
|
||||
res.AddErrors(invalidParameterDefinitionMsg(path, in, operation))
|
||||
} else if pr.In != swaggerBody && pr.Schema != nil {
|
||||
case pr.In != swaggerBody && pr.Schema != nil:
|
||||
if isRef {
|
||||
res.AddWarnings(refShouldNotHaveSiblingsMsg(path, operation))
|
||||
}
|
||||
res.AddErrors(invalidParameterDefinitionAsSchemaMsg(path, in, operation))
|
||||
} else if (pr.In == swaggerBody && pr.Schema == nil) ||
|
||||
(pr.In != swaggerBody && pr.SimpleSchema == simpleZero) { // Safeguard
|
||||
case (pr.In == swaggerBody && pr.Schema == nil) || (pr.In != swaggerBody && pr.SimpleSchema == simpleZero):
|
||||
// Other unexpected mishaps
|
||||
res.AddErrors(invalidParameterDefinitionMsg(path, in, operation))
|
||||
}
|
||||
|
@ -254,8 +313,8 @@ func (r *responseHelper) responseMsgVariants(
|
|||
responseType string,
|
||||
responseCode int) (responseName, responseCodeAsStr string) {
|
||||
// Path variants for messages
|
||||
if responseType == "default" {
|
||||
responseCodeAsStr = "default"
|
||||
if responseType == jsonDefault {
|
||||
responseCodeAsStr = jsonDefault
|
||||
responseName = "default response"
|
||||
} else {
|
||||
responseCodeAsStr = strconv.Itoa(responseCode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue