v0.17.0
Breaking changes
- Compatibility with sttp3. The 4th type parameter of
Endpoint
(and also the last type parameter ofServerEndpoint
) changed from containing the supported stream type orNothing, to a combination of supported capabilities (which can include: streaming and web sockets support) or
Any`. See softwaremill/sttp#610 for more information on the design of the capabilities system. This means that the type of the default endpoint is now:
val endpoint: Endpoint[Unit, Unit, Unit, Any]
-
instead of
Endpoint[Unit, Unit, Unit, Nothing]
. How to migrate?- replace usages of
Nothing
withAny
in endpoint types - instead stream types, e.g.
Endpoint[I, E, O, Source[ByteString, Any]]
, use the capability:Endpoint[I, E, O, AkkaStreams]
- replace usages of
-
the signature of
streamBody
changed slightly. The first parameter now needs to be the companion object for the stream capability (e.g.AkkaStreams
,Fs2Streams
,ZioStreams
). -
Schema
derivation is configurable, either automatic derivation (which was the default before) or semi-automatic derivation can be used. See the docs. How to migrate? Add an explicit import:
import sttp.tapir.generic.auto._
in the source files where an implicit Schema
can no longer be found. You can also use the SchemaDerivation
mixin.
- Validators are now part of schemas.
Validator
values are no longer looked up as implicit values, but instead should be added to schemas. How to migrate? If you had animplicit
validator instance for a custom type, you'll need to modify the schema to add it; take a look at schema customisation in the docs to see how to customise derived schemas. For example:
implicit def schemaForColor: Schema[Color] = Schema.string
.validate(Validator.enum(List(Blue, Red), { c => Some(plainCodecForColor.encode(c)) }))
New features
- client interpreter for Scala.JS
- web sockets
- play client interpreter
- endpoints from annotations
- configurable coproduct schema derivation
- sbt codegen plugin
Credits
@danilbykov @mszczygiel @tg44 @sbrunk @erikvanoosten @adamw @jan0sch @erikvanoosten @kciesielski @andyczerwonka @CucumisSativus @gaeljw @johnspade @ghostbuster91
(in random order) Thank you!
What next?
Vote on the issue you'd like to see resolved (yes, we're looking at the 👍 that you are leaving there :) ).
And more generally ... let us know where you'd like to see Scala headed in the Scala developer survey - thanks!