Skip to content

Commit 32495d0

Browse files
committed
More streaming mentions in REST docs
1 parent 604708c commit 32495d0

File tree

1 file changed

+11
-7
lines changed
  • guide/guide/.js/src/main/assets/pages

1 file changed

+11
-7
lines changed

guide/guide/.js/src/main/assets/pages/rest.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ serializable as `HttpBody`.
680680

681681
### Result serialization
682682

683-
Result type of every REST API method is wrapped into `Try` (in case the method throws an exception)
683+
Result type of every non-streaming REST API method is wrapped into `Try` (in case the method throws an exception)
684684
and translated into `Task[RestResponse]`. This means that the macro engine looks for an implicit instance of
685685
`AsRaw[Task[RestResponse], Try[R]]` and `AsReal[Task[RestResponse], Try[R]]` for every HTTP method with result type `R`.
686686

@@ -703,7 +703,10 @@ derived from `GenCodec` instance.
703703

704704
Ultimately, if you don't want to use `Future`s, you may replace it with some other asynchronous wrapper type,
705705
e.g. Monix Task or some IO monad.
706-
See [supporting result containers other than `Future`](#supporting-result-containers-other-than-future), [streaming serialization workflow](#streaming-serialization-workflow).
706+
See [supporting result containers other than `Future`](#supporting-result-containers-other-than-future).
707+
708+
See [streaming serialization workflow](#streaming-serialization-workflow) for details on `monix.reactive.Observable`
709+
support in streaming REST API methods.
707710

708711
### Customizing serialization
709712

@@ -946,8 +949,8 @@ computation which yields a `RestResponse` when run.
946949

947950
### Implementing a server
948951

949-
An existing implementation of REST API trait can be easily turned into a `HandleRequest`
950-
function using `RawRest.asHandleRequest`.
952+
An existing implementation of REST API trait can be easily turned into a function using
953+
`RawRest.asHandleRequest` or `RawRest.asHandleRequestWithStreaming` (for server-side streaming support).
951954

952955
Therefore, the only thing you need to do to expose your REST API trait as an actual web service it to turn
953956
`HandleRequest` function into a server. This is usually just a matter of translating native HTTP request into
@@ -961,7 +964,8 @@ for an example implementation.
961964

962965
If you already have a `HandleRequest` function, you can easily turn it into an implementation of desired REST API trait
963966
using `RawRest.fromHandleRequest`. This implementation is a macro-generated proxy which translates actual
964-
method calls into invocations of provided `HandleRequest` function.
967+
method calls into invocations of provided `HandleRequest` function. Use `RawRest.fromHandleRequestWithStreaming` for
968+
client-side streaming support.
965969

966970
Therefore, the only thing you need to to in order to wrap a native HTTP client into a REST API trait instance is
967971
to turn this native HTTP client into a `HandleRequest` function.
@@ -1195,7 +1199,7 @@ materialized by a macro. You can then use it to generate OpenAPI specification d
11951199
import io.udash.rest._
11961200

11971201
trait MyRestApi {
1198-
...
1202+
// ...
11991203
}
12001204
object MyRestApi extends DefaultRestApiCompanion[MyRestApi]
12011205

@@ -1496,7 +1500,7 @@ For a streaming endpoint returning `Observable[Item]`, the generated schema will
14961500

14971501
The OpenAPI document correctly describes the available media types for streaming responses:
14981502

1499-
1. **JSON Lists** - When streaming regular objects, they're represented as a JSON array in the schema.
1503+
1. **JSON Lists** - When streaming regular JSON objects, they're represented as a JSON array in the schema.
15001504
This is reflected in the OpenAPI document with content type `application/json`.
15011505

15021506
2. **Binary Streams** - When streaming `Array[Byte]` (binary data), the content type in the OpenAPI document

0 commit comments

Comments
 (0)