-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic polymorphic schema handle lists differently to aeson #58
Comments
I fear that once Is this case important for you, or just a peculiarity? |
I ran across this problem in a real project. Thankfully I can work around this bug by listing out the particular monomorphic instances I need.
Sure, you cannot "look" in this way. We could (with only a slightly more complex class) generate the correct polymorphic instance in the first place. The way this tends to be done (e.g. (Perhaps this is what you meant by "horrible magic"?) |
Consider a polymorphic type
data T a = T [a]
, where the parameter is used in a list. The generically-derivedinstance ToSchema (T Char)
agrees withToJSON
(encodes as a string), but the polymorphic versioninstance ToSchema (T a)
does not (when used ata ~ Char
-- it encodes as an array of "characters" i.e. length-1 strings.).A complete example
which results in
This is presumably because openapi3 and aeson handle the special case of
[Char]
differently.(There may be some other such cases that differ -- I have not looked further. #50 is perhaps related.)
The text was updated successfully, but these errors were encountered: