go.mod: bump github.com/getkin/kin-openapi to v0.131.0
As deepmap/oapi-codegen didn't work with this newer version, upgrade to oapi-codegen/oapi-codegen v2. Mitigating CVE-2025-30153
This commit is contained in:
parent
c5cb0d0618
commit
b2700903ae
403 changed files with 44758 additions and 16347 deletions
15
vendor/github.com/dprotaso/go-yit/.gitignore
generated
vendored
Normal file
15
vendor/github.com/dprotaso/go-yit/.gitignore
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories
|
||||
vendor/
|
||||
19
vendor/github.com/dprotaso/go-yit/LICENSE
generated
vendored
Normal file
19
vendor/github.com/dprotaso/go-yit/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright 2019 David Protasowski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
54
vendor/github.com/dprotaso/go-yit/README.md
generated
vendored
Normal file
54
vendor/github.com/dprotaso/go-yit/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# go-yit - YAML Iterator
|
||||
|
||||
[](https://godoc.org/github.com/dprotaso/go-yit)
|
||||
|
||||
## Introduction
|
||||
|
||||
This library compliments [go-yaml v3](https://github.com/go-yaml/yaml/tree/v3) by adding
|
||||
functional style methods for iterating over YAML documents.
|
||||
|
||||
## Usage
|
||||
|
||||
Import the package
|
||||
```go
|
||||
import "github.com/dprotaso/go-yit"
|
||||
```
|
||||
|
||||
|
||||
Query your YAML document
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/dprotaso/go-yit"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
var data = `
|
||||
a: b
|
||||
c: d
|
||||
e: f
|
||||
`
|
||||
|
||||
func main() {
|
||||
var doc yaml.Node
|
||||
err := yaml.Unmarshal([]byte(data), &doc)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("error: %v", err)
|
||||
}
|
||||
|
||||
it := yit.FromNode(&doc).
|
||||
RecurseNodes().
|
||||
Filter(yit.WithKind(yaml.MappingNode)).
|
||||
MapKeys()
|
||||
|
||||
for node, ok := it(); ok; node, ok = it() {
|
||||
fmt.Println(node.Value)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
25
vendor/github.com/dprotaso/go-yit/aggregates.go
generated
vendored
Normal file
25
vendor/github.com/dprotaso/go-yit/aggregates.go
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package yit
|
||||
|
||||
import "gopkg.in/yaml.v3"
|
||||
|
||||
func (next Iterator) AnyMatch(p Predicate) bool {
|
||||
iterator := next.Filter(p)
|
||||
_, ok := iterator()
|
||||
return ok
|
||||
}
|
||||
|
||||
func (next Iterator) AllMatch(p Predicate) bool {
|
||||
result := true
|
||||
for node, ok := next(); ok && result; node, ok = next() {
|
||||
result = result && p(node)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (next Iterator) ToArray() (result []*yaml.Node) {
|
||||
for node, ok := next(); ok; node, ok = next() {
|
||||
result = append(result, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
204
vendor/github.com/dprotaso/go-yit/iterator.go
generated
vendored
Normal file
204
vendor/github.com/dprotaso/go-yit/iterator.go
generated
vendored
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
package yit
|
||||
|
||||
import "gopkg.in/yaml.v3"
|
||||
|
||||
type (
|
||||
Iterator func() (*yaml.Node, bool)
|
||||
Predicate func(*yaml.Node) bool
|
||||
)
|
||||
|
||||
func FromNode(node *yaml.Node) Iterator {
|
||||
return FromNodes(node)
|
||||
}
|
||||
|
||||
func FromNodes(nodes ...*yaml.Node) Iterator {
|
||||
i := 0
|
||||
|
||||
return func() (node *yaml.Node, ok bool) {
|
||||
ok = i < len(nodes)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
node = nodes[i]
|
||||
i++
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func FromIterators(its ...Iterator) Iterator {
|
||||
return func() (node *yaml.Node, ok bool) {
|
||||
for {
|
||||
if len(its) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
next := its[0]
|
||||
node, ok = next()
|
||||
|
||||
if ok {
|
||||
return
|
||||
}
|
||||
|
||||
its = its[1:]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (next Iterator) MapKeys() Iterator {
|
||||
var content []*yaml.Node
|
||||
|
||||
return func() (node *yaml.Node, ok bool) {
|
||||
for {
|
||||
if len(content) > 0 {
|
||||
node = content[0]
|
||||
content = content[2:]
|
||||
ok = true
|
||||
return
|
||||
}
|
||||
|
||||
var parent *yaml.Node
|
||||
for parent, ok = next(); ok; parent, ok = next() {
|
||||
if parent.Kind == yaml.MappingNode && len(parent.Content) > 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
content = parent.Content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (next Iterator) MapValues() Iterator {
|
||||
var content []*yaml.Node
|
||||
|
||||
return func() (node *yaml.Node, ok bool) {
|
||||
for {
|
||||
if len(content) > 0 {
|
||||
node = content[1]
|
||||
content = content[2:]
|
||||
ok = true
|
||||
return
|
||||
}
|
||||
|
||||
var parent *yaml.Node
|
||||
for parent, ok = next(); ok; parent, ok = next() {
|
||||
if parent.Kind == yaml.MappingNode && len(parent.Content) > 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
content = parent.Content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (next Iterator) ValuesForMap(keyPredicate, valuePredicate Predicate) Iterator {
|
||||
var content []*yaml.Node
|
||||
|
||||
return func() (node *yaml.Node, ok bool) {
|
||||
for {
|
||||
for len(content) > 0 {
|
||||
key := content[0]
|
||||
node = content[1]
|
||||
content = content[2:]
|
||||
|
||||
if ok = keyPredicate(key) && valuePredicate(node); ok {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var parent *yaml.Node
|
||||
for parent, ok = next(); ok; parent, ok = next() {
|
||||
if parent.Kind == yaml.MappingNode && len(parent.Content) > 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
content = parent.Content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (next Iterator) RecurseNodes() Iterator {
|
||||
var stack []*yaml.Node
|
||||
|
||||
return func() (node *yaml.Node, ok bool) {
|
||||
if len(stack) > 0 {
|
||||
node = stack[len(stack)-1]
|
||||
stack = stack[:len(stack)-1]
|
||||
ok = true
|
||||
} else {
|
||||
node, ok = next()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// iterate backwards so the iteration
|
||||
// is predictable (for testing)
|
||||
for i := len(node.Content) - 1; i >= 0; i-- {
|
||||
stack = append(stack, node.Content[i])
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (next Iterator) Filter(p Predicate) Iterator {
|
||||
return func() (node *yaml.Node, ok bool) {
|
||||
for node, ok = next(); ok; node, ok = next() {
|
||||
if p(node) {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (next Iterator) Values() Iterator {
|
||||
var content []*yaml.Node
|
||||
|
||||
return func() (node *yaml.Node, ok bool) {
|
||||
if len(content) > 0 {
|
||||
node = content[0]
|
||||
content = content[1:]
|
||||
ok = true
|
||||
return
|
||||
}
|
||||
|
||||
var parent *yaml.Node
|
||||
for parent, ok = next(); ok; parent, ok = next() {
|
||||
if len(parent.Content) > 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
content = parent.Content
|
||||
node = content[0]
|
||||
content = content[1:]
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (next Iterator) Iterate(op func(Iterator) Iterator) Iterator {
|
||||
return op(next)
|
||||
}
|
||||
117
vendor/github.com/dprotaso/go-yit/predicates.go
generated
vendored
Normal file
117
vendor/github.com/dprotaso/go-yit/predicates.go
generated
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
package yit
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
var (
|
||||
All = func(node *yaml.Node) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
None = func(node *yaml.Node) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
StringValue = Intersect(
|
||||
WithKind(yaml.ScalarNode),
|
||||
WithShortTag("!!str"),
|
||||
)
|
||||
)
|
||||
|
||||
func Intersect(ps ...Predicate) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
for _, p := range ps {
|
||||
if !p(node) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
func Union(ps ...Predicate) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
for _, p := range ps {
|
||||
if p(node) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func Negate(p Predicate) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
return !p(node)
|
||||
}
|
||||
}
|
||||
|
||||
func WithStringValue(value string) Predicate {
|
||||
return Intersect(
|
||||
StringValue,
|
||||
func(node *yaml.Node) bool {
|
||||
return node.Value == value
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func WithShortTag(tag string) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
return node.ShortTag() == tag
|
||||
}
|
||||
}
|
||||
|
||||
func WithValue(value string) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
return node.Value == value
|
||||
}
|
||||
}
|
||||
|
||||
func WithKind(kind yaml.Kind) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
return node.Kind == kind
|
||||
}
|
||||
}
|
||||
|
||||
func WithMapKey(key string) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
return FromNode(node).MapKeys().AnyMatch(WithValue(key))
|
||||
}
|
||||
}
|
||||
|
||||
func WithMapValue(value string) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
return FromNode(node).MapValues().AnyMatch(WithValue(value))
|
||||
}
|
||||
}
|
||||
|
||||
func WithMapKeyValue(keyPredicate, valuePredicate Predicate) Predicate {
|
||||
return Intersect(
|
||||
WithKind(yaml.MappingNode),
|
||||
func(node *yaml.Node) bool {
|
||||
for i := 0; i < len(node.Content); i += 2 {
|
||||
key := node.Content[i]
|
||||
value := node.Content[i+1]
|
||||
if keyPredicate(key) && valuePredicate(value) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func WithPrefix(prefix string) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
return strings.HasPrefix(node.Value, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
func WithSuffix(suffix string) Predicate {
|
||||
return func(node *yaml.Node) bool {
|
||||
return strings.HasSuffix(node.Value, suffix)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue