Patch Changes
-
#2471
58f66fe
Thanks @gcanti! - Class API: Added defaulttitle
annotation to the encoded side.Before:
import * as S from "@effect/schema/Schema"; class MySchema extends S.Class<MySchema>("MySchema")({ a: S.string, b: S.number, }) {} S.decodeUnknownSync(MySchema)({}, { errors: "all" }); /* Error: ({ a: string; b: number } <-> MySchema) └─ Encoded side transformation failure └─ { a: string; b: number } ├─ ["a"] │ └─ is missing └─ ["b"] └─ is missing */
After:
import * as S from "@effect/schema/Schema"; class MySchema extends S.Class<MySchema>("MySchema")({ a: S.string, b: S.number, }) {} S.decodeUnknownSync(MySchema)({}, { errors: "all" }); /* Error: (MySchema (Encoded side) <-> MySchema) └─ Encoded side transformation failure └─ MySchema (Encoded side) ├─ ["a"] │ └─ is missing └─ ["b"] └─ is missing */
-
#2465
3cad21d
Thanks @gcanti! -length
now allows expressing a rangeExample
import * as S from "@effect/schema/Schema"; const schema = S.string.pipe( S.length({ min: 2, max: 4 }, { identifier: "MyRange" }), ); S.decodeUnknownSync(schema)(""); /* throws: Error: MyRange └─ Predicate refinement failure └─ Expected MyRange (a string at least 2 character(s) and at most 4 character(s) long), actual "" */
-
Updated dependencies [
dadc690
]:- effect@2.4.18