query.ts 417 B

123456789101112
  1. import { Schema, SchemaGetter } from "effect"
  2. export const QueryBoolean = Schema.Literals(["true", "false"]).pipe(
  3. Schema.decodeTo(Schema.Boolean, {
  4. decode: SchemaGetter.transform((value) => value === "true"),
  5. encode: SchemaGetter.transform((value) => (value ? "true" : "false")),
  6. }),
  7. )
  8. export const QueryBooleanOpenApi = {
  9. anyOf: [{ type: "boolean" }, { type: "string", enum: ["true", "false"] }],
  10. }