diff --git a/README.md b/README.md index e9718a086c..1daf120448 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ tapir documentation is available at [tapir.softwaremill.com](http://tapir.softwa Add the following dependency: ```sbt -"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.19.0-M13" ``` You'll need partial unification enabled in the compiler (alternatively, you'll need to manually provide type arguments in some cases): diff --git a/generated-doc/out/client/http4s.md b/generated-doc/out/client/http4s.md index d60517daa0..f3172301f3 100644 --- a/generated-doc/out/client/http4s.md +++ b/generated-doc/out/client/http4s.md @@ -3,7 +3,7 @@ Add the dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-http4s-client" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-http4s-client" % "0.19.0-M13" ``` To interpret an endpoint definition as an `org.http4s.Request[F]`, import: diff --git a/generated-doc/out/client/play.md b/generated-doc/out/client/play.md index ae5387b039..15c74281fb 100644 --- a/generated-doc/out/client/play.md +++ b/generated-doc/out/client/play.md @@ -3,7 +3,7 @@ Add the dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-play-client" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-play-client" % "0.19.0-M13" ``` To make requests using an endpoint definition using the [play client](https://github.com/playframework/play-ws), import: diff --git a/generated-doc/out/client/sttp.md b/generated-doc/out/client/sttp.md index 97a201efb5..d9a32aaf0a 100644 --- a/generated-doc/out/client/sttp.md +++ b/generated-doc/out/client/sttp.md @@ -3,7 +3,7 @@ Add the dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-sttp-client" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-sttp-client" % "0.19.0-M13" ``` To make requests using an endpoint definition using the [sttp client](https://github.com/softwaremill/sttp), import: @@ -57,7 +57,7 @@ In this case add the following dependencies (note the [`%%%`](https://www.scala- instead of the usual `%%`): ```scala -"com.softwaremill.sttp.tapir" %%% "tapir-sttp-client" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %%% "tapir-sttp-client" % "0.19.0-M13" "io.github.cquiroz" %%% "scala-java-time" % "2.2.0" // implementations of java.time classes for Scala.JS ``` diff --git a/generated-doc/out/docs/asyncapi.md b/generated-doc/out/docs/asyncapi.md index 3580b3fff3..6b6eff7625 100644 --- a/generated-doc/out/docs/asyncapi.md +++ b/generated-doc/out/docs/asyncapi.md @@ -3,8 +3,8 @@ To use, add the following dependencies: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-docs" % "0.19.0-M12" -"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-circe-yaml" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-docs" % "0.19.0-M13" +"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-circe-yaml" % "0.19.0-M13" ``` Tapir contains a case class-based model of the asyncapi data structures in the `asyncapi/asyncapi-model` subproject (the diff --git a/generated-doc/out/docs/openapi.md b/generated-doc/out/docs/openapi.md index 89ebab3865..241f5be7af 100644 --- a/generated-doc/out/docs/openapi.md +++ b/generated-doc/out/docs/openapi.md @@ -3,8 +3,8 @@ To use, add the following dependencies: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % "0.19.0-M12" -"com.softwaremill.sttp.tapir" %% "tapir-openapi-circe-yaml" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % "0.19.0-M13" +"com.softwaremill.sttp.tapir" %% "tapir-openapi-circe-yaml" % "0.19.0-M13" ``` Tapir contains a case class-based model of the openapi data structures in the `openapi/openapi-model` subproject (the @@ -133,8 +133,8 @@ definitions, which given the documentation in yaml format, will expose it using as a dependency either: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui" % "0.19.0-M12" -"com.softwaremill.sttp.tapir" %% "tapir-redoc" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui" % "0.19.0-M13" +"com.softwaremill.sttp.tapir" %% "tapir-redoc" % "0.19.0-M13" ``` Then, you'll need to pass the server endpoints to your server interpreter. For example, using akka-http: diff --git a/generated-doc/out/endpoint/contenttype.md b/generated-doc/out/endpoint/contenttype.md index c69f92f9e6..b706b9ecf1 100644 --- a/generated-doc/out/endpoint/contenttype.md +++ b/generated-doc/out/endpoint/contenttype.md @@ -13,8 +13,7 @@ user-provided value will override this default: ## Multiple content types -Multiple, alternative content types can be specified using `oneOf`, similarly as when specifying [status code](statuscodes.md) -mappings. +Multiple, alternative content types can be specified using [`oneOf`](oneof.md). On the server side, the appropriate mapping will be chosen using content negotiation, via the `Accept` header, using the [configurable](../server/options.md) `ContentTypeInterceptor`. Note that both the base media type, and the charset diff --git a/generated-doc/out/endpoint/integrations.md b/generated-doc/out/endpoint/integrations.md index c817ff24f4..5f69103b1b 100644 --- a/generated-doc/out/endpoint/integrations.md +++ b/generated-doc/out/endpoint/integrations.md @@ -6,7 +6,7 @@ The `tapir-cats` module contains additional instances for some [cats](https://ty datatypes as well as additional syntax: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-cats" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-cats" % "0.19.0-M13" ``` - `import sttp.tapir.integ.cats.codec._` - brings schema, validator and codec instances @@ -19,7 +19,7 @@ If you use [refined](https://github.com/fthomas/refined), the `tapir-refined` mo validators for `T Refined P` as long as a codec for `T` already exists: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-refined" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-refined" % "0.19.0-M13" ``` You'll need to extend the `sttp.tapir.codec.refined.TapirCodecRefined` @@ -40,7 +40,7 @@ The `tapir-enumeratum` module provides schemas, validators and codecs for [Enume enumerations. To use, add the following dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-enumeratum" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-enumeratum" % "0.19.0-M13" ``` Then, `import sttp.tapir.codec.enumeratum`, or extends the `sttp.tapir.codec.enumeratum.TapirCodecEnumeratum` trait. @@ -78,7 +78,7 @@ If you use [scala-newtype](https://github.com/estatico/scala-newtype), the `tapi schemas for a types with a `@newtype` and `@newsubtype` annotations as long as a codec and schema for its underlying value already exists: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-newtype" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-newtype" % "0.19.0-M13" ``` Then, `import sttp.tapir.codec.newtype._`, or extend the `sttp.tapir.codec.enumeratum.TapirCodecNewType` trait to bring the implicit values into scope. @@ -90,7 +90,7 @@ For details refer to [derevo documentation](https://github.com/tofu-tf/derevo#in To use, add the following dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-derevo" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-derevo" % "0.19.0-M13" ``` Then you can derive schema for your ADT along with other typeclasses besides ADT declaration itself: diff --git a/generated-doc/out/endpoint/ios.md b/generated-doc/out/endpoint/ios.md index 886e56237e..1bfd2ae6a2 100644 --- a/generated-doc/out/endpoint/ios.md +++ b/generated-doc/out/endpoint/ios.md @@ -25,6 +25,7 @@ For inputs, these are: For both inputs/outputs: * `header[T](name)` captures a header with the given name +* `header[T](name, value)` maps to a fixed header with the given name and value * `headers` captures all headers, represented as `List[Header]` * `cookies` captures cookies from the `Cookie` header and represents them as `List[Cookie]` * `setCookie(name)` captures the value & metadata of the a `Set-Cookie` header with a matching name @@ -219,6 +220,25 @@ To match only the root path, use an empty string: `endpoint.in("")` will match ` To match a path prefix, first define inputs which match the path prefix, and then capture any remaining part using `paths`, e.g.: `endpoint.in("api" / "download").in(paths)"`. +## Status codes + +### Arbitrary status codes + +To provide a (varying) status code of a server response, use the `statusCode` output, which maps to a value of type +`sttp.model.StatusCode`. The companion object contains known status codes as constants. This type of output is used only +when interpreting the endpoint as a server. If your endpoint returns varying status codes which you would like to have +listed in documentation use `statusCode.description(code1, "code1 description").description(code2, "code2 description")` +output. + +### Fixed status code + +A fixed status code can be specified using the `statusCode(code)` output. + +### In server interpreters + +Unless specified otherwise, successful responses are returned with the `200 OK` status code, and errors with +`400 Bad Request`. For exception and decode failure handling, see [error handling](../server/errors.md). + ## Next -Read on about [status codes](statuscodes.md). +Read on about [one-of mappings](oneof.md). diff --git a/generated-doc/out/endpoint/json.md b/generated-doc/out/endpoint/json.md index ddc0a8a4fd..48e84187fe 100644 --- a/generated-doc/out/endpoint/json.md +++ b/generated-doc/out/endpoint/json.md @@ -21,7 +21,7 @@ the json codec that is in scope. To use Circe, add the following dependency to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % "0.19.0-M13" ``` Next, import the package (or extend the `TapirJsonCirce` trait, see [MyTapir](../mytapir.md)): @@ -95,7 +95,7 @@ Now the above JSON object will render as To use µPickle add the following dependency to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-json-upickle" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-json-upickle" % "0.19.0-M13" ``` Next, import the package (or extend the `TapirJsonuPickle` trait, see [MyTapir](../mytapir.md) and add `TapirJsonuPickle` not `TapirCirceJson`): @@ -130,7 +130,7 @@ For more examples, including making a custom encoder/decoder, see [TapirJsonuPic To use Play JSON add the following dependency to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-json-play" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-json-play" % "0.19.0-M13" ``` Next, import the package (or extend the `TapirJsonPlay` trait, see [MyTapir](../mytapir.md) and add `TapirJsonPlay` not `TapirCirceJson`): @@ -146,7 +146,7 @@ Play JSON requires `Reads` and `Writes` implicit values in scope for each type y To use Spray JSON add the following dependency to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-json-spray" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-json-spray" % "0.19.0-M13" ``` Next, import the package (or extend the `TapirJsonSpray` trait, see [MyTapir](../mytapir.md) and add `TapirJsonSpray` not `TapirCirceJson`): @@ -162,7 +162,7 @@ Spray JSON requires a `JsonFormat` implicit value in scope for each type you wan To use Tethys JSON add the following dependency to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-json-tethys" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-json-tethys" % "0.19.0-M13" ``` Next, import the package (or extend the `TapirJsonTethys` trait, see [MyTapir](../mytapir.md) and add `TapirJsonTethys` not `TapirCirceJson`): @@ -178,7 +178,7 @@ Tethys JSON requires `JsonReader` and `JsonWriter` implicit values in scope for To use [Jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) add the following dependency to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-jsoniter-scala" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-jsoniter-scala" % "0.19.0-M13" ``` Next, import the package (or extend the `TapirJsonJsoniter` trait, see [MyTapir](../mytapir.md) and add `TapirJsonJsoniter` not `TapirCirceJson`): @@ -195,7 +195,7 @@ Jsoniter Scala requires `JsonValueCodec` implicit value in scope for each type y To use [json4s](https://github.com/json4s/json4s) add the following dependencies to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-json-json4s" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-json-json4s" % "0.19.0-M13" ``` And one of the implementations: @@ -226,7 +226,7 @@ implicit val formats: Formats = org.json4s.jackson.Serialization.formats(NoTypeH To use Zio JSON, add the following dependency to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-json-zio" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-json-zio" % "0.19.0-M13" ``` Next, import the package (or extend the `TapirJsonZio` trait, see [MyTapir](../mytapir.md) and add `TapirJsonZio` instead of `TapirCirceJson`): diff --git a/generated-doc/out/endpoint/oneof.md b/generated-doc/out/endpoint/oneof.md new file mode 100644 index 0000000000..6543d59859 --- /dev/null +++ b/generated-doc/out/endpoint/oneof.md @@ -0,0 +1,125 @@ +# One-of mappings + +Outputs with multiple variants can be specified using the `oneOf` output. Each variant is defined using a one-of +mapping. All possible outputs must have a common supertype. Typically, the supertype is a sealed trait, and the mappings +are implementing case classes. + +Each one-of mapping needs an `appliesTo` function to determine at run-time, if the variant should be used for a given +value. This function is inferred at compile time when using `oneOfMapping`, but can also be provided by hand, or if +the compile-time inference fails, using one of the other factory methods (see below). A catch-all mapping can be defined +using `oneOfDefaultMapping`, and should be placed as the last mapping in the list of possible variants. + +When encoding such an output to a response, the first matching output is chosen, using the following rules: +1. the mappings `appliesTo` method, applied to the output value (as returned by the server logic) must return `true`. +2. when a fixed content type is specified by the output, it must match the request's `Accept` header (if present). + This implements content negotiation. + +When decoding from a response, the first output which decodes successfully is chosen. + +The outputs might vary in status codes, headers (e.g. different content types), and body implementations. However, for +bodies, only replayable ones can be used, and they need to have the same raw representation (e.g. all byte-array-base, +or all file-based). + +Note that exhaustiveness of the mappings (that all subtypes of `T` are covered) is not checked. + +For example, below is a specification for an endpoint where the error output is a sealed trait `ErrorInfo`; +such a specification can then be refined and reused for other endpoints: + +```scala +import sttp.tapir._ +import sttp.tapir.json.circe._ +import sttp.tapir.generic.auto._ +import sttp.model.StatusCode +import io.circe.generic.auto._ + +sealed trait ErrorInfo +case class NotFound(what: String) extends ErrorInfo +case class Unauthorized(realm: String) extends ErrorInfo +case class Unknown(code: Int, msg: String) extends ErrorInfo +case object NoContent extends ErrorInfo + +// here we are defining an error output, but the same can be done for regular outputs +val baseEndpoint = endpoint.errorOut( + oneOf[ErrorInfo]( + oneOfMapping(statusCode(StatusCode.NotFound).and(jsonBody[NotFound].description("not found"))), + oneOfMapping(statusCode(StatusCode.Unauthorized.and(jsonBody[Unauthorized].description("unauthorized")))), + oneOfMapping(statusCode(StatusCode.NoContent.and(emptyOutputAs(NoContent)))), + oneOfDefaultMapping(jsonBody[Unknown].description("unknown")) + ) +) +``` + +## One-of-mapping and type erasure + +Type erasure may prevent a one-of-mapping from working properly. The following example will fail at compile time because `Right[NotFound]` and `Right[BadRequest]` will become `Right[Any]`: + +```scala +import sttp.tapir._ +import sttp.tapir.json.circe._ +import sttp.tapir.generic.auto._ +import sttp.model.StatusCode +import io.circe.generic.auto._ + +case class ServerError(what: String) + +sealed trait UserError +case class BadRequest(what: String) extends UserError +case class NotFound(what: String) extends UserError + +val baseEndpoint = endpoint.errorOut( + oneOf[Either[ServerError, UserError]]( + oneOfMapping(StatusCode.NotFound, jsonBody[Right[ServerError, NotFound]].description("not found")), + oneOfMapping(StatusCode.BadRequest, jsonBody[Right[ServerError, BadRequest]].description("unauthorized")), + oneOfMapping(StatusCode.InternalServerError, jsonBody[Left[ServerError, UserError]].description("unauthorized")), + ) +) +// error: Constructing oneOfMapping of type scala.util.Right[repl.MdocSession.App.ServerError,repl.MdocSession.App.NotFound] is not allowed because of type erasure. Using a runtime-class-based check it isn't possible to verify that the input matches the desired class. Please use oneOfMappingClassMatcher, oneOfMappingValueMatcher or oneOfMappingFromMatchType instead +// oneOfMappingValueMatcher(StatusCode.NotFound, jsonBody[Right[ServerError, NotFound]].description("not found")) { +// ^ +// error: Constructing oneOfMapping of type scala.util.Right[repl.MdocSession.App.ServerError,repl.MdocSession.App.BadRequest] is not allowed because of type erasure. Using a runtime-class-based check it isn't possible to verify that the input matches the desired class. Please use oneOfMappingClassMatcher, oneOfMappingValueMatcher or oneOfMappingFromMatchType instead +// oneOfMappingValueMatcher(StatusCode.BadRequest, jsonBody[Right[ServerError, BadRequest]].description("unauthorized")) { +// ^ +// error: Constructing oneOfMapping of type scala.util.Left[repl.MdocSession.App.ServerError,repl.MdocSession.App.UserError] is not allowed because of type erasure. Using a runtime-class-based check it isn't possible to verify that the input matches the desired class. Please use oneOfMappingClassMatcher, oneOfMappingValueMatcher or oneOfMappingFromMatchType instead +// oneOfMappingValueMatcher(StatusCode.InternalServerError, jsonBody[Left[ServerError, UserError]].description("unauthorized")) { +// ^ +``` + +The solution is therefore to handwrite a function checking that a value (of type `Any`) is of the correct type: + + +```scala +val baseEndpoint = endpoint.errorOut( + oneOf[Either[ServerError, UserError]]( + oneOfMappingValueMatcher(StatusCode.NotFound, jsonBody[Right[ServerError, NotFound]].description("not found")) { + case Right(NotFound(_)) => true + }, + oneOfMappingValueMatcher(StatusCode.BadRequest, jsonBody[Right[ServerError, BadRequest]].description("unauthorized")) { + case Right(BadRequest(_)) => true + }, + oneOfMappingValueMatcher(StatusCode.InternalServerError, jsonBody[Left[ServerError, UserError]].description("unauthorized")) { + case Left(ServerError(_)) => true + } + ) +) +``` + +Of course, you could use `oneOfMappingValueMatcher` to do runtime filtering for other purpose than solving type erasure. + +In the case of solving type erasure, writing by hand partial function to match value against composition of case class and sealed trait can be repetitive. +To make that more easy, we provide an **experimental** typeclass - `MatchType` - so you can automatically derive that partial function: + +```scala +import sttp.tapir.typelevel.MatchType + +val baseEndpoint = endpoint.errorOut( + oneOf[Either[ServerError, UserError]]( + oneOfMappingFromMatchType(StatusCode.NotFound, jsonBody[Right[ServerError, NotFound]].description("not found")), + oneOfMappingFromMatchType(StatusCode.BadRequest, jsonBody[Right[ServerError, BadRequest]].description("unauthorized")), + oneOfMappingFromMatchType(StatusCode.InternalServerError, jsonBody[Left[ServerError, UserError]].description("unauthorized")) + ) +) +``` + +## Next + +Read on about [codecs](codecs.md). diff --git a/generated-doc/out/endpoint/schemas.md b/generated-doc/out/endpoint/schemas.md index 78a6211b9c..51725edbf8 100644 --- a/generated-doc/out/endpoint/schemas.md +++ b/generated-doc/out/endpoint/schemas.md @@ -155,6 +155,7 @@ field of a case class. One way the automatic & semi-automatic derivation can be * `@encodedExample` sets example value for a case class field which is used in the documentation in the encoded form * `@format` sets the format for a case class field * `@deprecated` marks a case class's field as deprecated +* `@validate` will add the given validator to a case class field These annotations will adjust schemas, after they are looked up using the normal implicit mechanisms. diff --git a/generated-doc/out/generator/sbt-openapi-codegen.md b/generated-doc/out/generator/sbt-openapi-codegen.md index 38ee654181..3e129e9461 100644 --- a/generated-doc/out/generator/sbt-openapi-codegen.md +++ b/generated-doc/out/generator/sbt-openapi-codegen.md @@ -11,7 +11,7 @@ Add the sbt plugin to the `project/plugins.sbt`: ```scala -addSbtPlugin("com.softwaremill.sttp.tapir" % "sbt-openapi-codegen" % "0.19.0-M12") +addSbtPlugin("com.softwaremill.sttp.tapir" % "sbt-openapi-codegen" % "0.19.0-M13") ``` Enable the plugin for your project in the `build.sbt`: diff --git a/generated-doc/out/quickstart.md b/generated-doc/out/quickstart.md index 67624c1902..f91086cfee 100644 --- a/generated-doc/out/quickstart.md +++ b/generated-doc/out/quickstart.md @@ -3,7 +3,7 @@ To use tapir, add the following dependency to your project: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.19.0-M13" ``` This will import only the core classes needed to create endpoint descriptions. To generate a server or a client, you diff --git a/generated-doc/out/server/akkahttp.md b/generated-doc/out/server/akkahttp.md index 2e66f33932..60a4509950 100644 --- a/generated-doc/out/server/akkahttp.md +++ b/generated-doc/out/server/akkahttp.md @@ -4,14 +4,14 @@ To expose an endpoint as an [akka-http](https://doc.akka.io/docs/akka-http/curre dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.19.0-M13" ``` This will transitively pull some Akka modules in version 2.6. If you want to force your own Akka version (for example 2.5), use sbt exclusion. Mind the Scala version in artifact name: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.19.0-M12" exclude("com.typesafe.akka", "akka-stream_2.12") +"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.19.0-M13" exclude("com.typesafe.akka", "akka-stream_2.12") ``` Now import the object: diff --git a/generated-doc/out/server/aws.md b/generated-doc/out/server/aws.md index c2cd35842b..cdec1da7ad 100644 --- a/generated-doc/out/server/aws.md +++ b/generated-doc/out/server/aws.md @@ -13,7 +13,7 @@ To implement the Lambda function, a server interpreter is available, which takes Currently, only an interpreter integrating with cats-effect is available (`AwsCatsEffectServerInterpreter`). To use, add the following dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-aws-lambda" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-aws-lambda" % "0.19.0-M13" ``` To configure API Gateway and the Lambda function, you can use: @@ -24,8 +24,8 @@ To configure API Gateway and the Lambda function, you can use: Add one of the following dependencies: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-aws-sam" % "0.19.0-M12" -"com.softwaremill.sttp.tapir" %% "tapir-aws-terraform" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-aws-sam" % "0.19.0-M13" +"com.softwaremill.sttp.tapir" %% "tapir-aws-terraform" % "0.19.0-M13" ``` ## Examples diff --git a/generated-doc/out/server/finatra.md b/generated-doc/out/server/finatra.md index 4636adf1ef..b42317aa71 100644 --- a/generated-doc/out/server/finatra.md +++ b/generated-doc/out/server/finatra.md @@ -4,7 +4,7 @@ To expose an endpoint as an [finatra](https://twitter.github.io/finatra/) server dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-finatra-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-finatra-server" % "0.19.0-M13" ``` and import the object: @@ -16,7 +16,7 @@ import sttp.tapir.server.finatra.FinatraServerInterpreter or if you would like to use cats-effect project, you can add the following dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-finatra-server-cats" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-finatra-server-cats" % "0.19.0-M13" ``` and import the object: diff --git a/generated-doc/out/server/http4s.md b/generated-doc/out/server/http4s.md index 207115b496..f37de514fc 100644 --- a/generated-doc/out/server/http4s.md +++ b/generated-doc/out/server/http4s.md @@ -4,7 +4,7 @@ To expose an endpoint as an [http4s](https://http4s.org) server, first add the f dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % "0.19.0-M13" ``` and import the object: diff --git a/generated-doc/out/server/logic.md b/generated-doc/out/server/logic.md index c15f6f096d..9e95698981 100644 --- a/generated-doc/out/server/logic.md +++ b/generated-doc/out/server/logic.md @@ -216,4 +216,4 @@ variants of the methods, which recover errors from failed effects: `serverLogicP ## Status codes By default, successful responses are returned with the `200 OK` status code, and errors with `400 Bad Request`. However, -this can be customised by specifying how an [output maps to the status code](../endpoint/statuscodes.md). +this can be customised by using a [status code output](../endpoint/ios.md). diff --git a/generated-doc/out/server/netty.md b/generated-doc/out/server/netty.md index 1ef59b0bb2..35820d9a3b 100644 --- a/generated-doc/out/server/netty.md +++ b/generated-doc/out/server/netty.md @@ -5,7 +5,7 @@ To expose an endpoint using a [Netty](https://netty.io)-based server, first add the following dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-netty-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-netty-server" % "0.19.0-M13" ``` Then, use: diff --git a/generated-doc/out/server/observability.md b/generated-doc/out/server/observability.md index afa0324809..bc1b2e7f8d 100644 --- a/generated-doc/out/server/observability.md +++ b/generated-doc/out/server/observability.md @@ -49,7 +49,7 @@ val labels = MetricLabels( Add the following dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-prometheus-metrics" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-prometheus-metrics" % "0.19.0-M13" ``` `PrometheusMetrics` encapsulates `CollectorReqistry` and `Metric` instances. It provides several ready to use metrics as @@ -124,7 +124,7 @@ val prometheusMetrics = PrometheusMetrics[Future]("tapir", CollectorRegistry.def Add the following dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-opentelemetry-metrics" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-opentelemetry-metrics" % "0.19.0-M13" ``` OpenTelemetry metrics are vendor-agnostic and can be exported using one diff --git a/generated-doc/out/server/play.md b/generated-doc/out/server/play.md index da5e4e973a..3902535eac 100644 --- a/generated-doc/out/server/play.md +++ b/generated-doc/out/server/play.md @@ -3,7 +3,7 @@ To expose endpoint as a [play-server](https://www.playframework.com/) first add the following dependencies: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-play-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-play-server" % "0.19.0-M13" ``` and (if you don't already depend on Play) diff --git a/generated-doc/out/server/vertx.md b/generated-doc/out/server/vertx.md index 1bbdb1ac07..028860e780 100644 --- a/generated-doc/out/server/vertx.md +++ b/generated-doc/out/server/vertx.md @@ -8,7 +8,7 @@ Vert.x interpreter can be used with different effect systems (cats-effect, ZIO) Add the following dependency ```scala -"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.19.0-M13" ``` to use this interpreter with `Future`. @@ -81,7 +81,7 @@ It's also possible to define an endpoint together with the server logic in a sin Add the following dependency ```scala -"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.19.0-M13" "com.softwaremill.sttp.shared" %% "fs2" % "LatestVersion" ``` to use this interpreter with Cats Effect typeclasses. @@ -164,7 +164,7 @@ val attach = VertxCatsServerInterpreter(dispatcher).route(streamedResponse) { ke Add the following dependency ```scala -"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.19.0-M13" "com.softwaremill.sttp.shared" %% "zio" % "LatestVersion" ``` to use this interpreter with ZIO. diff --git a/generated-doc/out/server/zio-http4s.md b/generated-doc/out/server/zio-http4s.md index 352909acd3..7d2379198d 100644 --- a/generated-doc/out/server/zio-http4s.md +++ b/generated-doc/out/server/zio-http4s.md @@ -7,13 +7,13 @@ exposing the endpoints using the [http4s](https://http4s.org) server. You'll need the following dependency for the `ZServerEndpoint` type alias and helper classes: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-zio" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-zio" % "0.19.0-M13" ``` or just add the zio-http4s integration which already depends on `tapir-zio`: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-zio-http4s-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-zio-http4s-server" % "0.19.0-M13" ``` Next, instead of the usual `import sttp.tapir._`, you should import (or extend the `ZTapir` trait, see [MyTapir](../mytapir.md)): diff --git a/generated-doc/out/server/ziohttp.md b/generated-doc/out/server/ziohttp.md index 0c293fa16e..bf2cb8c515 100644 --- a/generated-doc/out/server/ziohttp.md +++ b/generated-doc/out/server/ziohttp.md @@ -7,13 +7,13 @@ exposing the endpoints using the [ZIO Http](https://github.com/dream11/zio-http) You'll need the following dependency for the `ZServerEndpoint` type alias and helper classes: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-zio" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-zio" % "0.19.0-M13" ``` or just add the zio-http integration which already depends on `tapir-zio`: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-zio-http" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-zio-http" % "0.19.0-M13" ``` Next, instead of the usual `import sttp.tapir._`, you should import (or extend the `ZTapir` trait, see [MyTapir](../mytapir.md)): diff --git a/generated-doc/out/testing.md b/generated-doc/out/testing.md index a7135a4309..e82cda7d54 100644 --- a/generated-doc/out/testing.md +++ b/generated-doc/out/testing.md @@ -12,7 +12,7 @@ details on how the stub works). Add the dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % "0.19.0-M13" ``` And the following imports: @@ -79,7 +79,7 @@ with [mock-server](https://www.mock-server.com/) Add the following dependency: ```scala -"com.softwaremill.sttp.tapir" %% "tapir-sttp-mock-server" % "0.19.0-M12" +"com.softwaremill.sttp.tapir" %% "tapir-sttp-mock-server" % "0.19.0-M13" ``` Imports: @@ -168,7 +168,7 @@ Results in: ```scala res.toString -// res2: String = "Set(GET /x, is shadowed by: GET /x /..., GET /x /y /x, is shadowed by: GET /x /...)" +// res2: String = "Set(GET /x /y /x, is shadowed by: GET /x /..., GET /x, is shadowed by: GET /x /...)" ``` Example 2: