forked from forgejo/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
33
vendor/github.com/go-openapi/validate/schema_option.go
generated
vendored
33
vendor/github.com/go-openapi/validate/schema_option.go
generated
vendored
|
@ -14,20 +14,41 @@
|
|||
|
||||
package validate
|
||||
|
||||
// SchemaValidatorOptions defines optional rules for schema validation
|
||||
type SchemaValidatorOptions struct {
|
||||
DisableObjectArrayTypeCheck bool
|
||||
EnableObjectArrayTypeCheck bool
|
||||
EnableArrayMustHaveItemsCheck bool
|
||||
}
|
||||
|
||||
// Option sets optional rules for schema validation
|
||||
type Option func(*SchemaValidatorOptions)
|
||||
|
||||
func DisableObjectArrayTypeCheck(disable bool) Option {
|
||||
// EnableObjectArrayTypeCheck activates the swagger rule: an items must be in type: array
|
||||
func EnableObjectArrayTypeCheck(enable bool) Option {
|
||||
return func(svo *SchemaValidatorOptions) {
|
||||
svo.DisableObjectArrayTypeCheck = disable
|
||||
svo.EnableObjectArrayTypeCheck = enable
|
||||
}
|
||||
}
|
||||
|
||||
func (svo SchemaValidatorOptions) Options() []Option {
|
||||
return []Option{
|
||||
DisableObjectArrayTypeCheck(svo.DisableObjectArrayTypeCheck),
|
||||
// EnableArrayMustHaveItemsCheck activates the swagger rule: an array must have items defined
|
||||
func EnableArrayMustHaveItemsCheck(enable bool) Option {
|
||||
return func(svo *SchemaValidatorOptions) {
|
||||
svo.EnableArrayMustHaveItemsCheck = enable
|
||||
}
|
||||
}
|
||||
|
||||
// SwaggerSchema activates swagger schema validation rules
|
||||
func SwaggerSchema(enable bool) Option {
|
||||
return func(svo *SchemaValidatorOptions) {
|
||||
svo.EnableObjectArrayTypeCheck = enable
|
||||
svo.EnableArrayMustHaveItemsCheck = enable
|
||||
}
|
||||
}
|
||||
|
||||
// Options returns current options
|
||||
func (svo SchemaValidatorOptions) Options() []Option {
|
||||
return []Option{
|
||||
EnableObjectArrayTypeCheck(svo.EnableObjectArrayTypeCheck),
|
||||
EnableArrayMustHaveItemsCheck(svo.EnableArrayMustHaveItemsCheck),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue