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

Allow overriding Tapir endpoint inputs created by Caliban's HttpInterpreter #2185

Closed
olisikh opened this issue Apr 11, 2024 · 0 comments
Closed
Labels
adapters Issue related to HTTP adapters enhancement New feature or request good first issue Good for newcomers server Issue related to caliban server

Comments

@olisikh
Copy link
Contributor

olisikh commented Apr 11, 2024

Hi,

I want to override the path prefix of Caliban's Tapir endpoints made by HttpInterpreter, but it seems there's no way to do it with existing HttpInterpreter implementation.

Ultimately I want to run a NettyZioServer providing tapir endpoints directly and control the paths my APIs go into.

Example:

val api: List[ZServerEndpoint[...]] = ???
val graphql: List[ZServerEndpoint[...]] = ???
val status: List[ZServerEndpoint[...]] = ???

NettyZioServer[R]()
  .addEndpoints(api)     // path /api
  .addEndpoints(graphql) // path /graphql (desired), but currently it's "any path" due to .in(extractFromRequest(identity))
  .addEndpoints(status)  // path /status
  .host(...)
  .port(...)
  .start()

I've originally asked this question in Caliban's Discord channel here: https://discord.com/channels/629491597070827530/633200096393166868/1227766362714275922

Pierre answered that we could implement some intermediate case class within HttpInterpreter to allow overriding endpoint inputs:
https://discord.com/channels/629491597070827530/633200096393166868/1227772627758612550

I'm happy to do this myself once I get time (probably over the weekend), I initially thought of feeding in the user's EndpointInput replacing the .in(extractFromRequest(identitiy)) to allow users to decide the rest of the inputs they want.

Please let me know if you otherwise have any ideas or suggestions.

Appreciate your time 🙏

@ghostdogpr ghostdogpr added enhancement New feature or request server Issue related to caliban server adapters Issue related to HTTP adapters good first issue Good for newcomers labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Issue related to HTTP adapters enhancement New feature or request good first issue Good for newcomers server Issue related to caliban server
Projects
None yet
Development

No branches or pull requests

2 participants