Skip to content

Commit 2223ab3

Browse files
committed
fix expanding for go 1.13
Signed-off-by: Ivan Porto Carrero <ivan@flanders.co.nz>
1 parent bdfd7e0 commit 2223ab3

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

bindata.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

expander_test.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/go-openapi/jsonpointer"
3131
"github.com/go-openapi/swag"
3232
"github.com/stretchr/testify/assert"
33+
"github.com/stretchr/testify/require"
3334
)
3435

3536
var specs = filepath.Join("fixtures", "specs")
@@ -635,6 +636,7 @@ func Test_ExpandSwaggerSchema(t *testing.T) {
635636
m := rex.FindAllStringSubmatch(jazon, -1)
636637
if assert.NotNil(t, m) {
637638
for _, matched := range m {
639+
// matched := m[0]
638640
subMatch := matched[1]
639641
assert.True(t, strings.HasPrefix(subMatch, "#/definitions/"),
640642
"expected $ref to be inlined, got: %s", matched[0])
@@ -644,10 +646,7 @@ func Test_ExpandSwaggerSchema(t *testing.T) {
644646

645647
func expandThisSchemaOrDieTrying(t *testing.T, fixturePath string) string {
646648
doc, err := jsonDoc(fixturePath)
647-
if !assert.NoError(t, err) {
648-
t.FailNow()
649-
return ""
650-
}
649+
require.NoError(t, err)
651650

652651
specPath, _ := absPath(fixturePath)
653652

@@ -657,12 +656,9 @@ func expandThisSchemaOrDieTrying(t *testing.T, fixturePath string) string {
657656

658657
sch := new(Schema)
659658
err = json.Unmarshal(doc, sch)
660-
if !assert.NoError(t, err) {
661-
t.FailNow()
662-
return ""
663-
}
659+
require.NoError(t, err)
664660

665-
assert.NotPanics(t, func() {
661+
require.NotPanics(t, func() {
666662
err = ExpandSchemaWithBasePath(sch, nil, opts)
667663
assert.NoError(t, err)
668664
}, "Calling expand schema circular refs, should not panic!")

go.mod

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
module github.com/go-openapi/spec
22

33
require (
4-
github.com/go-openapi/jsonpointer v0.19.2
4+
github.com/go-openapi/jsonpointer v0.19.3
55
github.com/go-openapi/jsonreference v0.19.2
6-
github.com/go-openapi/swag v0.19.2
6+
github.com/go-openapi/swag v0.19.5
77
github.com/kr/pty v1.1.5 // indirect
88
github.com/stretchr/objx v0.2.0 // indirect
99
github.com/stretchr/testify v1.3.0
1010
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 // indirect
11+
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
1112
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f // indirect
1213
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59 // indirect
1314
gopkg.in/yaml.v2 v2.2.2
1415
)
16+
17+
go 1.13

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ github.com/go-openapi/jsonpointer v0.19.0 h1:FTUMcX77w5rQkClIzDtTxvn6Bsa894CcrzN
1313
github.com/go-openapi/jsonpointer v0.19.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
1414
github.com/go-openapi/jsonpointer v0.19.2 h1:A9+F4Dc/MCNB5jibxf6rRvOvR/iFgQdyNx9eIhnGqq0=
1515
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
16+
github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w=
17+
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
1618
github.com/go-openapi/jsonreference v0.19.0 h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk=
1719
github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
1820
github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w=
@@ -21,6 +23,8 @@ github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi88
2123
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
2224
github.com/go-openapi/swag v0.19.2 h1:jvO6bCMBEilGwMfHhrd61zIID4oIFdwb76V17SM88dE=
2325
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
26+
github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY=
27+
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
2428
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
2529
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
2630
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -31,6 +35,8 @@ github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3
3135
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
3236
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63 h1:nTT4s92Dgz2HlrB2NaMgvlfqHH39OgMhA7z3PK7PGD4=
3337
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
38+
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8=
39+
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
3440
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
3541
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
3642
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -47,6 +53,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
4753
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
4854
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
4955
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
56+
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM=
57+
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
5058
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
5159
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
5260
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

schema_loader.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ func (r *schemaLoader) load(refURL *url.URL) (interface{}, url.URL, bool, error)
160160
if !fromCache {
161161
b, err := r.loadDoc(normalized)
162162
if err != nil {
163+
debugLog("unable to load the document: %v", err)
163164
return nil, url.URL{}, false, err
164165
}
165166

0 commit comments

Comments
 (0)