Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit ef30d23

Browse files
committed
[CO-322] Fix the issue by replacing < with - and [] with __
1 parent 82337f8 commit ef30d23

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

wallet-new/src/Cardano/Wallet/API/Response.hs

+5-2
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ instance ToJSON a => MimeRender OctetStream (WalletResponse a) where
114114
instance (ToSchema a, Typeable a) => ToSchema (WalletResponse a) where
115115
declareNamedSchema _ = do
116116
let a = Proxy @a
117-
tyName = toText . show $ typeRep a
117+
tyName = toText . map sanitize . show $ typeRep a
118+
sanitize c
119+
| c `elem` (":/?#[]@!$&'()*+,;=" :: String) = '_'
120+
| otherwise = c
118121
aRef <- declareSchemaRef a
119122
respRef <- declareSchemaRef (Proxy @ResponseStatus)
120123
metaRef <- declareSchemaRef (Proxy @Metadata)
121-
pure $ NamedSchema (Just $ "WalletResponse<" <> tyName <> ">") $ mempty
124+
pure $ NamedSchema (Just $ "WalletResponse-" <> tyName) $ mempty
122125
& type_ .~ SwaggerObject
123126
& required .~ ["data", "status", "meta"]
124127
& properties .~

0 commit comments

Comments
 (0)