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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Label is wrong on this test

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this module depend on jawn?

@rossabaker
Copy link
Member

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.

libraryDependencies ++= Seq(
Http4sPlugin.boopickle
),
mimaPreviousArtifacts := Set.empty
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants