Skip to content

Commit 7b068de

Browse files
committed
Use ordered maps
Signed-off-by: Pierre Fenoll <[email protected]>
1 parent 1ce4bf8 commit 7b068de

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ require (
2727
github.com/josharian/intern v1.0.0 // indirect
2828
github.com/mailru/easyjson v0.7.7 // indirect
2929
github.com/pmezard/go-difflib v1.0.0 // indirect
30+
github.com/bahlo/generic-list-go v0.2.0 // indirect
31+
github.com/buger/jsonparser v1.1.1 // indirect
32+
gopkg.in/yaml.v2 v2.4.0 // indirect
3033
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xW
33
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
44
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
55
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
6+
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
7+
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
8+
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
9+
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
610
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
711
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
812
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

openapi3/loader_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ paths:
6262
require.Equal(t, 2, len(doc.Components.Schemas))
6363
require.Equal(t, 1, doc.Paths.Len())
6464
require.Equal(t, "unexpected error", *doc.Paths.Value("/items").Put.Responses.Default().Value.Description)
65+
6566
err = doc.Validate(loader.Context)
6667
require.NoError(t, err)
6768
}

openapi3/security_scheme.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ func (flow *OAuthFlow) Validate(ctx context.Context, opts ...ValidationOption) e
373373
}
374374
}
375375

376-
if flow.Scopes == nil {
377-
return errors.New("field 'scopes' is missing")
376+
if v := flow.Scopes; v == nil || v.Len() == 0 {
377+
return errors.New("field 'scopes' is empty or missing")
378378
}
379379

380380
return validateExtensions(ctx, flow.Extensions)

0 commit comments

Comments
 (0)