-
Notifications
You must be signed in to change notification settings - Fork 267
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
NullReferenceException when using routeBind with Sum Type #206
Comments
Giraffe/src/Giraffe/HttpHandlers.fs Line 246 in 57d2b6f
For this to work with a union, you're going to have to create a
I imagine something smarter could be achieved using reflection... |
This is no the expected behavior from a native F# library. I understand why is like that, so maybe is better to clarify to have a CLI_MUTABLE struct? Or get a map instead? |
Hi @mamcx, yes we should document this until we find time to add union support. I think it would be worth to have a look if there is already an F# library which extends Json.NET for better F# type support otherwise we could write our own converters using reflection as @JonCanning suggested. |
I'm using https://github.com/Microsoft/fsharplu/wiki/fsharplu.json and it
serialize right the F# types.
2018-01-13 17:46 GMT-05:00 Dustin Moris Gorski <notifications@github.com>:
… Hi @mamcx <https://github.com/mamcx>, yes we should document this until
we find time to add union support. I think it would be worth to have a look
if there is already an F# library which extends Json.NET for better F# type
support otherwise we could write our own converters using reflection as
@JonCanning <https://github.com/joncanning> suggested.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#206 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAOlh0nvgve3Gbsml5lcJBViez7FJH7mks5tKTJQgaJpZM4RdQ6X>
.
--
Mario A.Montoya
Gerente
http://www.elmalabarista.com
Haz pedidos & facturas con tu iPhone: http://www.elmalabarista.co
<http://www.elmalabarista.com/>*m/bestseller*
|
Hi @mamcx, In your example the route I think there are a few ways how this could be handled:
Probably the first or second option make the most sense. Sounds like you prefer the second, is that correct? Also regarding FSharpLu, did you get |
I expect the second to hold. The reason is that is exactly why I using the union type and not just a string, ie, why "int" work, but "Int Or String" not? In python, I could use a regex to parse the posibilities. |
Ok, makes sense... Could you please explain what you meant by
How did you use FSharpLu with the previous version of Giraffe? |
This is how I do this:
I just replace the json calls with my own things, without inject into Giraffe (I don't like much magic ;), also waiting for the support to streaming large data to see how it could be...) |
I think the problem is more universal. For example:
In BindJsonAsync it get a |
Hi, this should be fixed in today's 1.1.0 release. Please let me know if you encounter any more issues! |
This is a weird one:
When a wrong path is called (like /customers/bla) it get converted to this:
{{sort = null;}}
Instead of give a 404 as expected. Is very unexpected that Giraffe somehow broke the union type here.
Giraffe Version="0.1.0-beta-700"
The text was updated successfully, but these errors were encountered: