Commit 7d247e5 1 parent b5e986f commit 7d247e5 Copy full SHA for 7d247e5
File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,14 @@ import (
11
11
//
12
12
// The scheme refers to previous definitions of either OAuth2Security, BasicAuthSecurity,
13
13
// APIKeySecurity or JWTSecurity. It can be a string, corresponding to the first parameter of
14
- // those definitions, or a SecuritySchemeDefinition, returned by those same functions.
14
+ // those definitions, or a SecuritySchemeDefinition, returned by those same functions. Examples:
15
+ //
16
+ // Security(BasicAuth)
17
+ //
18
+ // Security("oauth2", func() {
19
+ // Scope("api:read") // Requires "api:read" oauth2 scope
20
+ // })
21
+ //
15
22
func Security (scheme interface {}, dsl ... func ()) {
16
23
var def * design.SecurityDefinition
17
24
switch val := scheme .(type ) {
Original file line number Diff line number Diff line change 33
33
// ErrBadRequest is a generic bad request error.
34
34
ErrBadRequest = NewErrorClass ("bad_request" , 400 )
35
35
36
+ // ErrUnauthorized is a generic unauthorized error.
37
+ ErrUnauthorized = NewErrorClass ("unauthorized" , 401 )
38
+
36
39
// ErrInvalidRequest is the class of errors produced by the generated code when a request
37
40
// parameter or payload fails to validate.
38
41
ErrInvalidRequest = NewErrorClass ("invalid_request" , 400 )
You can’t perform that action at this time.
0 commit comments