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

sttp2: package reorganization #288

Closed
adamw opened this issue Sep 16, 2019 · 3 comments
Closed

sttp2: package reorganization #288

adamw opened this issue Sep 16, 2019 · 3 comments
Labels

Comments

@adamw
Copy link
Member

adamw commented Sep 16, 2019

After improving error handling in responses (see #284 ), the second major problem in sttp is that there's some code overlap with https://github.com/softwaremill/tapir - specifically, everything that has to do with the HTTP model (Method, Cookie, HeaderNames, StatusCodes objects etc., as well as the potential type-safe HTTP model).

We don't like duplication so we've been wondering what to do about it :). The first idea is to create a separate "HTTP model" project, which would be used both by sttp and tapir. But then, should this be a completely separate project with its own name (and naming is hard)? Module of sttp?

One of the possibilities we've come up with is to broaden the usage of the sttp name from just HTTP client, to "HTTP-related Scala things". We would then have three top-level projects:

  • sttp model
  • sttp client (the current sttp codebase)
  • sttp tapir (endpoint descriptions + interpreters)

The downside of this is of course migration. That would mean that we'd have to change the package structure in both projects. The packages could be:

import sttp.model._

import sttp.client._ // currently: import com.softwaremill.sttp._
import sttp.client.akkahttp.AkkaHttpBackend // currently: import com.softwaremill.sttp.akkahttp.AkkaHttpBackend (the akka http backend implementation)

import sttp.tapir._ // currently: import tapir._
import sttp.tapir.server.akkahttp._ // currently: import tapir.server.akkahttp._ (the akka http endpoint interpreter)

As that would be a big change, we need your feedback! :)

@adamw adamw added the v2 label Sep 17, 2019
@aappddeevv
Copy link

aappddeevv commented Sep 30, 2019

I think this is Ok. I would suggest something clever though that keeps the imports simple e.g. you only need sttp._. I'm not sure how that would work though as you run into path dependent types.

@adamw
Copy link
Member Author

adamw commented Sep 30, 2019

@aappddeevv currently it's sttp.client._, which is already much shorter than com.softwaremill.sttp._ :). As there are several projects under the sttp namespace, I think we'll need at least two components here.

@adamw
Copy link
Member Author

adamw commented Oct 4, 2019

Released in 2.0.0-M5

@adamw adamw closed this as completed Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants