git.iko.soy/typeable/swagger2
on master help sign in
Fixes #132

The original code seems to check whether the type is really a type constructor thus starting with an upper case letter. The problem is that this check is done on the transformed name of the type, which may no longer be an upper case letter (e.g. when one uses camelTo2 '_'). Therefore, the check should be done on the original name of the type, which then fixes issue #132.

commit4ce7dc96b6a331fe706fbbda4769900ef6e03091 authorAdriaan Middelkoop <amiddelkoop@vwd.com> dateTue 24 Oct 2017, 19:27 (9 years ago) parentf014fbc
1 file changed+3−2
src/Data/Swagger/Internal/Schema.hs+3−2
src/Data/Swagger/Internal/Schema.hs+3−2
@@ -680,11 +680,12 @@ genericNameSchema :: forall a d f proxy.
680680genericNameSchema opts _ = NamedSchema (gdatatypeSchemaName opts (Proxy :: Proxy d))
681681
682682gdatatypeSchemaName :: forall proxy d. Datatype d => SchemaOptions -> proxy d -> Maybe T.Text
683−gdatatypeSchemaName opts _ = case name of
683+gdatatypeSchemaName opts _ = case orig of
684684 (c:_) | isAlpha c && isUpper c -> Just (T.pack name)
685685 _ -> Nothing
686686 where
687− name = datatypeNameModifier opts (datatypeName (Proxy3 :: Proxy3 d f a))
687+ orig = datatypeName (Proxy3 :: Proxy3 d f a)
688+ name = datatypeNameModifier opts orig
688689
689690-- | Lift a plain @'ParamSchema'@ into a model @'NamedSchema'@.
690691paramSchemaToNamedSchema :: forall a d f proxy.