| 413 | * @since 4.0.0 |
| 414 | */ |
| 415 | export const schemaParams = <A, I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>, RD>( |
| 416 | schema: Schema.ConstraintCodec<A, I, RD, unknown>, |
| 417 | options?: ParseOptions | undefined |
| 418 | ): Effect.Effect<A, Schema.SchemaError, HttpServerRequest.ParsedSearchParams | RouteContext | RD> => { |
| 419 | const parse = Schema.decodeUnknownEffect(schema) |
| 420 | return Effect.contextWith((context: Context.Context<HttpServerRequest.ParsedSearchParams | RouteContext>) => { |
| 421 | const searchParams = Context.get(context, HttpServerRequest.ParsedSearchParams) |
| 422 | const routeContext = Context.get(context, RouteContext) |
| 423 | return parse({ ...searchParams, ...routeContext.params }, options) |
| 424 | }) |
| 425 | } |
| 426 | |
| 427 | /** |
| 428 | * Decodes a schema from the path parameters captured for the current matched |