@@ -838,8 +838,16 @@ data OAuth2Flows = OAuth2Flows
838 , _oAuth2FlowsAuthorizationCode :: Maybe (OAuth2Flow OAuth2AuthorizationCodeFlow)
838 , _oAuth2FlowsAuthorizationCode :: Maybe (OAuth2Flow OAuth2AuthorizationCodeFlow)
839 } deriving (Eq, Show, Generic, Data, Typeable)
839 } deriving (Eq, Show, Generic, Data, Typeable)
841+type BearerFormat = Text
844+ = HttpSchemeBearer (Maybe BearerFormat)
846+ | HttpSchemeCustom Text
847+ deriving (Eq, Show, Generic, Data, Typeable)
841data SecuritySchemeType
849data SecuritySchemeType
842− = SecuritySchemeHttp
850+ = SecuritySchemeHttp HttpSchemeType
843 | SecuritySchemeApiKey ApiKeyParams
851 | SecuritySchemeApiKey ApiKeyParams
844 | SecuritySchemeOAuth2 OAuth2Flows
852 | SecuritySchemeOAuth2 OAuth2Flows
845 | SecuritySchemeOpenIdConnect URL
853 | SecuritySchemeOpenIdConnect URL
@@ -1229,8 +1237,19 @@ instance ToJSON OAuth2Flows where
1229 toEncoding = sopSwaggerGenericToEncoding
1237 toEncoding = sopSwaggerGenericToEncoding
1231instance ToJSON SecuritySchemeType where
1239instance ToJSON SecuritySchemeType where
1232− toJSON SecuritySchemeHttp
1240+ toJSON (SecuritySchemeHttp ty) = case ty of
1241+ HttpSchemeBearer mFmt ->
1242+ object $ [ "type" .= ("http" :: Text)
1243+ , "scheme" .= ("bearer" :: Text)
1244+ ] <> maybe [] (\t -> ["bearerFormat" .= t]) mFmt
1246+ object [ "type" .= ("http" :: Text)
1247+ , "scheme" .= ("basic" :: Text)
1249+ HttpSchemeCustom t ->
1233− = object [ "type" .= ("http" :: Text) ]
1250+ object [ "type" .= ("http" :: Text)
1234 toJSON (SecuritySchemeApiKey params)
1253 toJSON (SecuritySchemeApiKey params)
1235 = toJSON params
1254 = toJSON params
1236 <+> object [ "type" .= ("apiKey" :: Text) ]
1255 <+> object [ "type" .= ("apiKey" :: Text) ]
@@ -1379,7 +1398,12 @@ instance FromJSON SecuritySchemeType where
1379 parseJSON js@(Object o) = do
1398 parseJSON js@(Object o) = do
1380 (t :: Text) <- o .: "type"
1399 (t :: Text) <- o .: "type"
1381 case t of
1400 case t of
1402+ scheme <- o .: "scheme"
1382− "http" -> pure SecuritySchemeHttp
1403+ SecuritySchemeHttp <$> case scheme of
1404+ "bearer" -> HttpSchemeBearer <$> (o .:! "bearerFormat")
1405+ "basic" -> pure HttpSchemeBasic
1406+ t -> pure $ HttpSchemeCustom t
1383 "apiKey" -> SecuritySchemeApiKey <$> parseJSON js
1407 "apiKey" -> SecuritySchemeApiKey <$> parseJSON js
1384 "oauth2" -> SecuritySchemeOAuth2 <$> (o .: "flows")
1408 "oauth2" -> SecuritySchemeOAuth2 <$> (o .: "flows")
1385 "openIdConnect" -> SecuritySchemeOpenIdConnect <$> (o .: "openIdConnectUrl")
1409 "openIdConnect" -> SecuritySchemeOpenIdConnect <$> (o .: "openIdConnectUrl")