-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Graphiql endpoints for tapir adapters #2379
Conversation
.mapIn { segments => | ||
val uiPath = segments.mkString("/", "/", "") | ||
Right(HttpUtils.graphiqlHtml(apiPath = apiPath0, uiPath = uiPath)) | ||
}( | ||
_.value.split("/").filter(_.nonEmpty).toList | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does anyone think of a better way to do this? It works but I'm not too happy with this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is this even used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean a less clean way but more efficient way would be to combine the steps into a single operation. But if it's not a hot path I wouldn't worry about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghostdogpr this would be used for the caliban-to-tapir adapter use case
im actually curious @kyri-petrou, would it be easier to expose the tapir data type itself (EndpointInput[Unit]
) so you didn’t have to rebuild the path segment itself? Or is that exposing too much tapir details?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up reimplementing the endpoint properly, requiring an implicit MonadError (from sttp) to create it. It should be possible now to customize the endpoint using the .endpoint
method on the ServerEndpoint.Full
/closes #2376
@calvinlfer was there something in the examples you wanted to add with graphiql?