Skip to content

Commit e327369

Browse files
committed
replaced stdlib encoding/json by ccy/go-json
Signed-off-by: Frederic BIDON <[email protected]>
1 parent ed00e71 commit e327369

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+65
-61
lines changed

circular_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package spec
22

33
import (
4-
"encoding/json"
54
"net/http"
65
"net/http/httptest"
76
"os"
87
"path/filepath"
98
"testing"
109
"time"
1110

11+
json "github.com/goccy/go-json"
1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
1414
)

contact_info.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
package spec
1616

1717
import (
18-
"encoding/json"
19-
2018
"github.com/go-openapi/swag"
19+
json "github.com/goccy/go-json"
2120
)
2221

2322
// ContactInfo contact information for the exposed API.

contact_info_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
package spec
1616

1717
import (
18-
"encoding/json"
1918
"testing"
2019

20+
json "github.com/goccy/go-json"
2121
"github.com/stretchr/testify/assert"
2222
"github.com/stretchr/testify/require"
2323
)
2424

2525
const contactInfoJSON = `{
26-
"name": "wordnik api team",
27-
"url": "http://developer.wordnik.com",
28-
"email": "[email protected]",
29-
"x-teams": "test team"
26+
"name": "wordnik api team",
27+
"url": "http://developer.wordnik.com",
28+
"email": "[email protected]",
29+
"x-teams": "test team"
3030
}`
3131

3232
var contactInfo = ContactInfo{ContactInfoProps: ContactInfoProps{
@@ -36,9 +36,9 @@ var contactInfo = ContactInfo{ContactInfoProps: ContactInfoProps{
3636
}, VendorExtensible: VendorExtensible{Extensions: map[string]interface{}{"x-teams": "test team"}}}
3737

3838
func TestIntegrationContactInfo(t *testing.T) {
39-
b, err := json.MarshalIndent(contactInfo, "", "\t")
39+
b, err := json.MarshalIndent(contactInfo, "", " ")
4040
require.NoError(t, err)
41-
assert.Equal(t, contactInfoJSON, string(b))
41+
assert.JSONEq(t, contactInfoJSON, string(b))
4242

4343
actual := ContactInfo{}
4444
err = json.Unmarshal([]byte(contactInfoJSON), &actual)

expander.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
package spec
1616

1717
import (
18-
"encoding/json"
1918
"fmt"
19+
20+
json "github.com/goccy/go-json"
2021
)
2122

2223
// ExpandOptions provides options for the spec expander.

expander_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package spec
1616

1717
import (
18-
"encoding/json"
1918
"io"
2019
"log"
2120
"net/http"
@@ -24,6 +23,7 @@ import (
2423
"path/filepath"
2524
"testing"
2625

26+
json "github.com/goccy/go-json"
2727
"github.com/stretchr/testify/assert"
2828
"github.com/stretchr/testify/require"
2929
)

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require (
44
github.com/go-openapi/jsonpointer v0.20.2
55
github.com/go-openapi/jsonreference v0.20.4
66
github.com/go-openapi/swag v0.22.6
7+
github.com/goccy/go-json v0.10.2
78
github.com/stretchr/testify v1.8.4
89
gopkg.in/yaml.v3 v3.0.1
910
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdX
66
github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4=
77
github.com/go-openapi/swag v0.22.6 h1:dnqg1XfHXL9aBxSbktBqFR5CxVyVI+7fYWhAf1JOeTw=
88
github.com/go-openapi/swag v0.22.6/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0=
9+
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
10+
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
911
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
1012
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
1113
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=

header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
package spec
1616

1717
import (
18-
"encoding/json"
1918
"strings"
2019

2120
"github.com/go-openapi/jsonpointer"
2221
"github.com/go-openapi/swag"
22+
json "github.com/goccy/go-json"
2323
)
2424

2525
const (

header_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
package spec
1616

1717
import (
18-
"encoding/json"
1918
"testing"
2019

2120
"github.com/go-openapi/swag"
21+
json "github.com/goccy/go-json"
2222
"github.com/stretchr/testify/assert"
2323
"github.com/stretchr/testify/require"
2424
)

helpers_spec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package spec_test
22

33
import (
4-
"encoding/json"
54
"fmt"
65
"regexp"
76
"strings"
87
"testing"
98

109
"github.com/go-openapi/spec"
1110
"github.com/go-openapi/swag"
11+
json "github.com/goccy/go-json"
1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
1414
)

0 commit comments

Comments
 (0)