@@ -33,6 +33,7 @@ spec = do
3333 context "ISPair" $ checkToSchema (Proxy :: Proxy ISPair) ispairSchemaJSON
3434 context "Point (fieldLabelModifier)" $ checkToSchema (Proxy :: Proxy Point) pointSchemaJSON
3535 context "Color (bounded enum)" $ checkToSchema (Proxy :: Proxy Color) colorSchemaJSON
36+ context "Shade (paramSchemaToNamedSchema)" $ checkToSchema (Proxy :: Proxy Shade) shadeSchemaJSON
3637 context "Paint (record with bounded enum field)" $ checkToSchema (Proxy :: Proxy Paint) paintSchemaJSON
3738 context "UserGroup (set newtype)" $ checkToSchema (Proxy :: Proxy UserGroup) userGroupSchemaJSON
3839 context "Unary records" $ do
@@ -49,6 +50,7 @@ spec = do
4950 context "String" $ checkSchemaName Nothing (Proxy :: Proxy String)
5051 context "(Int, Float)" $ checkSchemaName Nothing (Proxy :: Proxy (Int, Float))
5152 context "Person" $ checkSchemaName (Just "Person") (Proxy :: Proxy Person)
53+ context "Shade" $ checkSchemaName (Just "Shade") (Proxy :: Proxy Shade)
5254
5355main :: IO ()
5456main = hspec spec
@@ -137,6 +139,22 @@ colorSchemaJSON = [aesonQQ|
137139}
138140|]
139141
142+-- ========================================================================
143+-- Shade (paramSchemaToNamedSchema)
144+-- ========================================================================
145+
146+data Shade = Dim | Bright deriving (Generic, ToParamSchema)
147+
148+instance ToSchema Shade where toNamedSchema = paramSchemaToNamedSchema defaultSchemaOptions
149+
150+shadeSchemaJSON :: Value
151+shadeSchemaJSON = [aesonQQ|
152+{
153+ "type": "string",
154+ "enum": ["Dim", "Bright"]
155+}
156+|]
157+
140158-- ========================================================================
141159-- Paint (record with bounded enum property)
142160-- ========================================================================