Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use forked yaml modules without "replace" #1038

Merged
merged 3 commits into from
Dec 11, 2024
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
2 changes: 1 addition & 1 deletion cmd/validate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"strings"

"github.com/invopop/yaml"
"github.com/oasdiff/yaml"

"github.com/getkin/kin-openapi/openapi2"
"github.com/getkin/kin-openapi/openapi3"
Expand Down
9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ module github.com/getkin/kin-openapi

go 1.22.5

replace gopkg.in/yaml.v3 => github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6

replace github.com/invopop/yaml => github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3

require (
github.com/go-openapi/jsonpointer v0.21.0
github.com/gorilla/mux v1.8.0
github.com/invopop/yaml v0.3.1
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/oasdiff/yaml v0.0.0-20241210131133-6b86fb107d80
github.com/oasdiff/yaml3 v0.0.0-20241210130736-a94c01f36349
github.com/perimeterx/marshmallow v1.1.5
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand All @@ -23,4 +19,5 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
11 changes: 7 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3 h1:nqCxALSUgWobWkFGIrhLRzR/bpImQdGj+3JS4/scTJo=
github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3/go.mod h1:AOyUNV9ElKz7EEZeBm/48U54UtjtgCMT9fFbZEsClQc=
github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6 h1:+ZsuDTdapTJxfMQk7SOJiNMg0v36pui01L7FEO615r8=
github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6/go.mod h1:lqlOfJRrYpgeWHQj+ky2tf7UJ3PzgHTHRQEpc90nbp0=
github.com/oasdiff/yaml v0.0.0-20241210131133-6b86fb107d80 h1:nZspmSkneBbtxU9TopEAE0CY+SBJLxO8LPUlw2vG4pU=
github.com/oasdiff/yaml v0.0.0-20241210131133-6b86fb107d80/go.mod h1:7tFDb+Y51LcDpn26GccuUgQXUk6t0CXZsivKjyimYX8=
github.com/oasdiff/yaml3 v0.0.0-20241210130736-a94c01f36349 h1:t05Ww3DxZutOqbMN+7OIuqDwXbhl32HiZGpLy26BAPc=
github.com/oasdiff/yaml3 v0.0.0-20241210130736-a94c01f36349/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o=
github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s=
github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -32,5 +32,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion openapi2/marsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

"github.com/invopop/yaml"
"github.com/oasdiff/yaml"
)

func unmarshalError(jsonUnmarshalErr error) error {
Expand Down
2 changes: 1 addition & 1 deletion openapi2/openapi2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"reflect"

"github.com/invopop/yaml"
"github.com/oasdiff/yaml"

"github.com/getkin/kin-openapi/openapi2"
)
Expand Down
2 changes: 1 addition & 1 deletion openapi2conv/issue187_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"testing"

"github.com/invopop/yaml"
"github.com/oasdiff/yaml"
"github.com/stretchr/testify/require"

"github.com/getkin/kin-openapi/openapi2"
Expand Down
2 changes: 1 addition & 1 deletion openapi2conv/issue558_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package openapi2conv
import (
"testing"

"github.com/invopop/yaml"
"github.com/oasdiff/yaml"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion openapi3/additionalProperties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"testing"

"github.com/oasdiff/yaml3"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"

"github.com/getkin/kin-openapi/openapi3"
)
Expand Down
2 changes: 1 addition & 1 deletion openapi3/issue241_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"testing"

"github.com/oasdiff/yaml3"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"

"github.com/getkin/kin-openapi/openapi3"
)
Expand Down
20 changes: 10 additions & 10 deletions openapi3/issue883_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package openapi3_test
import (
"testing"

invopopYaml "github.com/invopop/yaml"
yaml "github.com/oasdiff/yaml"
yamlv3 "github.com/oasdiff/yaml3"
"github.com/stretchr/testify/require"
v3 "gopkg.in/yaml.v3"

"github.com/getkin/kin-openapi/openapi3"
)
Expand Down Expand Up @@ -38,8 +38,8 @@ paths:
require.NoError(t, err)
require.NotNil(t, doc.Paths)

t.Run("Roundtrip invopop/yaml", func(t *testing.T) {
justPaths, err := invopopYaml.Marshal(doc.Paths)
t.Run("Roundtrip using yaml pkg", func(t *testing.T) {
justPaths, err := yaml.Marshal(doc.Paths)
require.NoError(t, err)
require.NotNil(t, doc.Paths)
require.YAMLEq(t, `
Expand All @@ -51,13 +51,13 @@ paths:
description: OK
`[1:], string(justPaths))

marshalledYaml, err := invopopYaml.Marshal(doc)
marshalledYaml, err := yaml.Marshal(doc)
require.NoError(t, err)
require.NotNil(t, doc.Paths)
require.YAMLEq(t, spec, string(marshalledYaml))

var newDoc openapi3.T
err = invopopYaml.Unmarshal(marshalledYaml, &newDoc)
err = yaml.Unmarshal(marshalledYaml, &newDoc)
require.NoError(t, err)
require.NotNil(t, newDoc.Paths)
require.Equal(t, doc, &newDoc)
Expand All @@ -76,7 +76,7 @@ paths:
description: OK
`[1:], string(justPaths))

justPaths, err = v3.Marshal(doc.Paths)
justPaths, err = yamlv3.Marshal(doc.Paths)
require.NoError(t, err)
require.NotNil(t, doc.Paths)
require.YAMLEq(t, `
Expand All @@ -88,14 +88,14 @@ paths:
description: OK
`[1:], string(justPaths))

marshalledYaml, err := v3.Marshal(doc)
marshalledYaml, err := yamlv3.Marshal(doc)
require.NoError(t, err)
require.NotNil(t, doc.Paths)
require.YAMLEq(t, spec, string(marshalledYaml))

t.Skip("TODO: impl https://pkg.go.dev/gopkg.in/yaml.v3#Unmarshaler on maplike types")
t.Skip("TODO: impl https://pkg.go.dev/github.com/oasdiff/yaml3#Unmarshaler on maplike types")
var newDoc openapi3.T
err = v3.Unmarshal(marshalledYaml, &newDoc)
err = yamlv3.Unmarshal(marshalledYaml, &newDoc)
require.NoError(t, err)
require.NotNil(t, newDoc.Paths)
require.Equal(t, doc, &newDoc)
Expand Down
2 changes: 1 addition & 1 deletion openapi3/issue972_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package openapi3
import (
"testing"

"github.com/oasdiff/yaml3"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
)

func TestIssue972(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion openapi3/marsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

"github.com/invopop/yaml"
"github.com/oasdiff/yaml"
)

func unmarshalError(jsonUnmarshalErr error) error {
Expand Down
2 changes: 1 addition & 1 deletion openapi3/openapi3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"testing"

"github.com/invopop/yaml"
"github.com/oasdiff/yaml"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion openapi3/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"strings"
"testing"

"github.com/oasdiff/yaml3"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
)

type schemaExample struct {
Expand Down
2 changes: 1 addition & 1 deletion openapi3filter/req_resp_decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"strconv"
"strings"

"gopkg.in/yaml.v3"
"github.com/oasdiff/yaml3"

"github.com/getkin/kin-openapi/openapi3"
)
Expand Down
Loading