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

Move integrations to main repo + new Ktor integrations #3570

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

serras
Copy link
Member

@serras serras commented Jan 25, 2025

This PR does a few things (sorry, I forgot to switch branches).

It moves the Jackson module from arrow-integrations repo into the main repo, which makes it easier to release in the future. Alongside it reorganizes the repo, moving all the integrations modules (Retrofit, Jackson, kotlinx.serialization) into a new integrations folder.

Alongside those, it adds a new integration with Ktor in the form of a client plug-in. It does the same as the built-in HttpRetry but using our Schedule and CircuitBreaker.

@serras serras requested review from nomisRev and kyay10 January 25, 2025 15:03
Copy link
Contributor

github-actions bot commented Jan 25, 2025

Kover Report

File Coverage [70.45%]
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/ArrowModule.kt 100.00%
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/EitherModule.kt 100.00%
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/IorModule.kt 100.00%
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/OptionModule.kt 91.49%
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/internal/ElementDeserializer.kt 72.73%
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/internal/ProductTypeDeserializer.kt 75.00%
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/internal/ProductTypeSerializer.kt 100.00%
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/internal/UnionTypeDeserializer.kt 82.76%
arrow-libs/integrations/arrow-core-jackson/src/main/kotlin/arrow/integrations/jackson/module/internal/UnionTypeSerializer.kt 90.00%
arrow-libs/integrations/arrow-core-retrofit/src/main/kotlin/arrow/retrofit/adapter/either/ArrowEitherCallAdapter.kt 73.08%
arrow-libs/integrations/arrow-core-retrofit/src/main/kotlin/arrow/retrofit/adapter/either/ArrowResponseECallAdapter.kt 73.08%
arrow-libs/integrations/arrow-core-retrofit/src/main/kotlin/arrow/retrofit/adapter/either/EitherCallAdapterFactory.kt 64.52%
arrow-libs/integrations/arrow-core-retrofit/src/main/kotlin/arrow/retrofit/adapter/either/ResponseE.kt 100.00%
arrow-libs/integrations/arrow-core-retrofit/src/main/kotlin/arrow/retrofit/adapter/either/eitherAdapter.kt 80.00%
arrow-libs/integrations/arrow-core-retrofit/src/main/kotlin/arrow/retrofit/adapter/either/networkhandling/CallError.kt 100.00%
arrow-libs/integrations/arrow-core-retrofit/src/main/kotlin/arrow/retrofit/adapter/either/networkhandling/NetworkEitherCallAdapter.kt 69.44%
arrow-libs/integrations/arrow-core-serialization/src/commonMain/kotlin/arrow/core/serialization/EitherSerializer.kt 92.59%
arrow-libs/integrations/arrow-core-serialization/src/commonMain/kotlin/arrow/core/serialization/IorSerializer.kt 86.67%
arrow-libs/integrations/arrow-core-serialization/src/commonMain/kotlin/arrow/core/serialization/NonEmptyCollectionSerializers.kt 100.00%
arrow-libs/integrations/arrow-core-serialization/src/commonMain/kotlin/arrow/core/serialization/OptionSerializer.kt 100.00%
arrow-libs/integrations/arrow-core-serialization/src/commonMain/kotlin/arrow/core/serialization/SerializersModule.kt 100.00%
arrow-libs/integrations/arrow-raise-ktor-server/src/commonMain/kotlin/arrow/raise/ktor/server/OutgoingContent.kt 0.00%
arrow-libs/integrations/arrow-raise-ktor-server/src/commonMain/kotlin/arrow/raise/ktor/server/accumulate.kt 0.00%
arrow-libs/integrations/arrow-raise-ktor-server/src/commonMain/kotlin/arrow/raise/ktor/server/predef.kt 0.00%
arrow-libs/integrations/arrow-raise-ktor-server/src/commonMain/kotlin/arrow/raise/ktor/server/routing.kt 0.00%
arrow-libs/integrations/arrow-resilience-ktor-client/src/commonMain/kotlin/arrow/resilience/ktor/client/HttpCircuitBreaker.kt 0.00%
arrow-libs/integrations/arrow-resilience-ktor-client/src/commonMain/kotlin/arrow/resilience/ktor/client/HttpRequestSchedule.kt 86.46%
Total Project Coverage 46.06%

@nomisRev
Copy link
Member

Great work @serras 👏 🙌

I am a bit unsure of moving the Ktor integration into the main repo, but I am not opposed to it. It was still relatively small, unreleased, and unpromoted but I was quite happy with the APIs last summer. https://github.com/nomisRev/arrow-ktor/tree/main?tab=readme-ov-file. More than happy to move it here as well. What do you think?

@serras
Copy link
Member Author

serras commented Feb 1, 2025

I really like your libraries! What do you think of just using this branch, and then merge everything?

About the naming, I really like that Ktor is very clear about things being client or server oriented, so I would suggest to use:

  • arrow-resilience-ktor-client or arrow-ktor-client-resilience,
  • arrow-raise-ktor-server or arrow-ktor-server-raise (I think "raise" is better than "core" here because it's all about the Raise context).

@kyay10
Copy link
Collaborator

kyay10 commented Feb 1, 2025

Calling it raise is also good if we want to eventually have a mini-library for Raise (likely when context params are out so we can get rid of Either extensions being inside the interface)

@serras
Copy link
Member Author

serras commented Feb 4, 2025

@nomisRev I've just integrated your Ktor libraries in this repo. I've taken the code mostly as it was, but I've updated it to the newest version of Arrow and Ktor, and made everything common code.

  • There was a problem with using a suspend function type directly in Ktor Client, so I've added an intermediate fun interface.
  • The type for routes in Ktor 3 uses RoutingContext instead of PipelineCall, and this was updated.
  • The Ktor server uses the common-based API for charsets, instead of using the JVM one (so now the server is also Multiplatform).

@serras serras changed the title Move integrations to main repo + new Ktor client integration Move integrations to main repo + new Ktor integrations Feb 4, 2025
@serras
Copy link
Member Author

serras commented Feb 4, 2025

@nomisRev if you are OK with these changes, feel free to simply merge this PR into main.

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