Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.24.10
4 changes: 2 additions & 2 deletions deckformat/entitypointers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strings"

"github.com/speakeasy-api/jsonpath/pkg/jsonpath"
"gopkg.in/yaml.v3"
"github.com/pb33f/jsonpath/pkg/jsonpath"
"go.yaml.in/yaml/v4"
)

// EntityPointers is a map of entity names to an array of JSONpointers that can be used to find
Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/kong/go-apiops

go 1.23.0
go 1.24.0

replace gopkg.in/yaml.v3 v3.0.1 => github.com/Kong/yaml v1.0.0
toolchain go1.24.10

require (
github.com/go-logr/logr v1.4.2
Expand All @@ -12,32 +12,31 @@ require (
github.com/kong/go-slugify v1.0.0
github.com/onsi/ginkgo/v2 v2.22.2
github.com/onsi/gomega v1.36.2
github.com/pb33f/libopenapi v0.16.13
github.com/speakeasy-api/jsonpath v0.6.2
github.com/pb33f/jsonpath v0.7.1
github.com/pb33f/libopenapi v0.33.0
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.10.0
github.com/stretchr/testify v1.11.1
github.com/yuin/gopher-lua v1.1.1
go.yaml.in/yaml/v4 v4.0.0-rc.4
golang.org/x/term v0.29.0
gopkg.in/yaml.v3 v3.0.1
sigs.k8s.io/yaml v1.4.0
)

require (
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mozillazg/go-unidecode v0.2.0 // indirect
github.com/pb33f/ordered-map/v2 v2.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.9-0.20240815153524-6ea36470d1bd // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.28.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
146 changes: 20 additions & 126 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jsonbasics/jsonbasics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

// ToObject returns the object, if it was one, or nil+err.
Expand Down
2 changes: 1 addition & 1 deletion namespace/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/kong/go-apiops/deckformat"
"github.com/kong/go-apiops/logbasics"
"github.com/kong/go-apiops/yamlbasics"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

// CheckNamespace validates the prefix namespace. Returns updated namespace. Must start with "/",
Expand Down
2 changes: 1 addition & 1 deletion namespace/namespace_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/kong/go-apiops/logbasics"
"github.com/kong/go-apiops/yamlbasics"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

// ApplyNamespaceHost applies the namespace to the hosts field of the selected routes
Expand Down
2 changes: 1 addition & 1 deletion namespace/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
lua "github.com/yuin/gopher-lua"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

func toYaml(data string) *yaml.Node {
Expand Down
12 changes: 5 additions & 7 deletions openapi2kong/openapi2kong.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
openapibase "github.com/pb33f/libopenapi/datamodel/high/base"
v3 "github.com/pb33f/libopenapi/datamodel/high/v3"
"github.com/pb33f/libopenapi/orderedmap"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

const (
Expand Down Expand Up @@ -694,12 +694,10 @@ func Convert(content []byte, opts O2kOptions) (map[string]interface{}, error) {
v3Model, errs := openapiDoc.BuildV3Model()

// if anything went wrong when building the v3 model,
// a slice of errors will be returned
if len(errs) > 0 {
for i := range errs {
logbasics.Error(errs[i], "error while building v3 document model \n")
}
return nil, fmt.Errorf("cannot create v3 model from document: %d errors reported", len(errs))
// an error will be returned
if errs != nil {
logbasics.Error(errs, "error while building v3 document model \n")
return nil, fmt.Errorf("cannot create v3 model from document: %w", errs)
}

if v3Model != nil {
Expand Down
8 changes: 4 additions & 4 deletions openapi2kong/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Test_parseServerUris(t *testing.T) {
t.Errorf("did not expect error: %v", err)
}
if diff := cmp.Diff(targets, expected); diff != "" {
t.Errorf(diff) //nolint:staticcheck
t.Errorf("diff: %s", diff)
}

variables := orderedmap.New[string, *v3.ServerVariable]()
Expand Down Expand Up @@ -69,7 +69,7 @@ func Test_parseServerUris(t *testing.T) {
t.Errorf("did not expect error: %v", err)
}
if diff := cmp.Diff(targets, expected); diff != "" {
t.Errorf(diff) //nolint:staticcheck
t.Errorf("diff: %s", diff)
}

// returns error on a bad URL
Expand Down Expand Up @@ -98,7 +98,7 @@ func Test_parseServerUris(t *testing.T) {
t.Errorf("did not expect error: %v", err)
}
if diff := cmp.Diff(targets, expected); diff != "" {
t.Errorf(diff) //nolint:staticcheck
t.Errorf("diff: %s", diff)
}

// returns no error if servers is nil
Expand All @@ -113,7 +113,7 @@ func Test_parseServerUris(t *testing.T) {
t.Errorf("did not expect error: %v", err)
}
if diff := cmp.Diff(targets, expected); diff != "" {
t.Errorf(diff) //nolint:staticcheck
t.Errorf("diff: %s", diff)
}
}

Expand Down
2 changes: 1 addition & 1 deletion openapi2kong/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"

"github.com/kong/go-slugify"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

// Slugify converts a name to a valid Kong name by removing and replacing unallowed characters
Expand Down
4 changes: 2 additions & 2 deletions patch/deckpatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/kong/go-apiops/jsonbasics"
"github.com/kong/go-apiops/logbasics"
"github.com/kong/go-apiops/yamlbasics"
"github.com/speakeasy-api/jsonpath/pkg/jsonpath"
"gopkg.in/yaml.v3"
"github.com/pb33f/jsonpath/pkg/jsonpath"
"go.yaml.in/yaml/v4"
)

var DefaultSelector = []string{"$"}
Expand Down
2 changes: 1 addition & 1 deletion patch/deckpatchfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kong/go-apiops/filebasics"
"github.com/kong/go-apiops/jsonbasics"
"github.com/kong/go-apiops/logbasics"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

// DeckPatchFile represents a list of patches.
Expand Down
2 changes: 1 addition & 1 deletion plugins/pluginfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kong/go-apiops/filebasics"
"github.com/kong/go-apiops/jsonbasics"
"github.com/kong/go-apiops/logbasics"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

//
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/kong/go-apiops/jsonbasics"
"github.com/kong/go-apiops/logbasics"
"github.com/kong/go-apiops/yamlbasics"
"github.com/speakeasy-api/jsonpath/pkg/jsonpath"
"gopkg.in/yaml.v3"
"github.com/pb33f/jsonpath/pkg/jsonpath"
"go.yaml.in/yaml/v4"
)

// defaultSelectors is the main `plugins` array.
Expand Down
4 changes: 2 additions & 2 deletions tags/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/kong/go-apiops/jsonbasics"
"github.com/kong/go-apiops/logbasics"
"github.com/kong/go-apiops/yamlbasics"
"github.com/speakeasy-api/jsonpath/pkg/jsonpath"
"gopkg.in/yaml.v3"
"github.com/pb33f/jsonpath/pkg/jsonpath"
"go.yaml.in/yaml/v4"
)

const tagArrayName = "tags"
Expand Down
2 changes: 1 addition & 1 deletion yamlbasics/nodeset.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package yamlbasics

import (
"github.com/kong/go-apiops/logbasics"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

//
Expand Down
2 changes: 1 addition & 1 deletion yamlbasics/nodeset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
. "github.com/kong/go-apiops/yamlbasics"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

var _ = Describe("NodeSet", func() {
Expand Down
4 changes: 2 additions & 2 deletions yamlbasics/selectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"

"github.com/kong/go-apiops/logbasics"
"github.com/speakeasy-api/jsonpath/pkg/jsonpath"
"gopkg.in/yaml.v3"
"github.com/pb33f/jsonpath/pkg/jsonpath"
"go.yaml.in/yaml/v4"
)

//
Expand Down
2 changes: 1 addition & 1 deletion yamlbasics/selectors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
. "github.com/kong/go-apiops/yamlbasics"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

var _ = Describe("selectors", func() {
Expand Down
2 changes: 1 addition & 1 deletion yamlbasics/yamlbasics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"errors"
"fmt"

"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

//
Expand Down
2 changes: 1 addition & 1 deletion yamlbasics/yamlbasics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
. "github.com/kong/go-apiops/yamlbasics"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)

var _ = Describe("yamlbasics", func() {
Expand Down
Loading