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
)

helpers_test.go

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

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

109
"github.com/go-openapi/swag"
10+
json "github.com/goccy/go-json"
1111
"github.com/stretchr/testify/assert"
1212
"github.com/stretchr/testify/require"
1313
)

info.go

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

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

2221
"github.com/go-openapi/jsonpointer"
2322
"github.com/go-openapi/swag"
23+
json "github.com/goccy/go-json"
2424
)
2525

2626
// Extensions vendor specific extensions

info_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
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
)
@@ -57,9 +57,9 @@ var info = Info{
5757
}
5858

5959
func TestIntegrationInfo_Serialize(t *testing.T) {
60-
b, err := json.MarshalIndent(info, "", "\t")
60+
b, err := json.MarshalIndent(info, "", " ")
6161
require.NoError(t, err)
62-
assert.Equal(t, infoJSON, string(b))
62+
assert.JSONEq(t, infoJSON, string(b))
6363
}
6464

6565
func TestIntegrationInfo_Deserialize(t *testing.T) {

items.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 (

items_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
)

license.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
// License information for the exposed API.

license_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
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
)
@@ -36,9 +36,9 @@ func TestIntegrationLicense(t *testing.T) {
3636

3737
// const licenseYAML = "name: the name\nurl: the url\n"
3838

39-
b, err := json.MarshalIndent(license, "", "\t")
39+
b, err := json.MarshalIndent(license, "", " ")
4040
require.NoError(t, err)
41-
assert.Equal(t, licenseJSON, string(b))
41+
assert.JSONEq(t, licenseJSON, string(b))
4242

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

operation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ package spec
1717
import (
1818
"bytes"
1919
"encoding/gob"
20-
"encoding/json"
2120
"sort"
2221

2322
"github.com/go-openapi/jsonpointer"
2423
"github.com/go-openapi/swag"
24+
json "github.com/goccy/go-json"
2525
)
2626

2727
func init() {

operation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ package spec
1717
import (
1818
"bytes"
1919
"encoding/gob"
20-
"encoding/json"
2120
"testing"
2221

22+
json "github.com/goccy/go-json"
2323
"github.com/stretchr/testify/assert"
2424
"github.com/stretchr/testify/require"
2525
)

parameter.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
// QueryParam creates a query parameter

parameters_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
)

path_item.go

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

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

2423
// PathItemProps the path item specific properties

path_item_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
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
)

paths.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
"fmt"
2019
"strings"
2120

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

2525
// Paths holds the relative paths to the individual endpoints.

paths_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
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
)

properties.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package spec
22

33
import (
44
"bytes"
5-
"encoding/json"
65
"reflect"
76
"sort"
7+
8+
json "github.com/goccy/go-json"
89
)
910

1011
// OrderSchemaItem holds a named schema (e.g. from a property of an object)

ref.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ package spec
1717
import (
1818
"bytes"
1919
"encoding/gob"
20-
"encoding/json"
2120
"net/http"
2221
"os"
2322
"path/filepath"
2423

2524
"github.com/go-openapi/jsonreference"
25+
json "github.com/goccy/go-json"
2626
)
2727

2828
// Refable is a struct for things that accept a $ref property

ref_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ package spec
1717
import (
1818
"bytes"
1919
"encoding/gob"
20-
"encoding/json"
2120
"testing"
2221

22+
json "github.com/goccy/go-json"
2323
"github.com/stretchr/testify/assert"
2424
"github.com/stretchr/testify/require"
2525
)

0 commit comments

Comments
 (0)