Skip to content

Commit d65e340

Browse files
author
Nick Tchayka
authored
Merge pull request theam#102 from hugoflug/make-authorizer-a-maybe
Make authorizer a Maybe in ApiGatewayRequestContext
2 parents a1fea3b + e26fbd8 commit d65e340

File tree

1 file changed

+3
-2
lines changed
  • src/Aws/Lambda/Runtime/APIGateway

1 file changed

+3
-2
lines changed

src/Aws/Lambda/Runtime/APIGateway/Types.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import Data.Aeson
2626
eitherDecodeStrict,
2727
object,
2828
(.:),
29+
(.:?)
2930
)
3031
import Data.Aeson.Types (Parser)
3132
import qualified Data.Aeson.Types as T
@@ -110,7 +111,7 @@ data ApiGatewayRequestContext = ApiGatewayRequestContext
110111
apiGatewayRequestContextDomainName :: !Text,
111112
apiGatewayRequestContextApiId :: !Text,
112113
apiGatewayRequestContextIdentity :: !ApiGatewayRequestContextIdentity,
113-
apiGatewayRequestContextAuthorizer :: !Value
114+
apiGatewayRequestContextAuthorizer :: !(Maybe Value)
114115
}
115116
deriving (Show)
116117

@@ -131,7 +132,7 @@ instance FromJSON ApiGatewayRequestContext where
131132
<*> v .: "domainName"
132133
<*> v .: "apiId"
133134
<*> v .: "identity"
134-
<*> v .: "authorizer"
135+
<*> v .:? "authorizer"
135136
parseJSON _ = fail "Expected ApiGatewayRequestContext to be an object."
136137

137138
data ApiGatewayRequestContextIdentity = ApiGatewayRequestContextIdentity

0 commit comments

Comments
 (0)