Skip to content

Commit 1793d0d

Browse files
committed
fix linter issues
1 parent da83422 commit 1793d0d

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

openapi3/issue230_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"testing"
77

88
"github.com/getkin/kin-openapi/openapi3"
9+
"github.com/stretchr/testify/assert"
910
"github.com/stretchr/testify/require"
1011
)
1112

@@ -495,18 +496,14 @@ func TestMigrationScenarios(t *testing.T) {
495496
var doc30 openapi3.T
496497
err := json.Unmarshal(spec30, &doc30)
497498
require.NoError(t, err)
498-
499-
if doc30.IsOpenAPI3_1() {
500-
}
499+
assert.False(t, doc30.IsOpenAPI3_1())
501500

502501
// Simulate loading 3.1 document
503502
spec31 := []byte(`{"openapi":"3.1.0","info":{"title":"Test","version":"1.0.0"},"paths":{}}`)
504503
var doc31 openapi3.T
505504
err = json.Unmarshal(spec31, &doc31)
506505
require.NoError(t, err)
507-
508-
if doc31.IsOpenAPI3_1() {
509-
}
506+
assert.True(t, doc31.IsOpenAPI3_1())
510507

511508
// Cleanup
512509
})
@@ -539,11 +536,13 @@ func TestEdgeCases(t *testing.T) {
539536
}
540537

541538
// Nil webhooks should not serialize
542-
data30, _ := json.Marshal(doc30)
539+
data30, err := json.Marshal(doc30)
540+
require.NoError(t, err)
543541
require.NotContains(t, string(data30), "webhooks")
544542

545543
// Empty webhooks should not serialize
546-
data31, _ := json.Marshal(doc31Empty)
544+
data31, err := json.Marshal(doc31Empty)
545+
require.NoError(t, err)
547546
require.NotContains(t, string(data31), "webhooks")
548547
})
549548

openapi3/schema.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,11 +2323,11 @@ func markSchemaErrorKey(err error, key string) error {
23232323
v.reversePath = append(v.reversePath, key)
23242324
if v.Origin != nil {
23252325
if unwrapped := errors.Unwrap(v.Origin); unwrapped != nil {
2326-
if me, ok := unwrapped.(multiErrorForOneOf); ok {
2327-
_ = markSchemaErrorKey(MultiError(me), key)
2326+
if me, ok := unwrapped.(multiErrorForOneOf); ok { //nolint:errorlint
2327+
_ = markSchemaErrorKey(MultiError(me), key) //nolint:errcheck
23282328
}
2329-
if me, ok := unwrapped.(multiErrorForAllOf); ok {
2330-
_ = markSchemaErrorKey(MultiError(me), key)
2329+
if me, ok := unwrapped.(multiErrorForAllOf); ok { //nolint:errorlint
2330+
_ = markSchemaErrorKey(MultiError(me), key) //nolint:errcheck
23312331
}
23322332
}
23332333
}

openapi3filter/req_resp_decoder_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,16 +1683,19 @@ func TestDecodeBody(t *testing.T) {
16831683
{name: "f", contentType: "application/json", data: strings.NewReader(`{"foo1": "foo1"}`), filename: "f1"},
16841684
{name: "f", contentType: "application/pdf", data: strings.NewReader("foo2"), filename: "f2"},
16851685
})
1686+
require.NoError(t, err)
16861687

16871688
multipartBinaryEncodingCTUnsupported, multipartMimeBinaryEncodingCTUnsupported, err := newTestMultipartForm([]*testFormPart{
16881689
{name: "b", contentType: "application/json", data: strings.NewReader(`{"bar1": "bar1"}`), filename: "b1"},
16891690
{name: "d", contentType: "application/pdf", data: strings.NewReader("doo1"), filename: "d1"},
16901691
})
1692+
require.NoError(t, err)
16911693

16921694
multipartBinaryEncodingCTNotMatching, multipartMimeBinaryEncodingCTNotMatching, err := newTestMultipartForm([]*testFormPart{
16931695
{name: "b", contentType: "application/json", data: strings.NewReader(`{"bar1": "bar1"}`), filename: "b1"},
16941696
{name: "d", contentType: "application/pdf", data: strings.NewReader("doo1"), filename: "d1"},
16951697
})
1698+
require.NoError(t, err)
16961699

16971700
testCases := []struct {
16981701
name string

0 commit comments

Comments
 (0)