mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-23 09:30:50 +00:00
[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
50
vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
generated
vendored
50
vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
generated
vendored
|
@ -128,7 +128,6 @@ package protoreflect
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
|
@ -408,19 +407,14 @@ type EnumRanges interface {
|
|||
doNotImplement
|
||||
}
|
||||
|
||||
var (
|
||||
regexName = regexp.MustCompile(`^[_a-zA-Z][_a-zA-Z0-9]*$`)
|
||||
regexFullName = regexp.MustCompile(`^[_a-zA-Z][_a-zA-Z0-9]*(\.[_a-zA-Z][_a-zA-Z0-9]*)*$`)
|
||||
)
|
||||
|
||||
// Name is the short name for a proto declaration. This is not the name
|
||||
// as used in Go source code, which might not be identical to the proto name.
|
||||
type Name string // e.g., "Kind"
|
||||
|
||||
// IsValid reports whether n is a syntactically valid name.
|
||||
// IsValid reports whether s is a syntactically valid name.
|
||||
// An empty name is invalid.
|
||||
func (n Name) IsValid() bool {
|
||||
return regexName.MatchString(string(n))
|
||||
func (s Name) IsValid() bool {
|
||||
return consumeIdent(string(s)) == len(s)
|
||||
}
|
||||
|
||||
// Names represent a list of names.
|
||||
|
@ -443,10 +437,42 @@ type Names interface {
|
|||
// This should not have any leading or trailing dots.
|
||||
type FullName string // e.g., "google.protobuf.Field.Kind"
|
||||
|
||||
// IsValid reports whether n is a syntactically valid full name.
|
||||
// IsValid reports whether s is a syntactically valid full name.
|
||||
// An empty full name is invalid.
|
||||
func (n FullName) IsValid() bool {
|
||||
return regexFullName.MatchString(string(n))
|
||||
func (s FullName) IsValid() bool {
|
||||
i := consumeIdent(string(s))
|
||||
if i < 0 {
|
||||
return false
|
||||
}
|
||||
for len(s) > i {
|
||||
if s[i] != '.' {
|
||||
return false
|
||||
}
|
||||
i++
|
||||
n := consumeIdent(string(s[i:]))
|
||||
if n < 0 {
|
||||
return false
|
||||
}
|
||||
i += n
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func consumeIdent(s string) (i int) {
|
||||
if len(s) == 0 || !isLetter(s[i]) {
|
||||
return -1
|
||||
}
|
||||
i++
|
||||
for len(s) > i && isLetterDigit(s[i]) {
|
||||
i++
|
||||
}
|
||||
return i
|
||||
}
|
||||
func isLetter(c byte) bool {
|
||||
return c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
|
||||
}
|
||||
func isLetterDigit(c byte) bool {
|
||||
return isLetter(c) || ('0' <= c && c <= '9')
|
||||
}
|
||||
|
||||
// Name returns the short name, which is the last identifier segment.
|
||||
|
|
80
vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
generated
vendored
80
vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
generated
vendored
|
@ -7,7 +7,6 @@ package protoreflect
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// Value is a union where only one Go type may be set at a time.
|
||||
|
@ -86,8 +85,10 @@ func ValueOf(v interface{}) Value {
|
|||
return ValueOfEnum(v)
|
||||
case Message, List, Map:
|
||||
return valueOfIface(v)
|
||||
case ProtoMessage:
|
||||
panic(fmt.Sprintf("invalid proto.Message(%T) type, expected a protoreflect.Message type", v))
|
||||
default:
|
||||
panic(fmt.Sprintf("invalid type: %v", reflect.TypeOf(v)))
|
||||
panic(fmt.Sprintf("invalid type: %T", v))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,13 +198,55 @@ func (v Value) Interface() interface{} {
|
|||
}
|
||||
}
|
||||
|
||||
func (v Value) typeName() string {
|
||||
switch v.typ {
|
||||
case nilType:
|
||||
return "nil"
|
||||
case boolType:
|
||||
return "bool"
|
||||
case int32Type:
|
||||
return "int32"
|
||||
case int64Type:
|
||||
return "int64"
|
||||
case uint32Type:
|
||||
return "uint32"
|
||||
case uint64Type:
|
||||
return "uint64"
|
||||
case float32Type:
|
||||
return "float32"
|
||||
case float64Type:
|
||||
return "float64"
|
||||
case stringType:
|
||||
return "string"
|
||||
case bytesType:
|
||||
return "bytes"
|
||||
case enumType:
|
||||
return "enum"
|
||||
default:
|
||||
switch v := v.getIface().(type) {
|
||||
case Message:
|
||||
return "message"
|
||||
case List:
|
||||
return "list"
|
||||
case Map:
|
||||
return "map"
|
||||
default:
|
||||
return fmt.Sprintf("<unknown: %T>", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (v Value) panicMessage(what string) string {
|
||||
return fmt.Sprintf("type mismatch: cannot convert %v to %s", v.typeName(), what)
|
||||
}
|
||||
|
||||
// Bool returns v as a bool and panics if the type is not a bool.
|
||||
func (v Value) Bool() bool {
|
||||
switch v.typ {
|
||||
case boolType:
|
||||
return v.num > 0
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("bool"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,7 +256,7 @@ func (v Value) Int() int64 {
|
|||
case int32Type, int64Type:
|
||||
return int64(v.num)
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("int"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +266,7 @@ func (v Value) Uint() uint64 {
|
|||
case uint32Type, uint64Type:
|
||||
return uint64(v.num)
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("uint"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +276,7 @@ func (v Value) Float() float64 {
|
|||
case float32Type, float64Type:
|
||||
return math.Float64frombits(uint64(v.num))
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("float"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +297,7 @@ func (v Value) Bytes() []byte {
|
|||
case bytesType:
|
||||
return v.getBytes()
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("bytes"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,37 +307,37 @@ func (v Value) Enum() EnumNumber {
|
|||
case enumType:
|
||||
return EnumNumber(v.num)
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("enum"))
|
||||
}
|
||||
}
|
||||
|
||||
// Message returns v as a Message and panics if the type is not a Message.
|
||||
func (v Value) Message() Message {
|
||||
switch v := v.getIface().(type) {
|
||||
switch vi := v.getIface().(type) {
|
||||
case Message:
|
||||
return v
|
||||
return vi
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("message"))
|
||||
}
|
||||
}
|
||||
|
||||
// List returns v as a List and panics if the type is not a List.
|
||||
func (v Value) List() List {
|
||||
switch v := v.getIface().(type) {
|
||||
switch vi := v.getIface().(type) {
|
||||
case List:
|
||||
return v
|
||||
return vi
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("list"))
|
||||
}
|
||||
}
|
||||
|
||||
// Map returns v as a Map and panics if the type is not a Map.
|
||||
func (v Value) Map() Map {
|
||||
switch v := v.getIface().(type) {
|
||||
switch vi := v.getIface().(type) {
|
||||
case Map:
|
||||
return v
|
||||
return vi
|
||||
default:
|
||||
panic("proto: value type mismatch")
|
||||
panic(v.panicMessage("map"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,8 +346,9 @@ func (v Value) MapKey() MapKey {
|
|||
switch v.typ {
|
||||
case boolType, int32Type, int64Type, uint32Type, uint64Type, stringType:
|
||||
return MapKey(v)
|
||||
default:
|
||||
panic(v.panicMessage("map key"))
|
||||
}
|
||||
panic("proto: invalid map key type")
|
||||
}
|
||||
|
||||
// MapKey is used to index maps, where the Go type of the MapKey must match
|
||||
|
|
32
vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
generated
vendored
32
vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
generated
vendored
|
@ -96,6 +96,38 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
|
|||
}
|
||||
path := file.Path()
|
||||
if prev := r.filesByPath[path]; prev != nil {
|
||||
// TODO: Remove this after some soak-in period after moving these types.
|
||||
var prevPath string
|
||||
const prevModule = "google.golang.org/genproto"
|
||||
const prevVersion = "cb27e3aa (May 26th, 2020)"
|
||||
switch path {
|
||||
case "google/protobuf/field_mask.proto":
|
||||
prevPath = prevModule + "/protobuf/field_mask"
|
||||
case "google/protobuf/api.proto":
|
||||
prevPath = prevModule + "/protobuf/api"
|
||||
case "google/protobuf/type.proto":
|
||||
prevPath = prevModule + "/protobuf/ptype"
|
||||
case "google/protobuf/source_context.proto":
|
||||
prevPath = prevModule + "/protobuf/source_context"
|
||||
}
|
||||
if r == GlobalFiles && prevPath != "" {
|
||||
pkgName := strings.TrimSuffix(strings.TrimPrefix(path, "google/protobuf/"), ".proto")
|
||||
pkgName = strings.Replace(pkgName, "_", "", -1) + "pb"
|
||||
currPath := "google.golang.org/protobuf/types/known/" + pkgName
|
||||
panic(fmt.Sprintf(""+
|
||||
"duplicate registration of %q\n"+
|
||||
"\n"+
|
||||
"The generated definition for this file has moved:\n"+
|
||||
"\tfrom: %q\n"+
|
||||
"\tto: %q\n"+
|
||||
"A dependency on the %q module must\n"+
|
||||
"be at version %v or higher.\n"+
|
||||
"\n"+
|
||||
"Upgrade the dependency by running:\n"+
|
||||
"\tgo get -u %v\n",
|
||||
path, prevPath, currPath, prevModule, prevVersion, prevPath))
|
||||
}
|
||||
|
||||
err := errors.New("file %q is already registered", file.Path())
|
||||
err = amendErrorWithCaller(err, prev, file)
|
||||
if r == GlobalFiles && ignoreConflict(file, err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue