( schema: S, options?: ParseOptions | undefined )
| 318 | * @since 4.0.0 |
| 319 | */ |
| 320 | export const jsonSchema = <S extends Schema.Constraint>( |
| 321 | schema: S, |
| 322 | options?: ParseOptions | undefined |
| 323 | ) => { |
| 324 | const encode = SchemaParser.encodeUnknownEffect(Schema.toCodecJson(schema)) |
| 325 | return (body: S["Type"], contentType?: string): Effect.Effect<Uint8Array, HttpBodyError, S["EncodingServices"]> => |
| 326 | encode(body, options).pipe( |
| 327 | Effect.mapError((issue) => new HttpBodyError({ reason: { _tag: "SchemaError", issue }, cause: issue })), |
| 328 | Effect.flatMap((body) => json(body, contentType)) |
| 329 | ) |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Creates an `application/x-www-form-urlencoded` HTTP body from `UrlParams`. |
nothing calls this directly
no test coverage detected