Skip to content
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

Boopickle encoders #1826

Merged
merged 2 commits into from May 9, 2018
Merged

Boopickle encoders #1826

merged 2 commits into from May 9, 2018

Conversation

@cquiroz
Copy link
Member

@cquiroz cquiroz commented May 6, 2018

We use boopickle on our application with the encoders in this PR. I thought this could be generally useful in http4s though I'm not sure how widely used boopickle is.

This is also an opportunity, to receive any criticism you may have to my implementation. In particular I'm not sure if there is enough testing

I couldn't find an aggregate on build.sbt to include this into the overall build. Is it needed?

Copy link
Member

@rossabaker rossabaker left a comment

I'd say this goes into the class of things we probably want to spin off at 1.x, but could find a home here while we finish evolving.

* Create an `EntityDecoder` for `A` given a `Pickler[A]`
*/
def booOf[F[_]: Sync, A: Pickler]: EntityDecoder[F, A] =
EntityDecoder.decodeBy(MediaType.`application/octet-stream`)(booDecoderByteBuffer[F, A])

This comment has been minimized.

@rossabaker

rossabaker May 9, 2018
Member

This is going to be hard to use, like jsonOf became hard to use in 0.18, isn't it?

This comment has been minimized.

@cquiroz

cquiroz May 9, 2018
Author Member

I’m not sure what you mean, could you elaborate?

This comment has been minimized.

@rossabaker

rossabaker May 9, 2018
Member

We used to be able to say req.as(jsonOf(Foo]). But the extra evidence parameter made that something awful like req.as(jsonOf(implicitly, Decoder[Foo])). So we added decodeJson syntax to Message to make it req.decodeJson[Foo].

Isn't boo going to suffer the same?

This comment has been minimized.

@cquiroz

cquiroz May 9, 2018
Author Member

I see. I noted decodeJson was on Message but I assumed it was grandfathered. OTOH I don't think you want to keep adding decodeXXX methods. Or perhaps they can be extension methods in the bundle?

This comment has been minimized.

@rossabaker

rossabaker May 9, 2018
Member

I don't like decodeJson. We just never figured out a better way, since we don't have multiple implicit lists.

I think if we did the same here, it would go in the bundle.

}
}

checkAll("EntityCodec[IO, Json]", EntityCodecTests[IO, Fruit].entityCodec)

This comment has been minimized.

@rossabaker

rossabaker May 9, 2018
Member

Label is wrong on this test

build.sbt Outdated
Http4sPlugin.boopickle
)
)
.dependsOn(core, testing % "test->test", jawn % "compile;test->test")

This comment has been minimized.

@rossabaker

rossabaker May 9, 2018
Member

Why does this module depend on jawn?

@cquiroz cquiroz force-pushed the cquiroz:boopickle branch from b32aa01 to b6a7f91 May 9, 2018
@rossabaker
Copy link
Member

@rossabaker rossabaker commented May 9, 2018

New modules need to opt out of MiMa checking, because there isn't a prior version to check against. I think there is an example of this in the Netty PR.

@cquiroz cquiroz force-pushed the cquiroz:boopickle branch from b6a7f91 to 8879241 May 9, 2018
libraryDependencies ++= Seq(
Http4sPlugin.boopickle
),
mimaPreviousArtifacts := Set.empty

This comment has been minimized.

@rossabaker

rossabaker May 9, 2018
Member

Just remember to remove this after we release 0.18.11.

@rossabaker rossabaker merged commit 0a4706b into http4s:release-0.18.x May 9, 2018
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.