Test case
1 generated file · +8 −0test/inputs/regressions/unicode-codepoint-length.schema
Aschema-typescript-effect-schemadefault / TopLevel.ts+8 −0
| @@ -0,0 +1,8 @@ | ||
| 1 | +import * as S from "effect/Schema"; | |
| 2 | + | |
| 3 | + | |
| 4 | +export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | |
| 5 | + "exact": S.String.pipe(S.filter(value => Array.from(value).length >= 2)).pipe(S.filter(value => Array.from(value).length <= 2)).pipe(S.pattern(new RegExp("^[^!]+$"))), | |
| 6 | + "maximum": S.String.pipe(S.filter(value => Array.from(value).length <= 1)), | |
| 7 | + "minimum": S.String.pipe(S.filter(value => Array.from(value).length >= 2)), | |
| 8 | +}) {} |
Test case
1 generated file · +7 −7test/inputs/schema/minmaxlength.schema
Mschema-typescript-effect-schemadefault / TopLevel.ts+7 −7
| @@ -2,12 +2,12 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | - "intersection": S.String.pipe(S.minLength(4)).pipe(S.maxLength(5)), | |
| 6 | - "inUnion": S.Union(S.Number, S.String.pipe(S.minLength(3)).pipe(S.maxLength(5))), | |
| 7 | - "maxlength": S.String.pipe(S.maxLength(5)), | |
| 8 | - "minlength": S.String.pipe(S.minLength(3)), | |
| 9 | - "minMaxIntersection": S.String.pipe(S.minLength(3)).pipe(S.maxLength(5)), | |
| 10 | - "minmaxlength": S.String.pipe(S.minLength(3)).pipe(S.maxLength(5)), | |
| 5 | + "intersection": S.String.pipe(S.filter(value => Array.from(value).length >= 4)).pipe(S.filter(value => Array.from(value).length <= 5)), | |
| 6 | + "inUnion": S.Union(S.Number, S.String.pipe(S.filter(value => Array.from(value).length >= 3)).pipe(S.filter(value => Array.from(value).length <= 5))), | |
| 7 | + "maxlength": S.String.pipe(S.filter(value => Array.from(value).length <= 5)), | |
| 8 | + "minlength": S.String.pipe(S.filter(value => Array.from(value).length >= 3)), | |
| 9 | + "minMaxIntersection": S.String.pipe(S.filter(value => Array.from(value).length >= 3)).pipe(S.filter(value => Array.from(value).length <= 5)), | |
| 10 | + "minmaxlength": S.String.pipe(S.filter(value => Array.from(value).length >= 3)).pipe(S.filter(value => Array.from(value).length <= 5)), | |
| 11 | 11 | "minMaxUnion": S.String, |
| 12 | - "union": S.String.pipe(S.minLength(3)).pipe(S.maxLength(6)), | |
| 12 | + "union": S.String.pipe(S.filter(value => Array.from(value).length >= 3)).pipe(S.filter(value => Array.from(value).length <= 6)), | |
| 13 | 13 | }) {} |
Test case
1 generated file · +2 −2test/inputs/schema/optional-const-ref.schema
Mschema-typescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -9,9 +9,9 @@ export class Coordinate extends S.Class<Coordinate>("Coordinate")({ | ||
| 9 | 9 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 10 | 10 | "coordinates": S.optional(S.NullOr(S.Array(Coordinate))), |
| 11 | 11 | "count": S.optional(S.NullOr(S.Int.pipe(S.greaterThanOrEqualTo(1)).pipe(S.lessThanOrEqualTo(100)))), |
| 12 | - "label": S.optional(S.NullOr(S.String.pipe(S.minLength(2)).pipe(S.maxLength(16)))), | |
| 12 | + "label": S.optional(S.NullOr(S.String.pipe(S.filter(value => Array.from(value).length >= 2)).pipe(S.filter(value => Array.from(value).length <= 16)))), | |
| 13 | 13 | "requiredCoordinates": S.Array(Coordinate), |
| 14 | 14 | "requiredCount": S.Int.pipe(S.greaterThanOrEqualTo(1)).pipe(S.lessThanOrEqualTo(100)), |
| 15 | - "requiredLabel": S.String.pipe(S.minLength(2)).pipe(S.maxLength(16)), | |
| 15 | + "requiredLabel": S.String.pipe(S.filter(value => Array.from(value).length >= 2)).pipe(S.filter(value => Array.from(value).length <= 16)), | |
| 16 | 16 | "weight": S.optional(S.NullOr(S.Number.pipe(S.greaterThanOrEqualTo(0.5)).pipe(S.lessThanOrEqualTo(99.5)))), |
| 17 | 17 | }) {} |
Test case
1 generated file · +1 −1test/inputs/schema/optional-constraints.schema
Mschema-typescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -5,6 +5,6 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 5 | 5 | "optDouble": S.optional(S.NullOr(S.Number.pipe(S.greaterThanOrEqualTo(0.5)).pipe(S.lessThanOrEqualTo(99.5)))), |
| 6 | 6 | "optInt": S.optional(S.NullOr(S.Int.pipe(S.greaterThanOrEqualTo(0)).pipe(S.lessThanOrEqualTo(100)))), |
| 7 | 7 | "optPattern": S.optional(S.NullOr(S.String.pipe(S.pattern(new RegExp("^[a-z]+$"))))), |
| 8 | - "optString": S.optional(S.NullOr(S.String.pipe(S.minLength(3)).pipe(S.maxLength(10)))), | |
| 8 | + "optString": S.optional(S.NullOr(S.String.pipe(S.filter(value => Array.from(value).length >= 3)).pipe(S.filter(value => Array.from(value).length <= 10)))), | |
| 9 | 9 | "reqZeroMin": S.Int.pipe(S.greaterThanOrEqualTo(0)).pipe(S.lessThanOrEqualTo(100)), |
| 10 | 10 | }) {} |
Test case
1 generated file · +2 −2test/inputs/schema/renaming-bug.schema
Mschema-typescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -42,7 +42,7 @@ export class Speed extends S.Class<Speed>("Speed")({ | ||
| 42 | 42 | |
| 43 | 43 | export class Vehicle extends S.Class<Vehicle>("Vehicle")({ |
| 44 | 44 | "brand": S.optional(S.NullOr(S.String)), |
| 45 | - "id": S.optional(S.NullOr(S.String.pipe(S.minLength(1)))), | |
| 45 | + "id": S.optional(S.NullOr(S.String.pipe(S.filter(value => Array.from(value).length >= 1)))), | |
| 46 | 46 | "speed": S.optional(S.NullOr(Speed)), |
| 47 | 47 | "subModule": S.optional(S.NullOr(S.Boolean)), |
| 48 | 48 | "type": S.optional(S.NullOr(VehicleType)), |
| @@ -83,7 +83,7 @@ export class Color extends S.Class<Color>("Color")({ | ||
| 83 | 83 | |
| 84 | 84 | export class Berry extends S.Class<Berry>("Berry")({ |
| 85 | 85 | "color": S.optional(S.NullOr(Color)), |
| 86 | - "name": S.optional(S.NullOr(S.String.pipe(S.minLength(1)))), | |
| 86 | + "name": S.optional(S.NullOr(S.String.pipe(S.filter(value => Array.from(value).length >= 1)))), | |
| 87 | 87 | "shapes": S.optional(S.NullOr(S.Array(Shape))), |
| 88 | 88 | }) {} |
Test case
1 generated file · +1 −1test/inputs/schema/schema-constraints.schema
Mschema-typescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -2,6 +2,6 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | - "minMaxLength": S.String.pipe(S.minLength(5)).pipe(S.maxLength(5)), | |
| 5 | + "minMaxLength": S.String.pipe(S.filter(value => Array.from(value).length >= 5)).pipe(S.filter(value => Array.from(value).length <= 5)), | |
| 6 | 6 | "percent": S.Number.pipe(S.greaterThanOrEqualTo(0)).pipe(S.lessThanOrEqualTo(1)), |
| 7 | 7 | }) {} |
No generated files match these filters.