Skip to content

Commit 5994d57

Browse files
committed
Release 0.18.0-M2
1 parent 15f4c62 commit 5994d57

19 files changed

+61
-44
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ tapir documentation is available at [tapir.softwaremill.com](http://tapir.softwa
9191
Add the following dependency:
9292

9393
```sbt
94-
"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.18.0-M1"
94+
"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.18.0-M2"
9595
```
9696

9797
You'll need partial unification enabled in the compiler (alternatively, you'll need to manually provide type arguments in some cases):

generated-doc/out/client/http4s.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Add the dependency:
44

55
```scala
6-
"com.softwaremill.sttp.tapir" %% "tapir-http4s-client" % "0.18.0-M1"
6+
"com.softwaremill.sttp.tapir" %% "tapir-http4s-client" % "0.18.0-M2"
77
```
88

99
To interpret an endpoint definition as an `org.http4s.Request[F]`, import:

generated-doc/out/client/play.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Add the dependency:
44

55
```scala
6-
"com.softwaremill.sttp.tapir" %% "tapir-play-client" % "0.18.0-M1"
6+
"com.softwaremill.sttp.tapir" %% "tapir-play-client" % "0.18.0-M2"
77
```
88

99
To make requests using an endpoint definition using the [play client](https://github.com/playframework/play-ws), import:

generated-doc/out/client/sttp.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Add the dependency:
44

55
```scala
6-
"com.softwaremill.sttp.tapir" %% "tapir-sttp-client" % "0.18.0-M1"
6+
"com.softwaremill.sttp.tapir" %% "tapir-sttp-client" % "0.18.0-M2"
77
```
88

99
To make requests using an endpoint definition using the [sttp client](https://github.com/softwaremill/sttp), import:

generated-doc/out/docs/asyncapi.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
To use, add the following dependencies:
44

55
```scala
6-
"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-docs" % "0.18.0-M1"
7-
"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-circe-yaml" % "0.18.0-M1"
6+
"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-docs" % "0.18.0-M2"
7+
"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-circe-yaml" % "0.18.0-M2"
88
```
99

1010
Tapir contains a case class-based model of the asyncapi data structures in the `asyncapi/asyncapi-model` subproject (the
@@ -68,6 +68,10 @@ Options can be customised by providing an implicit instance of `AsyncAPIDocsOpti
6868
* `subscribeOperationId`: basing on the endpoint's path and the entire endpoint, determines the id of the subscribe
6969
operation. This can be later used by code generators as the name of the method to receive messages from the socket.
7070
* `publishOperationId`: as above, but for publishing (sending messages to the web socket).
71+
* `referenceEnums`: defines if enums should be converted to async api components and referenced later.
72+
This option can be applied to all enums in the schema, or only specific ones.
73+
`SObjectInfo` input parameter is a unique identifier of object in the schema.
74+
By default, it is fully qualified name of the class (when using `Validator.derivedEnum` or implicits from `sttp.tapir.codec.enumeratum._`).
7175

7276
## Exposing AsyncAPI documentation
7377

generated-doc/out/docs/openapi.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
To use, add the following dependencies:
55

66
```scala
7-
"com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % "0.18.0-M1"
8-
"com.softwaremill.sttp.tapir" %% "tapir-openapi-circe-yaml" % "0.18.0-M1"
7+
"com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % "0.18.0-M2"
8+
"com.softwaremill.sttp.tapir" %% "tapir-openapi-circe-yaml" % "0.18.0-M2"
99
```
1010

1111
Tapir contains a case class-based model of the openapi data structures in the `openapi/openapi-model` subproject (the
@@ -72,6 +72,10 @@ Options can be customised by providing an implicit instance of `OpenAPIDocsOptio
7272
* `operationIdGenerator`: each endpoint corresponds to an operation in the OpenAPI format and should have a unique
7373
operation id. By default, the `name` of endpoint is used as the operation id, and if this is not available, the
7474
operation id is auto-generated by concatenating (using camel-case) the request method and path.
75+
* `referenceEnums`: defines if enums should be converted to open api components and referenced later.
76+
This option can be applied to all enums in the schema, or only specific ones.
77+
`SObjectInfo` input parameter is a unique identifier of object in the schema.
78+
By default, it is fully qualified name of the class (when using `Validator.derivedEnum` or implicits from `sttp.tapir.codec.enumeratum._`).
7579

7680
## Exposing OpenAPI documentation
7781

@@ -81,29 +85,29 @@ akka-http/http4s routes for exposing documentation using [Swagger UI](https://sw
8185

8286
```scala
8387
// Akka HTTP
84-
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-akka-http" % "0.18.0-M1"
85-
"com.softwaremill.sttp.tapir" %% "tapir-redoc-akka-http" % "0.18.0-M1"
88+
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-akka-http" % "0.18.0-M2"
89+
"com.softwaremill.sttp.tapir" %% "tapir-redoc-akka-http" % "0.18.0-M2"
8690

8791
// Finatra
88-
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-finatra" % "0.18.0-M1"
92+
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-finatra" % "0.18.0-M2"
8993

9094
// HTTP4S
91-
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-http4s" % "0.18.0-M1"
92-
"com.softwaremill.sttp.tapir" %% "tapir-redoc-http4s" % "0.18.0-M1"
95+
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-http4s" % "0.18.0-M2"
96+
"com.softwaremill.sttp.tapir" %% "tapir-redoc-http4s" % "0.18.0-M2"
9397

9498
// Play
95-
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-play" % "0.18.0-M1"
96-
"com.softwaremill.sttp.tapir" %% "tapir-redoc-play" % "0.18.0-M1"
99+
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-play" % "0.18.0-M2"
100+
"com.softwaremill.sttp.tapir" %% "tapir-redoc-play" % "0.18.0-M2"
97101

98102
// Vert.x
99-
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-vertx" % "0.18.0-M1"
103+
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-vertx" % "0.18.0-M2"
100104
```
101105

102106
Note: `tapir-swagger-ui-akka-http` transitively pulls some Akka modules in version 2.6. If you want to force
103107
your own Akka version (for example 2.5), use sbt exclusion. Mind the Scala version in artifact name:
104108

105109
```scala
106-
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-akka-http" % "0.18.0-M1" exclude("com.typesafe.akka", "akka-stream_2.12")
110+
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-akka-http" % "0.18.0-M2" exclude("com.typesafe.akka", "akka-stream_2.12")
107111
```
108112

109113
Usage example for akka-http:

generated-doc/out/endpoint/integrations.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The `tapir-cats` module contains additional instances for some [cats](https://ty
66
datatypes as well as additional syntax:
77

88
```scala
9-
"com.softwaremill.sttp.tapir" %% "tapir-cats" % "0.18.0-M1"
9+
"com.softwaremill.sttp.tapir" %% "tapir-cats" % "0.18.0-M2"
1010
```
1111

1212
- `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
1919
validators for `T Refined P` as long as a codec for `T` already exists:
2020

2121
```scala
22-
"com.softwaremill.sttp.tapir" %% "tapir-refined" % "0.18.0-M1"
22+
"com.softwaremill.sttp.tapir" %% "tapir-refined" % "0.18.0-M2"
2323
```
2424

2525
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
4040
enumerations. To use, add the following dependency:
4141

4242
```scala
43-
"com.softwaremill.sttp.tapir" %% "tapir-enumeratum" % "0.18.0-M1"
43+
"com.softwaremill.sttp.tapir" %% "tapir-enumeratum" % "0.18.0-M2"
4444
```
4545

4646
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
7878
schemas for a types with a `@newtype` and `@newsubtype` annotations as long as a codec and schema for its underlying value already exists:
7979

8080
```scala
81-
"com.softwaremill.sttp.tapir" %% "tapir-newtype" % "0.18.0-M1"
81+
"com.softwaremill.sttp.tapir" %% "tapir-newtype" % "0.18.0-M2"
8282
```
8383

8484
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
9090
To use, add the following dependency:
9191

9292
```scala
93-
"com.softwaremill.sttp.tapir" %% "tapir-derevo" % "0.18.0-M1"
93+
"com.softwaremill.sttp.tapir" %% "tapir-derevo" % "0.18.0-M2"
9494
```
9595

9696
Then you can derive schema for your ADT along with other typeclasses besides ADT declaration itself:

generated-doc/out/endpoint/json.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ the json codec that is in scope.
1919
To use Circe, add the following dependency to your project:
2020

2121
```scala
22-
"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % "0.18.0-M1"
22+
"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % "0.18.0-M2"
2323
```
2424

2525
Next, import the package (or extend the `TapirJsonCirce` trait, see [MyTapir](../mytapir.md)):
@@ -93,7 +93,7 @@ Now the above JSON object will render as
9393
To use µPickle add the following dependency to your project:
9494

9595
```scala
96-
"com.softwaremill.sttp.tapir" %% "tapir-json-upickle" % "0.18.0-M1"
96+
"com.softwaremill.sttp.tapir" %% "tapir-json-upickle" % "0.18.0-M2"
9797
```
9898

9999
Next, import the package (or extend the `TapirJsonuPickle` trait, see [MyTapir](../mytapir.md) and add `TapirJsonuPickle` not `TapirCirceJson`):
@@ -128,7 +128,7 @@ For more examples, including making a custom encoder/decoder, see [TapirJsonuPic
128128
To use Play JSON add the following dependency to your project:
129129

130130
```scala
131-
"com.softwaremill.sttp.tapir" %% "tapir-json-play" % "0.18.0-M1"
131+
"com.softwaremill.sttp.tapir" %% "tapir-json-play" % "0.18.0-M2"
132132
```
133133

134134
Next, import the package (or extend the `TapirJsonPlay` trait, see [MyTapir](../mytapir.md) and add `TapirJsonPlay` not `TapirCirceJson`):
@@ -144,7 +144,7 @@ Play JSON requires `Reads` and `Writes` implicit values in scope for each type y
144144
To use Spray JSON add the following dependency to your project:
145145

146146
```scala
147-
"com.softwaremill.sttp.tapir" %% "tapir-json-spray" % "0.18.0-M1"
147+
"com.softwaremill.sttp.tapir" %% "tapir-json-spray" % "0.18.0-M2"
148148
```
149149

150150
Next, import the package (or extend the `TapirJsonSpray` trait, see [MyTapir](../mytapir.md) and add `TapirJsonSpray` not `TapirCirceJson`):
@@ -160,7 +160,7 @@ Spray JSON requires a `JsonFormat` implicit value in scope for each type you wan
160160
To use Tethys JSON add the following dependency to your project:
161161

162162
```scala
163-
"com.softwaremill.sttp.tapir" %% "tapir-json-tethys" % "0.18.0-M1"
163+
"com.softwaremill.sttp.tapir" %% "tapir-json-tethys" % "0.18.0-M2"
164164
```
165165

166166
Next, import the package (or extend the `TapirJsonTethys` trait, see [MyTapir](../mytapir.md) and add `TapirJsonTethys` not `TapirCirceJson`):
@@ -176,7 +176,7 @@ Tethys JSON requires `JsonReader` and `JsonWriter` implicit values in scope for
176176
To use [Jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) add the following dependency to your project:
177177

178178
```scala
179-
"com.softwaremill.sttp.tapir" %% "tapir-jsoniter-scala" % "0.18.0-M1"
179+
"com.softwaremill.sttp.tapir" %% "tapir-jsoniter-scala" % "0.18.0-M2"
180180
```
181181

182182
Next, import the package (or extend the `TapirJsonJsoniter` trait, see [MyTapir](../mytapir.md) and add `TapirJsonJsoniter` not `TapirCirceJson`):
@@ -193,7 +193,7 @@ Jsoniter Scala requires `JsonValueCodec` implicit value in scope for each type y
193193
To use [json4s](https://github.com/json4s/json4s) add the following dependencies to your project:
194194

195195
```scala
196-
"com.softwaremill.sttp.tapir" %% "tapir-json4s" % "0.18.0-M1"
196+
"com.softwaremill.sttp.tapir" %% "tapir-json4s" % "0.18.0-M2"
197197
```
198198

199199
And one of the implementations:

generated-doc/out/endpoint/validation.md

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ val e = endpoint.in(
3232
.validate(Validator.max(100)))
3333
```
3434

35+
For optional/iterable inputs/outputs, to validate the contained value(s), use:
36+
37+
```scala
38+
import sttp.tapir._
39+
40+
query[Option[Int]]("item").validateOption(Validator.min(0))
41+
query[List[Int]]("item").validateIterable(Validator.min(0)) // validates each repeated parameter
42+
```
43+
3544
Validation rules added using the built-in validators are translated to [OpenAPI](../docs/openapi.md) documentation.
3645

3746
## Validation rules and automatic codec derivation

generated-doc/out/endpoint/zio.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ exposing the endpoints using the [http4s](https://http4s.org) server.
77
You'll need the following dependencies:
88

99
```scala
10-
"com.softwaremill.sttp.tapir" %% "tapir-zio" % "0.18.0-M1"
11-
"com.softwaremill.sttp.tapir" %% "tapir-zio-http4s-server" % "0.18.0-M1"
10+
"com.softwaremill.sttp.tapir" %% "tapir-zio" % "0.18.0-M2"
11+
"com.softwaremill.sttp.tapir" %% "tapir-zio-http4s-server" % "0.18.0-M2"
1212
```
1313

1414
Next, instead of the usual `import sttp.tapir._`, you should import:

generated-doc/out/generator/sbt-openapi-codegen.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Add the sbt plugin to the `project/plugins.sbt`:
1212

1313
```scala
14-
addSbtPlugin("com.softwaremill.sttp.tapir" % "sbt-openapi-codegen" % "0.18.0-M1")
14+
addSbtPlugin("com.softwaremill.sttp.tapir" % "sbt-openapi-codegen" % "0.18.0-M2")
1515
```
1616

1717
Enable the plugin for your project in the `build.sbt`:

generated-doc/out/quickstart.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
To use tapir, add the following dependency to your project:
44

55
```scala
6-
"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.18.0-M1"
6+
"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.18.0-M2"
77
```
88

99
This will import only the core classes needed to create endpoint descriptions. To generate a server or a client, you

generated-doc/out/server/akkahttp.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ To expose an endpoint as an [akka-http](https://doc.akka.io/docs/akka-http/curre
44
dependency:
55

66
```scala
7-
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.18.0-M1"
7+
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.18.0-M2"
88
```
99

1010
This will transitively pull some Akka modules in version 2.6. If you want to force
1111
your own Akka version (for example 2.5), use sbt exclusion. Mind the Scala version in artifact name:
1212

1313
```scala
14-
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.18.0-M1" exclude("com.typesafe.akka", "akka-stream_2.12")
14+
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.18.0-M2" exclude("com.typesafe.akka", "akka-stream_2.12")
1515
```
1616

1717
Now import the object:

generated-doc/out/server/finatra.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ To expose an endpoint as an [finatra](https://twitter.github.io/finatra/) server
44
dependency:
55

66
```scala
7-
"com.softwaremill.sttp.tapir" %% "tapir-finatra-server" % "0.18.0-M1"
7+
"com.softwaremill.sttp.tapir" %% "tapir-finatra-server" % "0.18.0-M2"
88
```
99

1010
and import the object:
@@ -16,7 +16,7 @@ import sttp.tapir.server.finatra.FinatraServerInterpreter
1616
or if you would like to use cats-effect project, you can add the following dependency:
1717

1818
```scala
19-
"com.softwaremill.sttp.tapir" %% "tapir-finatra-server-cats" % "0.18.0-M1"
19+
"com.softwaremill.sttp.tapir" %% "tapir-finatra-server-cats" % "0.18.0-M2"
2020
```
2121

2222
and import the object:

generated-doc/out/server/http4s.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ To expose an endpoint as an [http4s](https://http4s.org) server, first add the f
44
dependency:
55

66
```scala
7-
"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % "0.18.0-M1"
7+
"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % "0.18.0-M2"
88
```
99

1010
and import the object:

generated-doc/out/server/logic.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def auth(token: String): Future[Either[Int, User]] = Future {
130130
else Left(1001) // error code
131131
}
132132

133-
val secureEndpoint: PartialServerEndpoint[User, Unit, Int, Unit, Any, Future] = endpoint
133+
val secureEndpoint: PartialServerEndpoint[String, User, Unit, Int, Unit, Any, Future] = endpoint
134134
.in(header[String]("X-AUTH-TOKEN"))
135135
.errorOut(plainBody[Int])
136136
.serverLogicForCurrent(auth)

generated-doc/out/server/play.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
To expose endpoint as a [play-server](https://www.playframework.com/) first add the following dependencies:
44

55
```scala
6-
"com.softwaremill.sttp.tapir" %% "tapir-play-server" % "0.18.0-M1"
6+
"com.softwaremill.sttp.tapir" %% "tapir-play-server" % "0.18.0-M2"
77
```
88

99
and (if you don't already depend on Play)

generated-doc/out/server/vertx.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Vert.x interpreter can be used with different effect systems (cats-effect, ZIO)
88

99
Add the following dependency
1010
```scala
11-
"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.18.0-M1"
11+
"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.18.0-M2"
1212
```
1313
to use this interpreter with `Future`.
1414

@@ -80,7 +80,7 @@ It's also possible to define an endpoint together with the server logic in a sin
8080

8181
Add the following dependency
8282
```scala
83-
"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.18.0-M1"
83+
"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.18.0-M2"
8484
"com.softwaremill.sttp.shared" %% "fs2" % "LatestVersion"
8585
```
8686
to use this interpreter with Cats Effect typeclasses.
@@ -155,7 +155,7 @@ val attach = route(streamedResponse) { key =>
155155

156156
Add the following dependency
157157
```scala
158-
"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.18.0-M1"
158+
"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.18.0-M2"
159159
"com.softwaremill.sttp.shared" %% "zio" % "LatestVersion"
160160
```
161161
to use this interpreter with ZIO.

generated-doc/out/testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ details on how the stub works).
1212
Add the dependency:
1313

1414
```scala
15-
"com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % "0.18.0-M1"
15+
"com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % "0.18.0-M2"
1616
```
1717

1818
And the following imports:

0 commit comments

Comments
 (0)