Closed maksbotan closed 10 months ago
I support your proposition, in any case we will want to make sure that a pre-release is uploaded to Hackage so that users (me included) can test the behaviour. :)
There was a test that servant's eitherDecodeLenient
behaves exactly like eitherDecode
from aeson:
I've pushed an update to check if everything works. I've also had to change the tutorial, as it also mentioned old aeson
behavior.
I've returned the test
Do you want me to upload candidate to Hackage to test?
That would be lovely yes
It's here: https://hackage.haskell.org/package/servant-0.20.1/candidate
You can try it by adding https://hackage.haskell.org/package/servant-0.20.1/candidate/servant-0.20.1.tar.gz to your cabal.project
or stack.yaml
.
@maksbotan Wonderful. I think servant-server & servant-client-core are going to need a pre-release as well, I'm getting:
src/Servant/Server/Internal.hs:686:26: error:
• Couldn't match type ‘a’ with ‘IO a0’
Expected: SourceIO chunk -> a
Actual: SourceIO chunk -> IO a0
‘a’ is a rigid type variable bound by
the instance declaration
at src/Servant/Server/Internal.hs:(673,5)-(675,68)
• In the first argument of ‘return’, namely ‘fromSourceIO’
In the expression: return fromSourceIO
In an equation for ‘ctCheck’: ctCheck = return fromSourceIO
and
src/Servant/Client/Core/HasClient.hs:430:35: error:
• Couldn't match type ‘a’ with ‘IO a1’
Expected: Client m (Stream method status framing ct a)
Actual: m (IO a1)
‘a’ is a rigid type variable bound by
the instance declaration
at src/Servant/Client/Core/HasClient.hs:(422,3)-(424,54)
• In the expression:
withStreamingRequest req'
$ \ gres
-> do let ...
return $ fromSourceIO $ framingUnrender' $ responseBody gres
In an equation for ‘clientWithRoute’:
clientWithRoute _pm Proxy req
= withStreamingRequest req'
$ \ gres
-> do let ...
....
where
req'
= req
{requestAccept = fromList [...],
requestMethod = reflectMethod (Proxy :: Proxy method)}
In the instance declaration for
‘HasClient m (Stream method status framing ct a)’
• Relevant bindings include
clientWithRoute :: Proxy m
-> Proxy (Stream method status framing ct a)
-> Request
-> Client m (Stream method status framing ct a)
(bound at src/Servant/Client/Core/HasClient.hs:430:3)
|
430 | clientWithRoute _pm Proxy req = withStreamingRequest req' $ \gres -> do
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
I will also send a call for beta-testers on social media to make sure our users can take the time to test things on their own applications
That should not be happening, looks like you get servant-server <0.20, which is incompatible with servant-0.20.*
ok perfect it compiles here
Okay, so let's wait for a bit for more tests, and I'll merge & release.
@maksbotan servant-lucid would need a bound bump, I can do it for you if you give me permission on Hackage. :)
@maksbotan Has this been sufficiently tested already?
@maksbotan Is there anything blocking this from getting merged?
Publishing this patch in a new version would allow the Arch package to be updated without carrying an additional patch.
I would also love to see this merged and released.
(I think, as a web framework, servant should try to always support the latest version of aeson.)
Let me know if you'd appreciate any help getting this over the line, but no pressure
The CI fails because it tries to build warp-3.3.25
which is incompatible with http2-4.2.0
. There is a newer version, warp-3.3.29
which is compatible, but not chosen.
Thank you @Vekhir. I'll look into this.
@maksbotan :
You might want to remove or flip constraints: warp < 3.3.26
in cabal.project
.
Due to backwards-incompatible changes to master since this PR (see #1697), I will have to make Hackage release from this branch.
@ysangkok @tchoutri @larskuhtz please check out this release candidate: https://hackage.haskell.org/package/servant-0.20.1/candidate
Direct tar gz link: https://hackage.haskell.org/package/servant-0.20.1/candidate/servant-0.20.1.tar.gz
If everything's fine, I'll publish a release.
Alright, except for a usage of eitherDecodeLenient
and odd-jobs lagging a bit behind for aeson-2.2 compat, I haven't encountered any problem.
What do you mean by "odd-jobs lagging"?
It still does not support aeson-2.2 https://github.com/saurabhnanda/odd-jobs/pull/101
Ah, didn't get that it's a name of a package :)
Great, I'll publish that release on Hackage.
Published!
@theophile-fl @ysangkok @jkarni and co, I need your advice on this. Servant.API.ContentTypes uses
Data.Aeson.Parser
:https://github.com/haskell-servant/servant/blob/16cfd03e74557d8fd8ef6e2ebfb9c26bd645d756/servant/src/Servant/API/ContentTypes.hs#L374-L391
Data.Aeson.Parser
module was removed in aeson-2.2, so there is no easy way to upgrade our version constraint.However, I think that this function is not needed anymore. Haddock mentions that it parser any json value, contrary to aeson's behavior to parse only list and object. See haddock for 'json' in aeson-2.1: https://hackage.haskell.org/package/aeson-2.1.2.1/docs/Data-Aeson-Parser.html#v:json
Our lower bound on aeson is 1.4 for a long time, so I propose to remove our
eitherDecodeLenient
and use aeson's nativeeitherDecode
instead. What do you think? I'm not sure if we have some tests to verify that the change is OK.I will make the change in this PR a bit later.