Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Why did we pick the tapir library?#

Sumit Rawal answered on May 24, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


Why did we pick the tapir library?#

0

We wanted to use something that allows us to generate a http4s server. This already narrowed down the options a bit.

It should be able to generate API documentation, which nowadays means Swagger/OpenAPI support.

It should support not only http4s but more options as well.

Tapir meets all our requirements. The library is still pretty young and may be subject to breaking changes, so please keep this in mind when reading through the following part.

The basics

The tapir library assumes that you describe your API using the Endpoint type, which is more concretely defined as follows: Endpoint[I, E, O, S].

• The type I defines the input given into the endpoint.

• Type type E defines the error (or errors) that may be returned by the endpoint.

• The type O defines the possible output of the endpoint.

• The type S specifies the type of streams that are used for input and output.

An endpoint can have attributes like name or description, which will be used in the generated documentation. You can also map input and output parameters into case classes.

Please note that all mappings have to be bidirectional because tapir must be able to generate server and client code from it.

Regarding the encoding and decoding of data, we will need our Circe codecs and additionally some schema definitions required by tapir. In concrete, we will need to define implicit SchemaFor[T] instances for each of our models.

Tapir schema for Translation

We will start with the Translation model. 

Popularity 1/10 Helpfulness 1/10 Language scala
Source: Grepper
Tags: pick scala
Link to this answer
Share Copy Link
Contributed on May 24 2023
Sumit Rawal
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.