Summary
The main features in this release:
- Scala3 support: core, http4s & vertx servers, sttp client, as well as some json and datatypes integrations are available in the JVM flavor
- content negotiation on server & client side
- the structure of data is reflected only in schemas, not in validators. Validators are much simpler now, and part of schemas
- server interpreters have been rewritten, and support two types of interceptors (request & endpoint interceptors). Some functionalities (logging, decode failure handling) are implemented as interceptors; custom interceptors can be added
- exceptions are handled and result in the 500 status code
- The generated documentation will now include an entry for
400 Bad Request
by default, if none is specified by the user, enumerating the reasons on why request decoding might fail. This can be turned off or adjusted inOpenAPIDocsOptions
. - ZIO Http server interpreter
Thanks to all the contributors for their cooperation, especially @mbore, @kubinio123, @bartekzylinski, @slabiakt, @danielleontiev, @hamnis, @majk-p, @MichalPawlicki, @PawelJ-PL, @endertunc, @ae0n!
Major breaking changes
SchemaType
s are not objects, but classes. If you specified the schema type manually, instead of e.g.SchemaType.SString
you'll have to useSchemaType.SString()
- server options have been significantly refactored. To create custom options, use e.g.
AkkaServerOptions.customInterceptors
Validator.enum
method has been renamed toValidator.enumeration
, and.derivedEnum
to.derivedEnumeration
, asenum
is now a keyword in Scala3- due to changes to companion objects in Scala3,
.mapTo(Companion)
is replaced with a macro:.mapTo[CaseClass]
- akka server interpreter: removal of
.toDirective
- annotations have been moved; endpoint annotations to
EndpointIO.annotations
, and schema annotations toSchema.annotations
. Instead ofderivedEndpointInput
, usedEndpointInput.derived
instead - options for interpreters are now passed as explicit parameters to the interpreters, not as implicit ones to individual methods. If no options are provided, default parameters are used. If you've used default parameters, you'll need to add
()
to the interpreter, as it is now a class, not an object. E.g.AkkaHttpServerInterpreter.toRoutes(endpoints)
becomes:
AkkaHttpServerInterpreter().toRoutes(endpoints)
If you have custom options, you'll need to change code such as:
implicit val options = AkkaHttpServerOptions.customInterceptors(...)
AkkaHttpServerInterpreter.toRoutes(endpoints)
into:
val options = AkkaHttpServerOptions.customInterceptors(...)
AkkaHttpServerInterpreter(options).toRoutes(endpoints)
Other breaking changes
- rewritten
SchemaType.[SProduct|SCoproduct|SOpenProduct]
DecodeFailureHandler
- minor changes in method signatures, the default one is nowDefaultDecodeFailureHandler.handler
LogRequestHandling
->ServerLog
Codec
is no longer aMapping
- play server interpreter:
toRoute
->toRoutes
- deprecated
statusMapping
in favor ofoneOfMapping
- enumerations in openapi model (parameters, parameter style) are now sealed trait families
- schema improvements:
SObjectInfo
is replaced bySName
; coproducts are more general, as they can include any child schemas (not only objects) - enums are referenced by default, there's no
referenceEnums
option in the documentation interpreters. To inline enums, you'll need to define the enum validator without a name, or remove the name from the derived schema.
What’s Changed since v0.18.0-M18
- Change backend client for awsLambda (#1365) @bartekzylinski
- Zhttp (#1337) @bartekzylinski
- Fixed Validator methods names (#1362) @gruggiero
- Annotations cleanup: scoping, schema annotations support (#1351) @adamw
- Move methods to derive endpoint inputs/outputs to companion objects, rename the methods to
derived
(#1348) @adamw
Dependency updates since v0.18.0-M18
- Update scala3-library to 3.0.1 (#1366) @scala-steward
- Update swagger-ui to 3.51.1 (#1363) @scala-steward
- Update vertx-web to 4.1.1 (#1353) @scala-steward
- Update client3:akka-http-backend, ... to 3.3.9 (#1352) @scala-steward
- Update jsoniter-scala-core, ... to 2.9.1 (#1350) @scala-steward
- Update jawn-parser to 1.2.0 (#1364) @scala-steward
- Update magnolia-core to 2.0.0-M9 (#1358) @scala-steward
- Update swagger-ui to 3.51.0 (#1355) @scala-steward
- Update derevo-core to 0.12.6 (#1346) @scala-steward