@@ -23,6 +23,7 @@ checkToParamSchema proxy js = (toParamSchema proxy :: ParamSchema Param) <=> js
2323spec :: Spec
2424spec = do
2525 describe "Generic ToParamSchema" $ do
26+ context "Unit" $ checkToParamSchema (Proxy :: Proxy Unit) unitSchemaJSON
2627 context "Color (bounded enum)" $ checkToParamSchema (Proxy :: Proxy Color) colorSchemaJSON
2728 context "Status (constructorTagModifier)" $ checkToParamSchema (Proxy :: Proxy Status) statusSchemaJSON
2829 context "Unary records" $ do
@@ -32,6 +33,20 @@ spec = do
3233main :: IO ()
3334main = hspec spec
3435
36+-- ========================================================================
37+-- Unit type
38+-- ========================================================================
39+
40+data Unit = Unit deriving (Generic, ToParamSchema)
41+
42+unitSchemaJSON :: Value
43+unitSchemaJSON = [aesonQQ|
44+{
45+ "type": "string",
46+ "enum": ["Unit"]
47+}
48+|]
49+
3550-- ========================================================================
3651-- Color (enum)
3752-- ========================================================================