| 511 | * @since 4.0.0 |
| 512 | */ |
| 513 | export const schemaParams = <A, I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>, RD>( |
| 514 | schema: Schema.ConstraintCodec<A, I, RD, unknown>, |
| 515 | options?: ParseOptions | undefined |
| 516 | ): Effect.Effect<A, Schema.SchemaError, HttpServerRequest.ParsedSearchParams | RouteContext | RD> => { |
| 517 | const parse = Schema.decodeUnknownEffect(schema) |
| 518 | return Effect.contextWith((context: Context.Context<HttpServerRequest.ParsedSearchParams | RouteContext>) => { |
| 519 | const searchParams = Context.get(context, HttpServerRequest.ParsedSearchParams) |
| 520 | const routeContext = Context.get(context, RouteContext) |
| 521 | return parse({ ...searchParams, ...routeContext.params }, options) |
| 522 | }) |
| 523 | } |
| 524 | |
| 525 | /** |
| 526 | * Decodes a schema from the path parameters captured for the current matched |