-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Allow aeson-2.2 #1695
Allow aeson-2.2 #1695
Conversation
29658e5
to
a408400
Compare
@theophile-fl @ysangkok @jkarni and co, I need your advice on this. Servant.API.ContentTypes uses servant/servant/src/Servant/API/ContentTypes.hs Lines 374 to 391 in 16cfd03
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 I will make the change in this PR a bit later. |
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 servant/servant/test/Servant/API/ContentTypesSpec.hs Lines 222 to 229 in 104a8ad
I've pushed an update to check if everything works. I've also had to change the tutorial, as it also mentioned old |
8b302f4
to
160bf12
Compare
160bf12
to
c194e5c
Compare
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 |
@maksbotan Wonderful. I think servant-server & servant-client-core are going to need a pre-release as well, I'm getting:
and
|
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 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.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to keep eitherDecodeLenient
as an deprecated alias of eitherDecode
, since both have (probably) the same behavior since version 0.9 of aeson. (I haven't checked possible differences is the handling of of trailing characters, but I expect that to be a negligible issue.)
This would reduce the potential of the PR to break users and will hopefully help this change to be release soon.
branches: | ||
- master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated to this PR.
@@ -20,6 +22,7 @@ jobs: | |||
- "9.2.8" | |||
- "9.4.5" | |||
- "9.6.2" | |||
fail-fast: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems unrelated to this PR.
@@ -65,7 +65,6 @@ module Servant.API.ContentTypes | |||
, AllMime(..) | |||
, AllMimeRender(..) | |||
, AllMimeUnrender(..) | |||
, eitherDecodeLenient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the comments below it seems that with currently supported aeson versions eitherDecodeLenient
and eitherDecode
have the same behavior.
What about making eitherDecodeLenient
an alias of eitherDecode
and just mark it as deprecated? That way it would not break the API.
@@ -371,28 +364,9 @@ instance NFData NoContent | |||
-------------------------------------------------------------------------- | |||
-- * MimeUnrender Instances | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- | Deprecated: since aeson version 0.9 `eitherDecode` has lenient behavior. | |
-- | |
eitherDecodeLenient :: FromJSON a => ByteString -> Either String a | |
eitherDecodeLenient = eitherDecode | |
{-# DEPRECATED eitherDecodeLenient "use eitherDecode instead" #-} |
@@ -65,7 +65,6 @@ module Servant.API.ContentTypes | |||
, AllMime(..) | |||
, AllMimeRender(..) | |||
, AllMimeUnrender(..) | |||
, eitherDecodeLenient | |||
, canHandleAcceptH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep eitherDecodeLenient
as alias of eitherDecde
, but mark it as deprecated (cf. below).
, canHandleAcceptH | |
, eitherDecodeLenient | |
, canHandleAcceptH |
@@ -219,15 +219,13 @@ spec = describe "Servant.API.ContentTypes" $ do | |||
handleCTypeH (Proxy :: Proxy '[JSONorText]) "image/jpeg" | |||
"foobar" `shouldBe` (Nothing :: Maybe (Either String Int)) | |||
|
|||
-- aeson >= 0.9 decodes top-level strings | |||
describe "eitherDecodeLenient" $ do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe "eitherDecodeLenient" $ do | |
describe "eitherDecode is lenient" $ do |
Let me know if you'd appreciate any help getting this over the line, but no pressure |
c194e5c
to
d074bba
Compare
The CI fails because it tries to build |
Thank you @Vekhir. I'll look into this. |
@maksbotan : |
Relevant issue seems to be fixed upstream.
92a6426
to
8a4a7f5
Compare
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 |
What do you mean by "odd-jobs lagging"? |
It still does not support aeson-2.2 saurabhnanda/odd-jobs#101 |
Ah, didn't get that it's a name of a package :) Great, I'll publish that release on Hackage. |
Published! |
No description provided.