forked from NYANDEV/forgejo
[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
1
vendor/github.com/mailru/easyjson/.gitignore
generated
vendored
1
vendor/github.com/mailru/easyjson/.gitignore
generated
vendored
|
@ -3,3 +3,4 @@
|
|||
*.iml
|
||||
.idea
|
||||
*.swp
|
||||
bin/*
|
||||
|
|
4
vendor/github.com/mailru/easyjson/Makefile
generated
vendored
4
vendor/github.com/mailru/easyjson/Makefile
generated
vendored
|
@ -18,10 +18,13 @@ generate: build
|
|||
./tests/custom_map_key_type.go \
|
||||
./tests/embedded_type.go \
|
||||
./tests/reference_to_pointer.go \
|
||||
./tests/html.go \
|
||||
./tests/unknown_fields.go \
|
||||
|
||||
bin/easyjson -all ./tests/data.go
|
||||
bin/easyjson -all ./tests/nothing.go
|
||||
bin/easyjson -all ./tests/errors.go
|
||||
bin/easyjson -all ./tests/html.go
|
||||
bin/easyjson -snake_case ./tests/snake.go
|
||||
bin/easyjson -omit_empty ./tests/omitempty.go
|
||||
bin/easyjson -build_tags=use_easyjson ./benchmark/data.go
|
||||
|
@ -32,6 +35,7 @@ generate: build
|
|||
bin/easyjson ./tests/reference_to_pointer.go
|
||||
bin/easyjson ./tests/key_marshaler_map.go
|
||||
bin/easyjson -disallow_unknown_fields ./tests/disallow_unknown.go
|
||||
bin/easyjson ./tests/unknown_fields.go
|
||||
|
||||
test: generate
|
||||
go test \
|
||||
|
|
10
vendor/github.com/mailru/easyjson/helpers.go
generated
vendored
10
vendor/github.com/mailru/easyjson/helpers.go
generated
vendored
|
@ -26,6 +26,16 @@ type Optional interface {
|
|||
IsDefined() bool
|
||||
}
|
||||
|
||||
// UnknownsUnmarshaler provides a method to unmarshal unknown struct fileds and save them as you want
|
||||
type UnknownsUnmarshaler interface {
|
||||
UnmarshalUnknown(in *jlexer.Lexer, key string)
|
||||
}
|
||||
|
||||
// UnknownsMarshaler provides a method to write additional struct fields
|
||||
type UnknownsMarshaler interface {
|
||||
MarshalUnknowns(w *jwriter.Writer, first bool)
|
||||
}
|
||||
|
||||
// Marshal returns data as a single byte slice. Method is suboptimal as the data is likely to be copied
|
||||
// from a chain of smaller chunks.
|
||||
func Marshal(v Marshaler) ([]byte, error) {
|
||||
|
|
43
vendor/github.com/mailru/easyjson/jwriter/writer.go
generated
vendored
43
vendor/github.com/mailru/easyjson/jwriter/writer.go
generated
vendored
|
@ -270,16 +270,25 @@ func (w *Writer) Bool(v bool) {
|
|||
|
||||
const chars = "0123456789abcdef"
|
||||
|
||||
func isNotEscapedSingleChar(c byte, escapeHTML bool) bool {
|
||||
// Note: might make sense to use a table if there are more chars to escape. With 4 chars
|
||||
// it benchmarks the same.
|
||||
if escapeHTML {
|
||||
return c != '<' && c != '>' && c != '&' && c != '\\' && c != '"' && c >= 0x20 && c < utf8.RuneSelf
|
||||
} else {
|
||||
return c != '\\' && c != '"' && c >= 0x20 && c < utf8.RuneSelf
|
||||
func getTable(falseValues ...int) [128]bool {
|
||||
table := [128]bool{}
|
||||
|
||||
for i := 0; i < 128; i++ {
|
||||
table[i] = true
|
||||
}
|
||||
|
||||
for _, v := range falseValues {
|
||||
table[v] = false
|
||||
}
|
||||
|
||||
return table
|
||||
}
|
||||
|
||||
var (
|
||||
htmlEscapeTable = getTable(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, '"', '&', '<', '>', '\\')
|
||||
htmlNoEscapeTable = getTable(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, '"', '\\')
|
||||
)
|
||||
|
||||
func (w *Writer) String(s string) {
|
||||
w.Buffer.AppendByte('"')
|
||||
|
||||
|
@ -288,15 +297,23 @@ func (w *Writer) String(s string) {
|
|||
|
||||
p := 0 // last non-escape symbol
|
||||
|
||||
var escapeTable [128]bool
|
||||
if w.NoEscapeHTML {
|
||||
escapeTable = htmlNoEscapeTable
|
||||
} else {
|
||||
escapeTable = htmlEscapeTable
|
||||
}
|
||||
|
||||
for i := 0; i < len(s); {
|
||||
c := s[i]
|
||||
|
||||
if isNotEscapedSingleChar(c, !w.NoEscapeHTML) {
|
||||
// single-width character, no escaping is required
|
||||
i++
|
||||
continue
|
||||
} else if c < utf8.RuneSelf {
|
||||
// single-with character, need to escape
|
||||
if c < utf8.RuneSelf {
|
||||
if escapeTable[c] {
|
||||
// single-width character, no escaping is required
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
w.Buffer.AppendString(s[p:i])
|
||||
switch c {
|
||||
case '\t':
|
||||
|
|
34
vendor/github.com/mailru/easyjson/unknown_fields.go
generated
vendored
Normal file
34
vendor/github.com/mailru/easyjson/unknown_fields.go
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
package easyjson
|
||||
|
||||
import (
|
||||
json "encoding/json"
|
||||
|
||||
jlexer "github.com/mailru/easyjson/jlexer"
|
||||
"github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
// UnknownFieldsProxy implemets UnknownsUnmarshaler and UnknownsMarshaler
|
||||
// use it as embedded field in your structure to parse and then serialize unknown struct fields
|
||||
type UnknownFieldsProxy struct {
|
||||
unknownFields map[string]interface{}
|
||||
}
|
||||
|
||||
func (s *UnknownFieldsProxy) UnmarshalUnknown(in *jlexer.Lexer, key string) {
|
||||
if s.unknownFields == nil {
|
||||
s.unknownFields = make(map[string]interface{}, 1)
|
||||
}
|
||||
s.unknownFields[key] = in.Interface()
|
||||
}
|
||||
|
||||
func (s UnknownFieldsProxy) MarshalUnknowns(out *jwriter.Writer, first bool) {
|
||||
for key, val := range s.unknownFields {
|
||||
if first {
|
||||
first = false
|
||||
} else {
|
||||
out.RawByte(',')
|
||||
}
|
||||
out.String(string(key))
|
||||
out.RawByte(':')
|
||||
out.Raw(json.Marshal(val))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue