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

[755] zio-schema breaking update #785

Merged
merged 7 commits into from
Mar 28, 2023

Conversation

m-kalai
Copy link
Contributor

@m-kalai m-kalai commented Mar 24, 2023

#755

  • getting rid of implicit BinaryCodec where it's not needed
  • introducing CodecSupplier as a way to provide BinaryCodec implementation used for arbitrary input/output

@m-kalai m-kalai requested review from mijicd and a team as code owners March 24, 2023 19:01
ioleo
ioleo previously approved these changes Mar 27, 2023
Copy link
Member

@ioleo ioleo left a comment

Choose a reason for hiding this comment

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

👍 LGTM

Copy link
Member

@mijicd mijicd left a comment

Choose a reason for hiding this comment

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

A few remarks/questions from my side, other than that looks good to me. Apart from the code, please revert the documentation "fixes". We can tackle them in a follow-up.

@@ -44,7 +44,9 @@ object EmbeddedRedisSpec extends ZIOSpecDefault {
).provideShared(
EmbeddedRedis.layer.orDie,
RedisExecutor.layer.orDie,
ZLayer.succeed[BinaryCodec](ProtobufCodec),
ZLayer.succeed[CodecSupplier](new CodecSupplier {
override implicit def codec[A: Schema]: BinaryCodec[A] = ProtobufCodec.protobufCodec
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
override implicit def codec[A: Schema]: BinaryCodec[A] = ProtobufCodec.protobufCodec
implicit def codec[A: Schema]: BinaryCodec[A] = ProtobufCodec.protobufCodec

}
}

abstract class ArbitraryInput[-A] extends Input[A] {}
Copy link
Member

Choose a reason for hiding this comment

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

Two things:

  • let's put it in Input companion
  • let's seal it (it could be trait if I'm not mistaken)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yeah, this is leftover, i was trying something, to split input and arbitrary input, but i think we don't need this at all in the end

Comment on lines 23 to 25
trait CodecSupplier {
implicit def codec[A: Schema]: BinaryCodec[A]
}
Copy link
Member

Choose a reason for hiding this comment

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

A few remarks here:

  • let's rename to CodecSupplier
  • let's rename method to get
  • let's remove implicit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. it's already called CodecSupplier or am i not seeing the difference?
  2. ok sure
  3. let me check if it's not used somewhere, if not i'll remove

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, typo 🤦‍♂️ I wanted to write CodecProvider.

protected def executor: RedisExecutor

implicit def summonCodec[A: Schema]: BinaryCodec[A] = codec.codec
Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, we have to "summon" the implicit codec, without this you get like 600 error when trying to compile, is there a better way you think?

Copy link
Member

Choose a reason for hiding this comment

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

I presume the only way around it would be to call codec.get everywhere, right?

@m-kalai
Copy link
Contributor Author

m-kalai commented Mar 27, 2023

A few remarks/questions from my side, other than that looks good to me. Apart from the code, please revert the documentation "fixes". We can tackle them in a follow-up.

not sure which fixes should i revert, because those "fixes" were actual fixes :D without them mdoc complained about not being able to compile code examples, so imho it would just fail on a different step of a workflow

@mijicd mijicd merged commit 1a89cdb into zio:master Mar 28, 2023
hcwilhelm pushed a commit to hcwilhelm/zio-redis that referenced this pull request Feb 18, 2025
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.

3 participants