git.iko.soy/typeable/openapi3
on master help sign in
Add doctests for security schemes
34f4f0dMaxim Koltsov
src/Data/OpenApi/Internal.hs+17
@@ -846,6 +846,23 @@ data HttpSchemeType
846 | HttpSchemeCustom Text
846 | HttpSchemeCustom Text
847 deriving (Eq, Show, Generic, Data, Typeable)
847 deriving (Eq, Show, Generic, Data, Typeable)
848
848
849+-- |
850+--
851+-- >>> encode (SecuritySchemeHttp (HttpSchemeBearer Nothing))
852+-- "{\"scheme\":\"bearer\",\"type\":\"http\"}"
853+--
854+-- >>> encode (SecuritySchemeHttp (HttpSchemeBearer (Just "jwt")))
855+-- "{\"scheme\":\"bearer\",\"type\":\"http\",\"bearerFormat\":\"jwt\"}"
856+--
857+-- >>> encode (SecuritySchemeHttp HttpSchemeBasic)
858+-- "{\"scheme\":\"basic\",\"type\":\"http\"}"
859+--
860+-- >>> encode (SecuritySchemeHttp (HttpSchemeCustom "CANARY"))
861+-- "{\"scheme\":\"CANARY\",\"type\":\"http\"}"
862+--
863+-- >>> encode (SecuritySchemeApiKey (ApiKeyParams "id" ApiKeyCookie))
864+-- "{\"in\":\"cookie\",\"name\":\"id\",\"type\":\"apiKey\"}"
865+--
849data SecuritySchemeType
866data SecuritySchemeType
850 = SecuritySchemeHttp HttpSchemeType
867 = SecuritySchemeHttp HttpSchemeType
851 | SecuritySchemeApiKey ApiKeyParams
868 | SecuritySchemeApiKey ApiKeyParams