github softwaremill/tapir v0.17.0

latest releases: v1.11.5, v1.11.4, v1.11.3...
3 years ago

Breaking changes

  • Compatibility with sttp3. The 4th type parameter of Endpoint (and also the last type parameter of ServerEndpoint) changed from containing the supported stream type or Nothing, 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 with Any in endpoint types
    • instead stream types, e.g. Endpoint[I, E, O, Source[ByteString, Any]], use the capability: Endpoint[I, E, O, AkkaStreams]
  • 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 an implicit 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

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!

Don't miss a new tapir release

NewReleases is sending notifications on new releases.