13 lines
417 B
TypeScript
13 lines
417 B
TypeScript
import { Schema, SchemaGetter } from "effect"
|
|
|
|
export const QueryBoolean = Schema.Literals(["true", "false"]).pipe(
|
|
Schema.decodeTo(Schema.Boolean, {
|
|
decode: SchemaGetter.transform((value) => value === "true"),
|
|
encode: SchemaGetter.transform((value) => (value ? "true" : "false")),
|
|
}),
|
|
)
|
|
|
|
export const QueryBooleanOpenApi = {
|
|
anyOf: [{ type: "boolean" }, { type: "string", enum: ["true", "false"] }],
|
|
}
|