forked from forgejo/forgejo
go1.16 (#14783)
This commit is contained in:
parent
030646eea4
commit
47f6a4ec3f
947 changed files with 26119 additions and 7062 deletions
2
vendor/github.com/go-openapi/errors/.golangci.yml
generated
vendored
2
vendor/github.com/go-openapi/errors/.golangci.yml
generated
vendored
|
@ -39,3 +39,5 @@ linters:
|
|||
- nestif
|
||||
- godot
|
||||
- errorlint
|
||||
- paralleltest
|
||||
- tparallel
|
||||
|
|
7
vendor/github.com/go-openapi/errors/README.md
generated
vendored
7
vendor/github.com/go-openapi/errors/README.md
generated
vendored
|
@ -1,7 +1,10 @@
|
|||
# OpenAPI errors [](https://travis-ci.org/go-openapi/errors) [](https://codecov.io/gh/go-openapi/errors) [](https://slackin.goswagger.io)
|
||||
# OpenAPI errors
|
||||
|
||||
[](https://travis-ci.org/go-openapi/errors)
|
||||
[](https://codecov.io/gh/go-openapi/errors)
|
||||
[](https://slackin.goswagger.io)
|
||||
[](https://raw.githubusercontent.com/go-openapi/errors/master/LICENSE)
|
||||
[](http://godoc.org/github.com/go-openapi/errors)
|
||||
[](https://pkg.go.dev/github.com/go-openapi/errors)
|
||||
[](https://golangci.com)
|
||||
[](https://goreportcard.com/report/github.com/go-openapi/errors)
|
||||
|
||||
|
|
17
vendor/github.com/go-openapi/errors/api.go
generated
vendored
17
vendor/github.com/go-openapi/errors/api.go
generated
vendored
|
@ -44,6 +44,14 @@ func (a *apiError) Code() int32 {
|
|||
return a.code
|
||||
}
|
||||
|
||||
// MarshalJSON implements the JSON encoding interface
|
||||
func (a apiError) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(map[string]interface{}{
|
||||
"code": a.code,
|
||||
"message": a.message,
|
||||
})
|
||||
}
|
||||
|
||||
// New creates a new API error with a code and a message
|
||||
func New(code int32, message string, args ...interface{}) Error {
|
||||
if len(args) > 0 {
|
||||
|
@ -81,6 +89,15 @@ func (m *MethodNotAllowedError) Code() int32 {
|
|||
return m.code
|
||||
}
|
||||
|
||||
// MarshalJSON implements the JSON encoding interface
|
||||
func (m MethodNotAllowedError) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(map[string]interface{}{
|
||||
"code": m.code,
|
||||
"message": m.message,
|
||||
"allowed": m.Allowed,
|
||||
})
|
||||
}
|
||||
|
||||
func errorAsJSON(err Error) []byte {
|
||||
b, _ := json.Marshal(struct {
|
||||
Code int32 `json:"code"`
|
||||
|
|
13
vendor/github.com/go-openapi/errors/headers.go
generated
vendored
13
vendor/github.com/go-openapi/errors/headers.go
generated
vendored
|
@ -15,6 +15,7 @@
|
|||
package errors
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
@ -38,6 +39,18 @@ func (e *Validation) Code() int32 {
|
|||
return e.code
|
||||
}
|
||||
|
||||
// MarshalJSON implements the JSON encoding interface
|
||||
func (e Validation) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(map[string]interface{}{
|
||||
"code": e.code,
|
||||
"message": e.message,
|
||||
"in": e.In,
|
||||
"name": e.Name,
|
||||
"value": e.Value,
|
||||
"values": e.Values,
|
||||
})
|
||||
}
|
||||
|
||||
// ValidateName produces an error message name for an aliased property
|
||||
func (e *Validation) ValidateName(name string) *Validation {
|
||||
if e.Name == "" && name != "" {
|
||||
|
|
6
vendor/github.com/go-openapi/errors/middleware.go
generated
vendored
6
vendor/github.com/go-openapi/errors/middleware.go
generated
vendored
|
@ -23,9 +23,9 @@ import (
|
|||
// APIVerificationFailed is an error that contains all the missing info for a mismatched section
|
||||
// between the api registrations and the api spec
|
||||
type APIVerificationFailed struct {
|
||||
Section string
|
||||
MissingSpecification []string
|
||||
MissingRegistration []string
|
||||
Section string `json:"section,omitempty"`
|
||||
MissingSpecification []string `json:"missingSpecification,omitempty"`
|
||||
MissingRegistration []string `json:"missingRegistration,omitempty"`
|
||||
}
|
||||
|
||||
//
|
||||
|
|
21
vendor/github.com/go-openapi/errors/parsing.go
generated
vendored
21
vendor/github.com/go-openapi/errors/parsing.go
generated
vendored
|
@ -14,7 +14,10 @@
|
|||
|
||||
package errors
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ParseError represents a parsing error
|
||||
type ParseError struct {
|
||||
|
@ -35,6 +38,22 @@ func (e *ParseError) Code() int32 {
|
|||
return e.code
|
||||
}
|
||||
|
||||
// MarshalJSON implements the JSON encoding interface
|
||||
func (e ParseError) MarshalJSON() ([]byte, error) {
|
||||
var reason string
|
||||
if e.Reason != nil {
|
||||
reason = e.Reason.Error()
|
||||
}
|
||||
return json.Marshal(map[string]interface{}{
|
||||
"code": e.code,
|
||||
"message": e.message,
|
||||
"in": e.In,
|
||||
"name": e.Name,
|
||||
"value": e.Value,
|
||||
"reason": reason,
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
parseErrorTemplContent = `parsing %s %s from %q failed, because %s`
|
||||
parseErrorTemplContentNoIn = `parsing %s from %q failed, because %s`
|
||||
|
|
10
vendor/github.com/go-openapi/errors/schema.go
generated
vendored
10
vendor/github.com/go-openapi/errors/schema.go
generated
vendored
|
@ -15,6 +15,7 @@
|
|||
package errors
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
@ -119,6 +120,15 @@ func (c *CompositeError) Error() string {
|
|||
return c.message
|
||||
}
|
||||
|
||||
// MarshalJSON implements the JSON encoding interface
|
||||
func (c CompositeError) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(map[string]interface{}{
|
||||
"code": c.code,
|
||||
"message": c.message,
|
||||
"errors": c.Errors,
|
||||
})
|
||||
}
|
||||
|
||||
// CompositeValidationError an error to wrap a bunch of other errors
|
||||
func CompositeValidationError(errors ...error) *CompositeError {
|
||||
return &CompositeError{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue