Logo Orsak

IDescribeResponses Type

A runner that describes the responses it gives, for OpenAPI: only the runner knows how an effect's result and errors become responses. When the runner of an endpoint implements it, the endpoint gets the responses as metadata.

Example

 type Runner =
     | RunWith of (HttpContext -> AppEnv)

     static member ( *>> )(effect: Effect<AppEnv, 'a, AppError>, RunWith createEnv) = ...

     interface IDescribeResponses with
         member _.Responses effectType =
             match effectType.GetGenericArguments() with
             | [| _; result; _ |] -> [
                 ResponseDescription.Json(200, result)
                 ResponseDescription.Json(404, typeof<ProblemDetails>, "Not found")
               ]
             | _ -> []
val effect: 'a
union case Runner.RunWith: (obj -> obj) -> Runner
val createEnv: (obj -> obj)
val effectType: 'a
val result: obj
val typeof<'T> : System.Type

Instance members

Instance member Description

this.Responses

Full Usage: this.Responses

Parameters:
Returns: ResponseDescription list
Modifiers: abstract

The responses of an endpoint whose handler creates an effect of type effectType, such as Effect<AppEnv, Order, OrderError>.

effectType : Type

The type of the effect, as in EffectType

Returns: ResponseDescription list

Type something to start searching.