Test case
1 generated file · +3 −3test/inputs/json/misc/00c36.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -17,7 +17,7 @@ export type Value = S.Schema.Type<typeof Value>; | ||
| 17 | 17 | export class FluffyTopLevel extends S.Class<FluffyTopLevel>("FluffyTopLevel")({ |
| 18 | 18 | "page": S.Int, |
| 19 | 19 | "pages": S.Int, |
| 20 | - "per_page": S.String, | |
| 20 | + "per_page": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 21 | 21 | "total": S.Int, |
| 22 | 22 | }) {} |
| 23 | 23 | |
| @@ -28,8 +28,8 @@ export class Country extends S.Class<Country>("Country")({ | ||
| 28 | 28 | |
| 29 | 29 | export class PurpleTopLevel extends S.Class<PurpleTopLevel>("PurpleTopLevel")({ |
| 30 | 30 | "country": Country, |
| 31 | - "date": S.String, | |
| 32 | - "decimal": S.String, | |
| 31 | + "date": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "decimal": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "indicator": Country, |
| 34 | 34 | "value": S.String, |
| 35 | 35 | }) {} |
Test case
1 generated file · +3 −3test/inputs/json/misc/0b91a.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -9,10 +9,10 @@ export class Component extends S.Class<Component>("Component")({ | ||
| 9 | 9 | export class Result extends S.Class<Result>("Result")({ |
| 10 | 10 | "attachment": S.Array(S.Any), |
| 11 | 11 | "body": S.String, |
| 12 | - "changed": S.String, | |
| 12 | + "changed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 13 | 13 | "component": S.Array(Component), |
| 14 | - "created": S.String, | |
| 15 | - "date": S.String, | |
| 14 | + "created": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 15 | + "date": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 16 | 16 | "image": S.Array(S.Any), |
| 17 | 17 | "number": S.Null, |
| 18 | 18 | "teaser": S.Null, |
Test case
1 generated file · +13 −13test/inputs/json/misc/0cffa.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -45,34 +45,34 @@ export class User extends S.Class<User>("User")({ | ||
| 45 | 45 | |
| 46 | 46 | export class Looping extends S.Class<Looping>("Looping")({ |
| 47 | 47 | "mp4": S.String, |
| 48 | - "mp4_size": S.String, | |
| 48 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 49 | 49 | }) {} |
| 50 | 50 | |
| 51 | 51 | export class FixedHeight extends S.Class<FixedHeight>("FixedHeight")({ |
| 52 | - "frames": S.optional(S.NullOr(S.String)), | |
| 52 | + "frames": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 53 | 53 | "hash": S.optional(S.NullOr(S.String)), |
| 54 | - "height": S.String, | |
| 54 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 55 | 55 | "mp4": S.optional(S.NullOr(S.String)), |
| 56 | - "mp4_size": S.optional(S.NullOr(S.String)), | |
| 57 | - "size": S.String, | |
| 56 | + "mp4_size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 57 | + "size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 58 | 58 | "url": S.String, |
| 59 | 59 | "webp": S.String, |
| 60 | - "webp_size": S.String, | |
| 61 | - "width": S.String, | |
| 60 | + "webp_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 62 | 62 | }) {} |
| 63 | 63 | |
| 64 | 64 | export class DownsizedSmall extends S.Class<DownsizedSmall>("DownsizedSmall")({ |
| 65 | - "height": S.String, | |
| 65 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 66 | 66 | "mp4": S.String, |
| 67 | - "mp4_size": S.String, | |
| 68 | - "width": S.String, | |
| 67 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 68 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 69 | 69 | }) {} |
| 70 | 70 | |
| 71 | 71 | export class Downsized extends S.Class<Downsized>("Downsized")({ |
| 72 | - "height": S.String, | |
| 73 | - "size": S.optional(S.NullOr(S.String)), | |
| 72 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 73 | + "size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 74 | 74 | "url": S.String, |
| 75 | - "width": S.String, | |
| 75 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 76 | 76 | }) {} |
| 77 | 77 | |
| 78 | 78 | export class Images extends S.Class<Images>("Images")({ |
Test case
1 generated file · +13 −13test/inputs/json/misc/127a1.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -44,34 +44,34 @@ export class User extends S.Class<User>("User")({ | ||
| 44 | 44 | |
| 45 | 45 | export class Looping extends S.Class<Looping>("Looping")({ |
| 46 | 46 | "mp4": S.String, |
| 47 | - "mp4_size": S.String, | |
| 47 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 48 | 48 | }) {} |
| 49 | 49 | |
| 50 | 50 | export class FixedHeight extends S.Class<FixedHeight>("FixedHeight")({ |
| 51 | - "frames": S.optional(S.NullOr(S.String)), | |
| 51 | + "frames": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 52 | 52 | "hash": S.optional(S.NullOr(S.String)), |
| 53 | - "height": S.String, | |
| 53 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 54 | 54 | "mp4": S.optional(S.NullOr(S.String)), |
| 55 | - "mp4_size": S.optional(S.NullOr(S.String)), | |
| 56 | - "size": S.String, | |
| 55 | + "mp4_size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 56 | + "size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "url": S.String, |
| 58 | 58 | "webp": S.String, |
| 59 | - "webp_size": S.String, | |
| 60 | - "width": S.String, | |
| 59 | + "webp_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class DownsizedSmall extends S.Class<DownsizedSmall>("DownsizedSmall")({ |
| 64 | - "height": S.String, | |
| 64 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | 65 | "mp4": S.String, |
| 66 | - "mp4_size": S.String, | |
| 67 | - "width": S.String, | |
| 66 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 68 | 68 | }) {} |
| 69 | 69 | |
| 70 | 70 | export class Downsized extends S.Class<Downsized>("Downsized")({ |
| 71 | - "height": S.String, | |
| 72 | - "size": S.optional(S.NullOr(S.String)), | |
| 71 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 72 | + "size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 73 | 73 | "url": S.String, |
| 74 | - "width": S.String, | |
| 74 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 75 | 75 | }) {} |
| 76 | 76 | |
| 77 | 77 | export class Images extends S.Class<Images>("Images")({ |
Test case
1 generated file · +13 −13test/inputs/json/misc/16bc5.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -2,9 +2,9 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class Wind extends S.Class<Wind>("Wind")({ |
| 5 | - "chill": S.String, | |
| 6 | - "direction": S.String, | |
| 7 | - "speed": S.String, | |
| 5 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 6 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 7 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 8 | 8 | }) {} |
| 9 | 9 | |
| 10 | 10 | export class Units extends S.Class<Units>("Units")({ |
| @@ -25,18 +25,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 25 | 25 | }) {} |
| 26 | 26 | |
| 27 | 27 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 28 | - "code": S.String, | |
| 28 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "date": S.String, |
| 30 | 30 | "day": S.String, |
| 31 | - "high": S.String, | |
| 32 | - "low": S.String, | |
| 31 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "text": S.String, |
| 34 | 34 | }) {} |
| 35 | 35 | |
| 36 | 36 | export class Condition extends S.Class<Condition>("Condition")({ |
| 37 | - "code": S.String, | |
| 37 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "date": S.String, |
| 39 | - "temp": S.String, | |
| 39 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": S.String, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| @@ -53,17 +53,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 53 | 53 | }) {} |
| 54 | 54 | |
| 55 | 55 | export class Image extends S.Class<Image>("Image")({ |
| 56 | - "height": S.String, | |
| 56 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "link": S.String, |
| 58 | 58 | "title": S.String, |
| 59 | 59 | "url": S.String, |
| 60 | - "width": S.String, | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 64 | - "humidity": S.String, | |
| 64 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | 65 | "pressure": S.String, |
| 66 | - "rising": S.String, | |
| 66 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | "visibility": S.String, |
| 68 | 68 | }) {} |
| 69 | 69 | |
| @@ -83,7 +83,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 83 | 83 | "link": S.String, |
| 84 | 84 | "location": Location, |
| 85 | 85 | "title": S.String, |
| 86 | - "ttl": S.String, | |
| 86 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 87 | 87 | "units": Units, |
| 88 | 88 | "wind": Wind, |
| 89 | 89 | }) {} |
Test case
1 generated file · +1 −1test/inputs/json/misc/176f1.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -11,7 +11,7 @@ export class Datum extends S.Class<Datum>("Datum")({ | ||
| 11 | 11 | "period": S.String, |
| 12 | 12 | "periodName": S.String, |
| 13 | 13 | "value": S.String, |
| 14 | - "year": S.String, | |
| 14 | + "year": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 15 | 15 | }) {} |
| 16 | 16 | |
| 17 | 17 | export class Series extends S.Class<Series>("Series")({ |
Test case
1 generated file · +1 −1test/inputs/json/misc/1b409.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -67,7 +67,7 @@ export class Person extends S.Class<Person>("Person")({ | ||
| 67 | 67 | "namemod": Namemod, |
| 68 | 68 | "nickname": S.String, |
| 69 | 69 | "osid": S.String, |
| 70 | - "pvsid": S.NullOr(S.String), | |
| 70 | + "pvsid": S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/))), | |
| 71 | 71 | "sortname": S.String, |
| 72 | 72 | "twitterid": S.NullOr(S.String), |
| 73 | 73 | "youtubeid": S.NullOr(S.String), |
Test case
1 generated file · +13 −13test/inputs/json/misc/262f0.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -9,9 +9,9 @@ export const Text = S.Literal( | ||
| 9 | 9 | export type Text = S.Schema.Type<typeof Text>; |
| 10 | 10 | |
| 11 | 11 | export class Wind extends S.Class<Wind>("Wind")({ |
| 12 | - "chill": S.String, | |
| 13 | - "direction": S.String, | |
| 14 | - "speed": S.String, | |
| 12 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 13 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 14 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 15 | 15 | }) {} |
| 16 | 16 | |
| 17 | 17 | export class Units extends S.Class<Units>("Units")({ |
| @@ -32,18 +32,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 32 | 32 | }) {} |
| 33 | 33 | |
| 34 | 34 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 35 | - "code": S.String, | |
| 35 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 36 | 36 | "date": S.String, |
| 37 | 37 | "day": S.String, |
| 38 | - "high": S.String, | |
| 39 | - "low": S.String, | |
| 38 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 39 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": Text, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| 43 | 43 | export class Condition extends S.Class<Condition>("Condition")({ |
| 44 | - "code": S.String, | |
| 44 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 45 | 45 | "date": S.String, |
| 46 | - "temp": S.String, | |
| 46 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 47 | 47 | "text": Text, |
| 48 | 48 | }) {} |
| 49 | 49 | |
| @@ -60,17 +60,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 60 | 60 | }) {} |
| 61 | 61 | |
| 62 | 62 | export class Image extends S.Class<Image>("Image")({ |
| 63 | - "height": S.String, | |
| 63 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 64 | 64 | "link": S.String, |
| 65 | 65 | "title": S.String, |
| 66 | 66 | "url": S.String, |
| 67 | - "width": S.String, | |
| 67 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 68 | 68 | }) {} |
| 69 | 69 | |
| 70 | 70 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 71 | - "humidity": S.String, | |
| 71 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 72 | 72 | "pressure": S.String, |
| 73 | - "rising": S.String, | |
| 73 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 74 | 74 | "visibility": S.String, |
| 75 | 75 | }) {} |
| 76 | 76 | |
| @@ -90,7 +90,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 90 | 90 | "link": S.String, |
| 91 | 91 | "location": Location, |
| 92 | 92 | "title": S.String, |
| 93 | - "ttl": S.String, | |
| 93 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 94 | 94 | "units": Units, |
| 95 | 95 | "wind": Wind, |
| 96 | 96 | }) {} |
Test case
1 generated file · +13 −13test/inputs/json/misc/26b49.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -38,34 +38,34 @@ export class User extends S.Class<User>("User")({ | ||
| 38 | 38 | |
| 39 | 39 | export class Looping extends S.Class<Looping>("Looping")({ |
| 40 | 40 | "mp4": S.String, |
| 41 | - "mp4_size": S.String, | |
| 41 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 42 | 42 | }) {} |
| 43 | 43 | |
| 44 | 44 | export class FixedHeight extends S.Class<FixedHeight>("FixedHeight")({ |
| 45 | - "frames": S.optional(S.NullOr(S.String)), | |
| 45 | + "frames": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 46 | 46 | "hash": S.optional(S.NullOr(S.String)), |
| 47 | - "height": S.String, | |
| 47 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 48 | 48 | "mp4": S.optional(S.NullOr(S.String)), |
| 49 | - "mp4_size": S.optional(S.NullOr(S.String)), | |
| 50 | - "size": S.String, | |
| 49 | + "mp4_size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 50 | + "size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 51 | 51 | "url": S.String, |
| 52 | 52 | "webp": S.String, |
| 53 | - "webp_size": S.String, | |
| 54 | - "width": S.String, | |
| 53 | + "webp_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 54 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 55 | 55 | }) {} |
| 56 | 56 | |
| 57 | 57 | export class DownsizedSmall extends S.Class<DownsizedSmall>("DownsizedSmall")({ |
| 58 | - "height": S.String, | |
| 58 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 59 | 59 | "mp4": S.String, |
| 60 | - "mp4_size": S.String, | |
| 61 | - "width": S.String, | |
| 60 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 62 | 62 | }) {} |
| 63 | 63 | |
| 64 | 64 | export class Downsized extends S.Class<Downsized>("Downsized")({ |
| 65 | - "height": S.String, | |
| 66 | - "size": S.optional(S.NullOr(S.String)), | |
| 65 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 66 | + "size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 67 | 67 | "url": S.String, |
| 68 | - "width": S.String, | |
| 68 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 69 | 69 | }) {} |
| 70 | 70 | |
| 71 | 71 | export class Images extends S.Class<Images>("Images")({ |
Test case
1 generated file · +2 −2test/inputs/json/misc/26c9c.json
Mtypescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -94,7 +94,7 @@ export class Metadata extends S.Class<Metadata>("Metadata")({ | ||
| 94 | 94 | "availableDisplayTypes": S.Array(S.String), |
| 95 | 95 | "custom_fields": CustomFields, |
| 96 | 96 | "jsonQuery": JsonQuery, |
| 97 | - "rdfSubject": S.String, | |
| 97 | + "rdfSubject": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 98 | 98 | "renderTypeConfig": RenderTypeConfig, |
| 99 | 99 | }) {} |
| 100 | 100 | |
| @@ -122,7 +122,7 @@ export class CachedContents extends S.Class<CachedContents>("CachedContents")({ | ||
| 122 | 122 | "non_null": S.Int, |
| 123 | 123 | "null": S.Int, |
| 124 | 124 | "smallest": S.String, |
| 125 | - "sum": S.optional(S.NullOr(S.String)), | |
| 125 | + "sum": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 126 | 126 | "top": S.Array(Top), |
| 127 | 127 | }) {} |
Test case
1 generated file · +1 −1test/inputs/json/misc/27332.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -121,7 +121,7 @@ export class ChildData extends S.Class<ChildData>("ChildData")({ | ||
| 121 | 121 | "is_self": S.Boolean, |
| 122 | 122 | "is_video": S.Boolean, |
| 123 | 123 | "likes": S.Null, |
| 124 | - "link_flair_css_class": S.NullOr(S.String), | |
| 124 | + "link_flair_css_class": S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/))), | |
| 125 | 125 | "link_flair_text": S.NullOr(S.String), |
| 126 | 126 | "locked": S.Boolean, |
| 127 | 127 | "media": S.NullOr(Media), |
Test case
1 generated file · +1 −1test/inputs/json/misc/2d4e2.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -93,7 +93,7 @@ export class Person extends S.Class<Person>("Person")({ | ||
| 93 | 93 | "namemod": Namemod, |
| 94 | 94 | "nickname": S.String, |
| 95 | 95 | "osid": S.String, |
| 96 | - "pvsid": S.String, | |
| 96 | + "pvsid": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 97 | 97 | "sortname": S.String, |
| 98 | 98 | "twitterid": S.NullOr(S.String), |
| 99 | 99 | "youtubeid": S.NullOr(S.String), |
Test case
1 generated file · +1 −1test/inputs/json/misc/2df80.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -57,7 +57,7 @@ export type Value = S.Schema.Type<typeof Value>; | ||
| 57 | 57 | export class FluffyTopLevel extends S.Class<FluffyTopLevel>("FluffyTopLevel")({ |
| 58 | 58 | "page": S.Int, |
| 59 | 59 | "pages": S.Int, |
| 60 | - "per_page": S.String, | |
| 60 | + "per_page": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | "total": S.Int, |
| 62 | 62 | }) {} |
Test case
1 generated file · +3 −3test/inputs/json/misc/33d2e.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -30,8 +30,8 @@ export class Prize extends S.Class<Prize>("Prize")({ | ||
| 30 | 30 | "category": S.optional(S.NullOr(Category)), |
| 31 | 31 | "motivation": S.optional(S.NullOr(S.String)), |
| 32 | 32 | "overallMotivation": S.optional(S.NullOr(S.String)), |
| 33 | - "share": S.optional(S.NullOr(S.String)), | |
| 34 | - "year": S.optional(S.NullOr(S.String)), | |
| 33 | + "share": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 34 | + "year": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 35 | 35 | }) {} |
| 36 | 36 | |
| 37 | 37 | export class Laureate extends S.Class<Laureate>("Laureate")({ |
| @@ -45,7 +45,7 @@ export class Laureate extends S.Class<Laureate>("Laureate")({ | ||
| 45 | 45 | "diedCountryCode": S.optional(S.NullOr(S.String)), |
| 46 | 46 | "firstname": S.optional(S.NullOr(S.String)), |
| 47 | 47 | "gender": Gender, |
| 48 | - "id": S.String, | |
| 48 | + "id": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 49 | 49 | "prizes": S.Array(Prize), |
| 50 | 50 | "surname": S.optional(S.NullOr(S.String)), |
| 51 | 51 | }) {} |
Test case
1 generated file · +1 −1test/inputs/json/misc/34702.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -64,7 +64,7 @@ export const FeatureType = S.Literal( | ||
| 64 | 64 | export type FeatureType = S.Schema.Type<typeof FeatureType>; |
| 65 | 65 | |
| 66 | 66 | export class FeatureProperties extends S.Class<FeatureProperties>("FeatureProperties")({ |
| 67 | - "division": S.String, | |
| 67 | + "division": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 68 | 68 | "fax": S.Number, |
| 69 | 69 | "fire_ban_r": S.NullOr(FireBanR), |
| 70 | 70 | "latitude": S.Number, |
Test case
1 generated file · +1 −1test/inputs/json/misc/3e9a3.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -11,7 +11,7 @@ export class Datum extends S.Class<Datum>("Datum")({ | ||
| 11 | 11 | "period": S.String, |
| 12 | 12 | "periodName": S.String, |
| 13 | 13 | "value": S.String, |
| 14 | - "year": S.String, | |
| 14 | + "year": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 15 | 15 | }) {} |
| 16 | 16 | |
| 17 | 17 | export class Series extends S.Class<Series>("Series")({ |
Test case
1 generated file · +13 −13test/inputs/json/misc/3f1ce.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -7,9 +7,9 @@ export const Text = S.Literal( | ||
| 7 | 7 | export type Text = S.Schema.Type<typeof Text>; |
| 8 | 8 | |
| 9 | 9 | export class Wind extends S.Class<Wind>("Wind")({ |
| 10 | - "chill": S.String, | |
| 11 | - "direction": S.String, | |
| 12 | - "speed": S.String, | |
| 10 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 11 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 12 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 13 | 13 | }) {} |
| 14 | 14 | |
| 15 | 15 | export class Units extends S.Class<Units>("Units")({ |
| @@ -30,18 +30,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 30 | 30 | }) {} |
| 31 | 31 | |
| 32 | 32 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 33 | - "code": S.String, | |
| 33 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 34 | 34 | "date": S.String, |
| 35 | 35 | "day": S.String, |
| 36 | - "high": S.String, | |
| 37 | - "low": S.String, | |
| 36 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 37 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "text": Text, |
| 39 | 39 | }) {} |
| 40 | 40 | |
| 41 | 41 | export class Condition extends S.Class<Condition>("Condition")({ |
| 42 | - "code": S.String, | |
| 42 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 43 | 43 | "date": S.String, |
| 44 | - "temp": S.String, | |
| 44 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 45 | 45 | "text": S.String, |
| 46 | 46 | }) {} |
| 47 | 47 | |
| @@ -58,17 +58,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 58 | 58 | }) {} |
| 59 | 59 | |
| 60 | 60 | export class Image extends S.Class<Image>("Image")({ |
| 61 | - "height": S.String, | |
| 61 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 62 | 62 | "link": S.String, |
| 63 | 63 | "title": S.String, |
| 64 | 64 | "url": S.String, |
| 65 | - "width": S.String, | |
| 65 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 66 | 66 | }) {} |
| 67 | 67 | |
| 68 | 68 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 69 | - "humidity": S.String, | |
| 69 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 70 | 70 | "pressure": S.String, |
| 71 | - "rising": S.String, | |
| 71 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 72 | 72 | "visibility": S.String, |
| 73 | 73 | }) {} |
| 74 | 74 | |
| @@ -88,7 +88,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 88 | 88 | "link": S.String, |
| 89 | 89 | "location": Location, |
| 90 | 90 | "title": S.String, |
| 91 | - "ttl": S.String, | |
| 91 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 92 | 92 | "units": Units, |
| 93 | 93 | "wind": Wind, |
| 94 | 94 | }) {} |
Test case
1 generated file · +3 −3test/inputs/json/misc/421d4.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -18,9 +18,9 @@ export class RenderTypeConfig extends S.Class<RenderTypeConfig>("RenderTypeConfi | ||
| 18 | 18 | export class Metadata extends S.Class<Metadata>("Metadata")({ |
| 19 | 19 | "availableDisplayTypes": S.Array(S.String), |
| 20 | 20 | "rdfClass": S.String, |
| 21 | - "rdfSubject": S.String, | |
| 21 | + "rdfSubject": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 22 | 22 | "renderTypeConfig": RenderTypeConfig, |
| 23 | - "rowIdentifier": S.String, | |
| 23 | + "rowIdentifier": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 24 | 24 | }) {} |
| 25 | 25 | |
| 26 | 26 | export class License extends S.Class<License>("License")({ |
| @@ -47,7 +47,7 @@ export class CachedContents extends S.Class<CachedContents>("CachedContents")({ | ||
| 47 | 47 | "non_null": S.Int, |
| 48 | 48 | "null": S.Int, |
| 49 | 49 | "smallest": S.optional(S.NullOr(S.String)), |
| 50 | - "sum": S.optional(S.NullOr(S.String)), | |
| 50 | + "sum": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 51 | 51 | "top": S.optional(S.NullOr(S.Array(Top))), |
| 52 | 52 | }) {} |
Test case
1 generated file · +13 −13test/inputs/json/misc/437e7.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -38,33 +38,33 @@ export class User extends S.Class<User>("User")({ | ||
| 38 | 38 | |
| 39 | 39 | export class Looping extends S.Class<Looping>("Looping")({ |
| 40 | 40 | "mp4": S.String, |
| 41 | - "mp4_size": S.String, | |
| 41 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 42 | 42 | }) {} |
| 43 | 43 | |
| 44 | 44 | export class FixedHeight extends S.Class<FixedHeight>("FixedHeight")({ |
| 45 | - "frames": S.optional(S.NullOr(S.String)), | |
| 46 | - "height": S.String, | |
| 45 | + "frames": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 46 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 47 | 47 | "mp4": S.optional(S.NullOr(S.String)), |
| 48 | - "mp4_size": S.optional(S.NullOr(S.String)), | |
| 49 | - "size": S.String, | |
| 48 | + "mp4_size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 49 | + "size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 50 | 50 | "url": S.String, |
| 51 | 51 | "webp": S.String, |
| 52 | - "webp_size": S.String, | |
| 53 | - "width": S.String, | |
| 52 | + "webp_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 53 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 54 | 54 | }) {} |
| 55 | 55 | |
| 56 | 56 | export class DownsizedSmall extends S.Class<DownsizedSmall>("DownsizedSmall")({ |
| 57 | - "height": S.String, | |
| 57 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 58 | 58 | "mp4": S.String, |
| 59 | - "mp4_size": S.String, | |
| 60 | - "width": S.String, | |
| 59 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Downsized extends S.Class<Downsized>("Downsized")({ |
| 64 | - "height": S.String, | |
| 65 | - "size": S.optional(S.NullOr(S.String)), | |
| 64 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | + "size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 66 | 66 | "url": S.String, |
| 67 | - "width": S.String, | |
| 67 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 68 | 68 | }) {} |
| 69 | 69 | |
| 70 | 70 | export class Images extends S.Class<Images>("Images")({ |
Test case
1 generated file · +2 −2test/inputs/json/misc/458db.json
Mtypescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -14,9 +14,9 @@ export class Component extends S.Class<Component>("Component")({ | ||
| 14 | 14 | export class Result extends S.Class<Result>("Result")({ |
| 15 | 15 | "attachments": S.Array(S.Any), |
| 16 | 16 | "body": S.String, |
| 17 | - "changed": S.String, | |
| 17 | + "changed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 18 | 18 | "component": S.Array(Component), |
| 19 | - "created": S.String, | |
| 19 | + "created": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 20 | 20 | "date": S.String, |
| 21 | 21 | "image": S.Array(S.Any), |
| 22 | 22 | "teaser": S.Array(S.Any), |
Test case
1 generated file · +13 −13test/inputs/json/misc/4c547.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -2,9 +2,9 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class Wind extends S.Class<Wind>("Wind")({ |
| 5 | - "chill": S.String, | |
| 6 | - "direction": S.String, | |
| 7 | - "speed": S.String, | |
| 5 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 6 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 7 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 8 | 8 | }) {} |
| 9 | 9 | |
| 10 | 10 | export class Units extends S.Class<Units>("Units")({ |
| @@ -25,18 +25,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 25 | 25 | }) {} |
| 26 | 26 | |
| 27 | 27 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 28 | - "code": S.String, | |
| 28 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "date": S.String, |
| 30 | 30 | "day": S.String, |
| 31 | - "high": S.String, | |
| 32 | - "low": S.String, | |
| 31 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "text": S.String, |
| 34 | 34 | }) {} |
| 35 | 35 | |
| 36 | 36 | export class Condition extends S.Class<Condition>("Condition")({ |
| 37 | - "code": S.String, | |
| 37 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "date": S.String, |
| 39 | - "temp": S.String, | |
| 39 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": S.String, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| @@ -53,17 +53,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 53 | 53 | }) {} |
| 54 | 54 | |
| 55 | 55 | export class Image extends S.Class<Image>("Image")({ |
| 56 | - "height": S.String, | |
| 56 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "link": S.String, |
| 58 | 58 | "title": S.String, |
| 59 | 59 | "url": S.String, |
| 60 | - "width": S.String, | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 64 | - "humidity": S.String, | |
| 64 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | 65 | "pressure": S.String, |
| 66 | - "rising": S.String, | |
| 66 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | "visibility": S.String, |
| 68 | 68 | }) {} |
| 69 | 69 | |
| @@ -83,7 +83,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 83 | 83 | "link": S.String, |
| 84 | 84 | "location": Location, |
| 85 | 85 | "title": S.String, |
| 86 | - "ttl": S.String, | |
| 86 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 87 | 87 | "units": Units, |
| 88 | 88 | "wind": Wind, |
| 89 | 89 | }) {} |
Test case
1 generated file · +1 −1test/inputs/json/misc/5f7fe.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -101,7 +101,7 @@ export class Metadata extends S.Class<Metadata>("Metadata")({ | ||
| 101 | 101 | "availableDisplayTypes": S.Array(S.String), |
| 102 | 102 | "custom_fields": CustomFields, |
| 103 | 103 | "jsonQuery": JsonQuery, |
| 104 | - "rdfSubject": S.String, | |
| 104 | + "rdfSubject": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 105 | 105 | "renderTypeConfig": RenderTypeConfig, |
| 106 | 106 | }) {} |
Test case
1 generated file · +1 −1test/inputs/json/misc/617e8.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -99,7 +99,7 @@ export class Metadata extends S.Class<Metadata>("Metadata")({ | ||
| 99 | 99 | "availableDisplayTypes": S.Array(S.String), |
| 100 | 100 | "custom_fields": CustomFields, |
| 101 | 101 | "jsonQuery": JsonQuery, |
| 102 | - "rdfSubject": S.String, | |
| 102 | + "rdfSubject": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 103 | 103 | "renderTypeConfig": RenderTypeConfig, |
| 104 | 104 | }) {} |
Test case
1 generated file · +3 −3test/inputs/json/misc/65dec.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -75,12 +75,12 @@ export class Card extends S.Class<Card>("Card")({ | ||
| 75 | 75 | "layout": Layout, |
| 76 | 76 | "legalities": S.Array(LegalityElement), |
| 77 | 77 | "manaCost": S.optional(S.NullOr(S.String)), |
| 78 | - "mciNumber": S.optional(S.NullOr(S.String)), | |
| 78 | + "mciNumber": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 79 | 79 | "multiverseid": S.Int, |
| 80 | 80 | "name": S.String, |
| 81 | 81 | "originalText": S.String, |
| 82 | 82 | "originalType": S.String, |
| 83 | - "power": S.optional(S.NullOr(S.String)), | |
| 83 | + "power": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 84 | 84 | "printings": S.Array(S.String), |
| 85 | 85 | "rarity": Rarity, |
| 86 | 86 | "reserved": S.optional(S.NullOr(S.Boolean)), |
| @@ -88,7 +88,7 @@ export class Card extends S.Class<Card>("Card")({ | ||
| 88 | 88 | "subtypes": S.optional(S.NullOr(S.Array(S.String))), |
| 89 | 89 | "supertypes": S.optional(S.NullOr(S.Array(S.String))), |
| 90 | 90 | "text": S.optional(S.NullOr(S.String)), |
| 91 | - "toughness": S.optional(S.NullOr(S.String)), | |
| 91 | + "toughness": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 92 | 92 | "type": S.String, |
| 93 | 93 | "types": S.Array(Type), |
| 94 | 94 | "variations": S.optional(S.NullOr(S.Array(S.Int))), |
Test case
1 generated file · +3 −3test/inputs/json/misc/6c155.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -22,10 +22,10 @@ export class Component extends S.Class<Component>("Component")({ | ||
| 22 | 22 | export class Result extends S.Class<Result>("Result")({ |
| 23 | 23 | "attachment": S.Array(S.Any), |
| 24 | 24 | "body": S.String, |
| 25 | - "changed": S.String, | |
| 25 | + "changed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 26 | 26 | "component": S.Array(Component), |
| 27 | - "created": S.String, | |
| 28 | - "date": S.String, | |
| 27 | + "created": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 28 | + "date": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "image": S.Array(S.Any), |
| 30 | 30 | "location": Location, |
| 31 | 31 | "teaser": S.Null, |
Test case
1 generated file · +13 −13test/inputs/json/misc/6dec6.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -9,9 +9,9 @@ export const Text = S.Literal( | ||
| 9 | 9 | export type Text = S.Schema.Type<typeof Text>; |
| 10 | 10 | |
| 11 | 11 | export class Wind extends S.Class<Wind>("Wind")({ |
| 12 | - "chill": S.String, | |
| 13 | - "direction": S.String, | |
| 14 | - "speed": S.String, | |
| 12 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 13 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 14 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 15 | 15 | }) {} |
| 16 | 16 | |
| 17 | 17 | export class Units extends S.Class<Units>("Units")({ |
| @@ -32,18 +32,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 32 | 32 | }) {} |
| 33 | 33 | |
| 34 | 34 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 35 | - "code": S.String, | |
| 35 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 36 | 36 | "date": S.String, |
| 37 | 37 | "day": S.String, |
| 38 | - "high": S.String, | |
| 39 | - "low": S.String, | |
| 38 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 39 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": Text, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| 43 | 43 | export class Condition extends S.Class<Condition>("Condition")({ |
| 44 | - "code": S.String, | |
| 44 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 45 | 45 | "date": S.String, |
| 46 | - "temp": S.String, | |
| 46 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 47 | 47 | "text": S.String, |
| 48 | 48 | }) {} |
| 49 | 49 | |
| @@ -60,17 +60,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 60 | 60 | }) {} |
| 61 | 61 | |
| 62 | 62 | export class Image extends S.Class<Image>("Image")({ |
| 63 | - "height": S.String, | |
| 63 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 64 | 64 | "link": S.String, |
| 65 | 65 | "title": S.String, |
| 66 | 66 | "url": S.String, |
| 67 | - "width": S.String, | |
| 67 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 68 | 68 | }) {} |
| 69 | 69 | |
| 70 | 70 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 71 | - "humidity": S.String, | |
| 71 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 72 | 72 | "pressure": S.String, |
| 73 | - "rising": S.String, | |
| 73 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 74 | 74 | "visibility": S.String, |
| 75 | 75 | }) {} |
| 76 | 76 | |
| @@ -90,7 +90,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 90 | 90 | "link": S.String, |
| 91 | 91 | "location": Location, |
| 92 | 92 | "title": S.String, |
| 93 | - "ttl": S.String, | |
| 93 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 94 | 94 | "units": Units, |
| 95 | 95 | "wind": Wind, |
| 96 | 96 | }) {} |
Test case
1 generated file · +2 −2test/inputs/json/misc/734ad.json
Mtypescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -21,8 +21,8 @@ export class Result extends S.Class<Result>("Result")({ | ||
| 21 | 21 | "be_office_lat": S.optional(S.NullOr(S.Number)), |
| 22 | 22 | "be_office_lon": S.optional(S.NullOr(S.Number)), |
| 23 | 23 | "be_office_phone": S.optional(S.NullOr(S.String)), |
| 24 | - "be_office_post_code": S.optional(S.NullOr(S.String)), | |
| 25 | - "be_office_postbox": S.optional(S.NullOr(S.String)), | |
| 24 | + "be_office_post_code": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 25 | + "be_office_postbox": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 26 | 26 | "be_office_street": S.optional(S.NullOr(S.String)), |
| 27 | 27 | "be_office_town": S.optional(S.NullOr(S.String)), |
| 28 | 28 | "code_of_conduct": S.String, |
Test case
1 generated file · +13 −13test/inputs/json/misc/7681c.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -46,34 +46,34 @@ export class User extends S.Class<User>("User")({ | ||
| 46 | 46 | |
| 47 | 47 | export class Looping extends S.Class<Looping>("Looping")({ |
| 48 | 48 | "mp4": S.String, |
| 49 | - "mp4_size": S.String, | |
| 49 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 50 | 50 | }) {} |
| 51 | 51 | |
| 52 | 52 | export class FixedHeight extends S.Class<FixedHeight>("FixedHeight")({ |
| 53 | - "frames": S.optional(S.NullOr(S.String)), | |
| 53 | + "frames": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 54 | 54 | "hash": S.optional(S.NullOr(S.String)), |
| 55 | - "height": S.String, | |
| 55 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 56 | 56 | "mp4": S.optional(S.NullOr(S.String)), |
| 57 | - "mp4_size": S.optional(S.NullOr(S.String)), | |
| 58 | - "size": S.String, | |
| 57 | + "mp4_size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 58 | + "size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 59 | 59 | "url": S.String, |
| 60 | 60 | "webp": S.String, |
| 61 | - "webp_size": S.String, | |
| 62 | - "width": S.String, | |
| 61 | + "webp_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 62 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 63 | 63 | }) {} |
| 64 | 64 | |
| 65 | 65 | export class DownsizedSmall extends S.Class<DownsizedSmall>("DownsizedSmall")({ |
| 66 | - "height": S.String, | |
| 66 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | "mp4": S.String, |
| 68 | - "mp4_size": S.String, | |
| 69 | - "width": S.String, | |
| 68 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 69 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 70 | 70 | }) {} |
| 71 | 71 | |
| 72 | 72 | export class Downsized extends S.Class<Downsized>("Downsized")({ |
| 73 | - "height": S.String, | |
| 74 | - "size": S.optional(S.NullOr(S.String)), | |
| 73 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 74 | + "size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 75 | 75 | "url": S.String, |
| 76 | - "width": S.String, | |
| 76 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 77 | 77 | }) {} |
| 78 | 78 | |
| 79 | 79 | export class Images extends S.Class<Images>("Images")({ |
Test case
1 generated file · +1 −1test/inputs/json/misc/7eb30.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -40,7 +40,7 @@ export class Group extends S.Class<Group>("Group")({ | ||
| 40 | 40 | }) {} |
| 41 | 41 | |
| 42 | 42 | export class Result extends S.Class<Result>("Result")({ |
| 43 | - "code": S.String, | |
| 43 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 44 | 44 | "english": S.String, |
| 45 | 45 | "fav": S.Boolean, |
| 46 | 46 | "group": Group, |
Test case
1 generated file · +3 −3test/inputs/json/misc/7fbfb.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -17,7 +17,7 @@ export type Value = S.Schema.Type<typeof Value>; | ||
| 17 | 17 | export class FluffyTopLevel extends S.Class<FluffyTopLevel>("FluffyTopLevel")({ |
| 18 | 18 | "page": S.Int, |
| 19 | 19 | "pages": S.Int, |
| 20 | - "per_page": S.String, | |
| 20 | + "per_page": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 21 | 21 | "total": S.Int, |
| 22 | 22 | }) {} |
| 23 | 23 | |
| @@ -28,8 +28,8 @@ export class Country extends S.Class<Country>("Country")({ | ||
| 28 | 28 | |
| 29 | 29 | export class PurpleTopLevel extends S.Class<PurpleTopLevel>("PurpleTopLevel")({ |
| 30 | 30 | "country": Country, |
| 31 | - "date": S.String, | |
| 32 | - "decimal": S.String, | |
| 31 | + "date": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "decimal": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "indicator": Country, |
| 34 | 34 | "value": S.String, |
| 35 | 35 | }) {} |
Test case
1 generated file · +13 −13test/inputs/json/misc/88130.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -2,9 +2,9 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class Wind extends S.Class<Wind>("Wind")({ |
| 5 | - "chill": S.String, | |
| 6 | - "direction": S.String, | |
| 7 | - "speed": S.String, | |
| 5 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 6 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 7 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 8 | 8 | }) {} |
| 9 | 9 | |
| 10 | 10 | export class Units extends S.Class<Units>("Units")({ |
| @@ -25,18 +25,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 25 | 25 | }) {} |
| 26 | 26 | |
| 27 | 27 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 28 | - "code": S.String, | |
| 28 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "date": S.String, |
| 30 | 30 | "day": S.String, |
| 31 | - "high": S.String, | |
| 32 | - "low": S.String, | |
| 31 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "text": S.String, |
| 34 | 34 | }) {} |
| 35 | 35 | |
| 36 | 36 | export class Condition extends S.Class<Condition>("Condition")({ |
| 37 | - "code": S.String, | |
| 37 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "date": S.String, |
| 39 | - "temp": S.String, | |
| 39 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": S.String, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| @@ -53,17 +53,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 53 | 53 | }) {} |
| 54 | 54 | |
| 55 | 55 | export class Image extends S.Class<Image>("Image")({ |
| 56 | - "height": S.String, | |
| 56 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "link": S.String, |
| 58 | 58 | "title": S.String, |
| 59 | 59 | "url": S.String, |
| 60 | - "width": S.String, | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 64 | - "humidity": S.String, | |
| 64 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | 65 | "pressure": S.String, |
| 66 | - "rising": S.String, | |
| 66 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | "visibility": S.String, |
| 68 | 68 | }) {} |
| 69 | 69 | |
| @@ -83,7 +83,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 83 | 83 | "link": S.String, |
| 84 | 84 | "location": Location, |
| 85 | 85 | "title": S.String, |
| 86 | - "ttl": S.String, | |
| 86 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 87 | 87 | "units": Units, |
| 88 | 88 | "wind": Wind, |
| 89 | 89 | }) {} |
Test case
1 generated file · +13 −13test/inputs/json/misc/9929c.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -2,9 +2,9 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class Wind extends S.Class<Wind>("Wind")({ |
| 5 | - "chill": S.String, | |
| 6 | - "direction": S.String, | |
| 7 | - "speed": S.String, | |
| 5 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 6 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 7 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 8 | 8 | }) {} |
| 9 | 9 | |
| 10 | 10 | export class Units extends S.Class<Units>("Units")({ |
| @@ -25,18 +25,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 25 | 25 | }) {} |
| 26 | 26 | |
| 27 | 27 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 28 | - "code": S.String, | |
| 28 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "date": S.String, |
| 30 | 30 | "day": S.String, |
| 31 | - "high": S.String, | |
| 32 | - "low": S.String, | |
| 31 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "text": S.String, |
| 34 | 34 | }) {} |
| 35 | 35 | |
| 36 | 36 | export class Condition extends S.Class<Condition>("Condition")({ |
| 37 | - "code": S.String, | |
| 37 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "date": S.String, |
| 39 | - "temp": S.String, | |
| 39 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": S.String, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| @@ -53,17 +53,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 53 | 53 | }) {} |
| 54 | 54 | |
| 55 | 55 | export class Image extends S.Class<Image>("Image")({ |
| 56 | - "height": S.String, | |
| 56 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "link": S.String, |
| 58 | 58 | "title": S.String, |
| 59 | 59 | "url": S.String, |
| 60 | - "width": S.String, | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 64 | - "humidity": S.String, | |
| 64 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | 65 | "pressure": S.String, |
| 66 | - "rising": S.String, | |
| 66 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | "visibility": S.String, |
| 68 | 68 | }) {} |
| 69 | 69 | |
| @@ -83,7 +83,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 83 | 83 | "link": S.String, |
| 84 | 84 | "location": Location, |
| 85 | 85 | "title": S.String, |
| 86 | - "ttl": S.String, | |
| 86 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 87 | 87 | "units": Units, |
| 88 | 88 | "wind": Wind, |
| 89 | 89 | }) {} |
Test case
1 generated file · +13 −13test/inputs/json/misc/a1eca.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -2,9 +2,9 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class Wind extends S.Class<Wind>("Wind")({ |
| 5 | - "chill": S.String, | |
| 6 | - "direction": S.String, | |
| 7 | - "speed": S.String, | |
| 5 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 6 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 7 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 8 | 8 | }) {} |
| 9 | 9 | |
| 10 | 10 | export class Units extends S.Class<Units>("Units")({ |
| @@ -25,18 +25,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 25 | 25 | }) {} |
| 26 | 26 | |
| 27 | 27 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 28 | - "code": S.String, | |
| 28 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "date": S.String, |
| 30 | 30 | "day": S.String, |
| 31 | - "high": S.String, | |
| 32 | - "low": S.String, | |
| 31 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "text": S.String, |
| 34 | 34 | }) {} |
| 35 | 35 | |
| 36 | 36 | export class Condition extends S.Class<Condition>("Condition")({ |
| 37 | - "code": S.String, | |
| 37 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "date": S.String, |
| 39 | - "temp": S.String, | |
| 39 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": S.String, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| @@ -53,17 +53,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 53 | 53 | }) {} |
| 54 | 54 | |
| 55 | 55 | export class Image extends S.Class<Image>("Image")({ |
| 56 | - "height": S.String, | |
| 56 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "link": S.String, |
| 58 | 58 | "title": S.String, |
| 59 | 59 | "url": S.String, |
| 60 | - "width": S.String, | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 64 | - "humidity": S.String, | |
| 64 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | 65 | "pressure": S.String, |
| 66 | - "rising": S.String, | |
| 66 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | "visibility": S.String, |
| 68 | 68 | }) {} |
| 69 | 69 | |
| @@ -83,7 +83,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 83 | 83 | "link": S.String, |
| 84 | 84 | "location": Location, |
| 85 | 85 | "title": S.String, |
| 86 | - "ttl": S.String, | |
| 86 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 87 | 87 | "units": Units, |
| 88 | 88 | "wind": Wind, |
| 89 | 89 | }) {} |
Test case
1 generated file · +3 −3test/inputs/json/misc/a3d8c.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -25,9 +25,9 @@ export class RenderTypeConfig extends S.Class<RenderTypeConfig>("RenderTypeConfi | ||
| 25 | 25 | export class Metadata extends S.Class<Metadata>("Metadata")({ |
| 26 | 26 | "availableDisplayTypes": S.Array(S.String), |
| 27 | 27 | "rdfClass": S.String, |
| 28 | - "rdfSubject": S.String, | |
| 28 | + "rdfSubject": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "renderTypeConfig": RenderTypeConfig, |
| 30 | - "rowIdentifier": S.String, | |
| 30 | + "rowIdentifier": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 31 | 31 | }) {} |
| 32 | 32 | |
| 33 | 33 | export class License extends S.Class<License>("License")({ |
| @@ -54,7 +54,7 @@ export class CachedContents extends S.Class<CachedContents>("CachedContents")({ | ||
| 54 | 54 | "non_null": S.Int, |
| 55 | 55 | "null": S.Int, |
| 56 | 56 | "smallest": S.String, |
| 57 | - "sum": S.optional(S.NullOr(S.String)), | |
| 57 | + "sum": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 58 | 58 | "top": S.Array(Top), |
| 59 | 59 | }) {} |
Test case
1 generated file · +1 −1test/inputs/json/misc/ae9ca.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -43,7 +43,7 @@ export class Properties extends S.Class<Properties>("Properties")({ | ||
| 43 | 43 | "lat": S.String, |
| 44 | 44 | "long": S.String, |
| 45 | 45 | "Maintaining Authority": MaintainingAuthority, |
| 46 | - "Number": S.String, | |
| 46 | + "Number": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 47 | 47 | "Site Name": S.String, |
| 48 | 48 | "Ward": Ward, |
| 49 | 49 | }) {} |
Test case
1 generated file · +1 −1test/inputs/json/misc/af2d1.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -85,7 +85,7 @@ export class FeatureProperties extends S.Class<FeatureProperties>("FeatureProper | ||
| 85 | 85 | "documents": S.String, |
| 86 | 86 | "drawing_nu": S.NullOr(S.String), |
| 87 | 87 | "file_numbe": S.NullOr(S.String), |
| 88 | - "folder_num": S.NullOr(S.String), | |
| 88 | + "folder_num": S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/))), | |
| 89 | 89 | "funding_ba": S.NullOr(FundingBa), |
| 90 | 90 | "historic_c": S.Int, |
| 91 | 91 | "inspection": S.String, |
Test case
1 generated file · +3 −3test/inputs/json/misc/b4865.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -25,11 +25,11 @@ export class Geolocation extends S.Class<Geolocation>("Geolocation")({ | ||
| 25 | 25 | }) {} |
| 26 | 26 | |
| 27 | 27 | export class TopLevelElement extends S.Class<TopLevelElement>("TopLevelElement")({ |
| 28 | - ":@computed_region_cbhk_fwbd": S.optional(S.NullOr(S.String)), | |
| 29 | - ":@computed_region_nnqa_25f4": S.optional(S.NullOr(S.String)), | |
| 28 | + ":@computed_region_cbhk_fwbd": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 29 | + ":@computed_region_nnqa_25f4": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 30 | 30 | "fall": Fall, |
| 31 | 31 | "geolocation": S.optional(S.NullOr(Geolocation)), |
| 32 | - "id": S.String, | |
| 32 | + "id": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "mass": S.optional(S.NullOr(S.String)), |
| 34 | 34 | "name": S.String, |
| 35 | 35 | "nametype": Nametype, |
Test case
1 generated file · +13 −13test/inputs/json/misc/c3303.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -43,34 +43,34 @@ export class User extends S.Class<User>("User")({ | ||
| 43 | 43 | |
| 44 | 44 | export class Looping extends S.Class<Looping>("Looping")({ |
| 45 | 45 | "mp4": S.String, |
| 46 | - "mp4_size": S.String, | |
| 46 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 47 | 47 | }) {} |
| 48 | 48 | |
| 49 | 49 | export class FixedHeight extends S.Class<FixedHeight>("FixedHeight")({ |
| 50 | - "frames": S.optional(S.NullOr(S.String)), | |
| 50 | + "frames": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 51 | 51 | "hash": S.optional(S.NullOr(S.String)), |
| 52 | - "height": S.String, | |
| 52 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 53 | 53 | "mp4": S.optional(S.NullOr(S.String)), |
| 54 | - "mp4_size": S.optional(S.NullOr(S.String)), | |
| 55 | - "size": S.String, | |
| 54 | + "mp4_size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 55 | + "size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 56 | 56 | "url": S.String, |
| 57 | 57 | "webp": S.String, |
| 58 | - "webp_size": S.String, | |
| 59 | - "width": S.String, | |
| 58 | + "webp_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 59 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 60 | 60 | }) {} |
| 61 | 61 | |
| 62 | 62 | export class DownsizedSmall extends S.Class<DownsizedSmall>("DownsizedSmall")({ |
| 63 | - "height": S.String, | |
| 63 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 64 | 64 | "mp4": S.String, |
| 65 | - "mp4_size": S.String, | |
| 66 | - "width": S.String, | |
| 65 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 66 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | }) {} |
| 68 | 68 | |
| 69 | 69 | export class Downsized extends S.Class<Downsized>("Downsized")({ |
| 70 | - "height": S.String, | |
| 71 | - "size": S.optional(S.NullOr(S.String)), | |
| 70 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 71 | + "size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 72 | 72 | "url": S.String, |
| 73 | - "width": S.String, | |
| 73 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 74 | 74 | }) {} |
| 75 | 75 | |
| 76 | 76 | export class Images extends S.Class<Images>("Images")({ |
Test case
1 generated file · +3 −3test/inputs/json/misc/c8c7e.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -17,7 +17,7 @@ export type Value = S.Schema.Type<typeof Value>; | ||
| 17 | 17 | export class FluffyTopLevel extends S.Class<FluffyTopLevel>("FluffyTopLevel")({ |
| 18 | 18 | "page": S.Int, |
| 19 | 19 | "pages": S.Int, |
| 20 | - "per_page": S.String, | |
| 20 | + "per_page": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 21 | 21 | "total": S.Int, |
| 22 | 22 | }) {} |
| 23 | 23 | |
| @@ -28,8 +28,8 @@ export class Country extends S.Class<Country>("Country")({ | ||
| 28 | 28 | |
| 29 | 29 | export class PurpleTopLevel extends S.Class<PurpleTopLevel>("PurpleTopLevel")({ |
| 30 | 30 | "country": Country, |
| 31 | - "date": S.String, | |
| 32 | - "decimal": S.String, | |
| 31 | + "date": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "decimal": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "indicator": Country, |
| 34 | 34 | "value": S.String, |
| 35 | 35 | }) {} |
Test case
1 generated file · +3 −3test/inputs/json/misc/cb0cc.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -13,9 +13,9 @@ export type Category = S.Schema.Type<typeof Category>; | ||
| 13 | 13 | |
| 14 | 14 | export class Laureate extends S.Class<Laureate>("Laureate")({ |
| 15 | 15 | "firstname": S.String, |
| 16 | - "id": S.String, | |
| 16 | + "id": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 17 | 17 | "motivation": S.optional(S.NullOr(S.String)), |
| 18 | - "share": S.String, | |
| 18 | + "share": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 19 | 19 | "surname": S.String, |
| 20 | 20 | }) {} |
| 21 | 21 | |
| @@ -23,7 +23,7 @@ export class Prize extends S.Class<Prize>("Prize")({ | ||
| 23 | 23 | "category": Category, |
| 24 | 24 | "laureates": S.Array(Laureate), |
| 25 | 25 | "overallMotivation": S.optional(S.NullOr(S.String)), |
| 26 | - "year": S.String, | |
| 26 | + "year": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 27 | 27 | }) {} |
| 28 | 28 | |
| 29 | 29 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
Test case
1 generated file · +4 −4test/inputs/json/misc/cda6c.json
Mtypescript-effect-schemadefault / TopLevel.ts+4 −4
| @@ -17,7 +17,7 @@ export type Value = S.Schema.Type<typeof Value>; | ||
| 17 | 17 | export class FluffyTopLevel extends S.Class<FluffyTopLevel>("FluffyTopLevel")({ |
| 18 | 18 | "page": S.Int, |
| 19 | 19 | "pages": S.Int, |
| 20 | - "per_page": S.String, | |
| 20 | + "per_page": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 21 | 21 | "total": S.Int, |
| 22 | 22 | }) {} |
| 23 | 23 | |
| @@ -28,10 +28,10 @@ export class Country extends S.Class<Country>("Country")({ | ||
| 28 | 28 | |
| 29 | 29 | export class PurpleTopLevel extends S.Class<PurpleTopLevel>("PurpleTopLevel")({ |
| 30 | 30 | "country": Country, |
| 31 | - "date": S.String, | |
| 32 | - "decimal": S.String, | |
| 31 | + "date": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "decimal": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "indicator": Country, |
| 34 | - "value": S.String, | |
| 34 | + "value": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 35 | 35 | }) {} |
| 36 | 36 | |
| 37 | 37 | export const TopLevel = S.Array(S.Union(S.Array(PurpleTopLevel), FluffyTopLevel)); |
Test case
1 generated file · +13 −13test/inputs/json/misc/cf0d8.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -2,9 +2,9 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class Wind extends S.Class<Wind>("Wind")({ |
| 5 | - "chill": S.String, | |
| 6 | - "direction": S.String, | |
| 7 | - "speed": S.String, | |
| 5 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 6 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 7 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 8 | 8 | }) {} |
| 9 | 9 | |
| 10 | 10 | export class Units extends S.Class<Units>("Units")({ |
| @@ -25,18 +25,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 25 | 25 | }) {} |
| 26 | 26 | |
| 27 | 27 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 28 | - "code": S.String, | |
| 28 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "date": S.String, |
| 30 | 30 | "day": S.String, |
| 31 | - "high": S.String, | |
| 32 | - "low": S.String, | |
| 31 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "text": S.String, |
| 34 | 34 | }) {} |
| 35 | 35 | |
| 36 | 36 | export class Condition extends S.Class<Condition>("Condition")({ |
| 37 | - "code": S.String, | |
| 37 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "date": S.String, |
| 39 | - "temp": S.String, | |
| 39 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": S.String, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| @@ -53,17 +53,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 53 | 53 | }) {} |
| 54 | 54 | |
| 55 | 55 | export class Image extends S.Class<Image>("Image")({ |
| 56 | - "height": S.String, | |
| 56 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "link": S.String, |
| 58 | 58 | "title": S.String, |
| 59 | 59 | "url": S.String, |
| 60 | - "width": S.String, | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 64 | - "humidity": S.String, | |
| 64 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | 65 | "pressure": S.String, |
| 66 | - "rising": S.String, | |
| 66 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | "visibility": S.String, |
| 68 | 68 | }) {} |
| 69 | 69 | |
| @@ -83,7 +83,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 83 | 83 | "link": S.String, |
| 84 | 84 | "location": Location, |
| 85 | 85 | "title": S.String, |
| 86 | - "ttl": S.String, | |
| 86 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 87 | 87 | "units": Units, |
| 88 | 88 | "wind": Wind, |
| 89 | 89 | }) {} |
Test case
1 generated file · +13 −13test/inputs/json/misc/dbfb3.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -8,9 +8,9 @@ export const Text = S.Literal( | ||
| 8 | 8 | export type Text = S.Schema.Type<typeof Text>; |
| 9 | 9 | |
| 10 | 10 | export class Wind extends S.Class<Wind>("Wind")({ |
| 11 | - "chill": S.String, | |
| 12 | - "direction": S.String, | |
| 13 | - "speed": S.String, | |
| 11 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 12 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 13 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 14 | 14 | }) {} |
| 15 | 15 | |
| 16 | 16 | export class Units extends S.Class<Units>("Units")({ |
| @@ -31,18 +31,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 31 | 31 | }) {} |
| 32 | 32 | |
| 33 | 33 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 34 | - "code": S.String, | |
| 34 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 35 | 35 | "date": S.String, |
| 36 | 36 | "day": S.String, |
| 37 | - "high": S.String, | |
| 38 | - "low": S.String, | |
| 37 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 39 | 39 | "text": Text, |
| 40 | 40 | }) {} |
| 41 | 41 | |
| 42 | 42 | export class Condition extends S.Class<Condition>("Condition")({ |
| 43 | - "code": S.String, | |
| 43 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 44 | 44 | "date": S.String, |
| 45 | - "temp": S.String, | |
| 45 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 46 | 46 | "text": Text, |
| 47 | 47 | }) {} |
| 48 | 48 | |
| @@ -59,17 +59,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 59 | 59 | }) {} |
| 60 | 60 | |
| 61 | 61 | export class Image extends S.Class<Image>("Image")({ |
| 62 | - "height": S.String, | |
| 62 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 63 | 63 | "link": S.String, |
| 64 | 64 | "title": S.String, |
| 65 | 65 | "url": S.String, |
| 66 | - "width": S.String, | |
| 66 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | }) {} |
| 68 | 68 | |
| 69 | 69 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 70 | - "humidity": S.String, | |
| 70 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 71 | 71 | "pressure": S.String, |
| 72 | - "rising": S.String, | |
| 72 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 73 | 73 | "visibility": S.String, |
| 74 | 74 | }) {} |
| 75 | 75 | |
| @@ -89,7 +89,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 89 | 89 | "link": S.String, |
| 90 | 90 | "location": Location, |
| 91 | 91 | "title": S.String, |
| 92 | - "ttl": S.String, | |
| 92 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 93 | 93 | "units": Units, |
| 94 | 94 | "wind": Wind, |
| 95 | 95 | }) {} |
Test case
1 generated file · +1 −1test/inputs/json/misc/dc44f.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -124,7 +124,7 @@ export class Card extends S.Class<Card>("Card")({ | ||
| 124 | 124 | "layout": Layout, |
| 125 | 125 | "legalities": S.Array(LegalityElement), |
| 126 | 126 | "manaCost": S.optional(S.NullOr(S.String)), |
| 127 | - "mciNumber": S.optional(S.NullOr(S.String)), | |
| 127 | + "mciNumber": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 128 | 128 | "multiverseid": S.Int, |
| 129 | 129 | "name": S.String, |
| 130 | 130 | "originalText": S.optional(S.NullOr(S.String)), |
Test case
1 generated file · +1 −1test/inputs/json/misc/dd1ce.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -124,7 +124,7 @@ export class Card extends S.Class<Card>("Card")({ | ||
| 124 | 124 | "layout": Layout, |
| 125 | 125 | "legalities": S.Array(LegalityElement), |
| 126 | 126 | "manaCost": S.optional(S.NullOr(S.String)), |
| 127 | - "mciNumber": S.optional(S.NullOr(S.String)), | |
| 127 | + "mciNumber": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 128 | 128 | "multiverseid": S.Int, |
| 129 | 129 | "name": S.String, |
| 130 | 130 | "originalText": S.optional(S.NullOr(S.String)), |
Test case
1 generated file · +4 −4test/inputs/json/misc/dec3a.json
Mtypescript-effect-schemadefault / TopLevel.ts+4 −4
| @@ -9,7 +9,7 @@ export class Location extends S.Class<Location>("Location")({ | ||
| 9 | 9 | "mobile_number": S.String, |
| 10 | 10 | "phone_number": S.String, |
| 11 | 11 | "phone_number_extension": S.String, |
| 12 | - "postal_code": S.String, | |
| 12 | + "postal_code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 13 | 13 | "sub_premise": S.Null, |
| 14 | 14 | "thoroughfare": S.String, |
| 15 | 15 | }) {} |
| @@ -23,15 +23,15 @@ export class Result extends S.Class<Result>("Result")({ | ||
| 23 | 23 | "about_office": S.String, |
| 24 | 24 | "application_process": S.String, |
| 25 | 25 | "body": S.String, |
| 26 | - "changed": S.String, | |
| 27 | - "created": S.String, | |
| 26 | + "changed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 27 | + "created": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 28 | 28 | "deadline": S.Null, |
| 29 | 29 | "hiring_office": S.Null, |
| 30 | 30 | "hiring_org": HiringOrg, |
| 31 | 31 | "job_id": S.Null, |
| 32 | 32 | "language": S.String, |
| 33 | 33 | "location": Location, |
| 34 | - "num_positions": S.String, | |
| 34 | + "num_positions": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 35 | 35 | "position": S.String, |
| 36 | 36 | "practice_area": S.String, |
| 37 | 37 | "qualifications": S.String, |
Test case
1 generated file · +13 −13test/inputs/json/misc/df957.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -2,9 +2,9 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class Wind extends S.Class<Wind>("Wind")({ |
| 5 | - "chill": S.String, | |
| 6 | - "direction": S.String, | |
| 7 | - "speed": S.String, | |
| 5 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 6 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 7 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 8 | 8 | }) {} |
| 9 | 9 | |
| 10 | 10 | export class Units extends S.Class<Units>("Units")({ |
| @@ -25,18 +25,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 25 | 25 | }) {} |
| 26 | 26 | |
| 27 | 27 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 28 | - "code": S.String, | |
| 28 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "date": S.String, |
| 30 | 30 | "day": S.String, |
| 31 | - "high": S.String, | |
| 32 | - "low": S.String, | |
| 31 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "text": S.String, |
| 34 | 34 | }) {} |
| 35 | 35 | |
| 36 | 36 | export class Condition extends S.Class<Condition>("Condition")({ |
| 37 | - "code": S.String, | |
| 37 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "date": S.String, |
| 39 | - "temp": S.String, | |
| 39 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 40 | 40 | "text": S.String, |
| 41 | 41 | }) {} |
| 42 | 42 | |
| @@ -53,17 +53,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 53 | 53 | }) {} |
| 54 | 54 | |
| 55 | 55 | export class Image extends S.Class<Image>("Image")({ |
| 56 | - "height": S.String, | |
| 56 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "link": S.String, |
| 58 | 58 | "title": S.String, |
| 59 | 59 | "url": S.String, |
| 60 | - "width": S.String, | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 64 | - "humidity": S.String, | |
| 64 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | 65 | "pressure": S.String, |
| 66 | - "rising": S.String, | |
| 66 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 67 | 67 | "visibility": S.String, |
| 68 | 68 | }) {} |
| 69 | 69 | |
| @@ -83,7 +83,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 83 | 83 | "link": S.String, |
| 84 | 84 | "location": Location, |
| 85 | 85 | "title": S.String, |
| 86 | - "ttl": S.String, | |
| 86 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 87 | 87 | "units": Units, |
| 88 | 88 | "wind": Wind, |
| 89 | 89 | }) {} |
Test case
1 generated file · +13 −13test/inputs/json/misc/e0ac7.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -37,34 +37,34 @@ export class User extends S.Class<User>("User")({ | ||
| 37 | 37 | |
| 38 | 38 | export class Looping extends S.Class<Looping>("Looping")({ |
| 39 | 39 | "mp4": S.String, |
| 40 | - "mp4_size": S.String, | |
| 40 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 41 | 41 | }) {} |
| 42 | 42 | |
| 43 | 43 | export class FixedHeight extends S.Class<FixedHeight>("FixedHeight")({ |
| 44 | - "frames": S.optional(S.NullOr(S.String)), | |
| 44 | + "frames": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 45 | 45 | "hash": S.optional(S.NullOr(S.String)), |
| 46 | - "height": S.String, | |
| 46 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 47 | 47 | "mp4": S.optional(S.NullOr(S.String)), |
| 48 | - "mp4_size": S.optional(S.NullOr(S.String)), | |
| 49 | - "size": S.String, | |
| 48 | + "mp4_size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 49 | + "size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 50 | 50 | "url": S.String, |
| 51 | 51 | "webp": S.String, |
| 52 | - "webp_size": S.String, | |
| 53 | - "width": S.String, | |
| 52 | + "webp_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 53 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 54 | 54 | }) {} |
| 55 | 55 | |
| 56 | 56 | export class DownsizedSmall extends S.Class<DownsizedSmall>("DownsizedSmall")({ |
| 57 | - "height": S.String, | |
| 57 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 58 | 58 | "mp4": S.String, |
| 59 | - "mp4_size": S.String, | |
| 60 | - "width": S.String, | |
| 59 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 60 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 61 | 61 | }) {} |
| 62 | 62 | |
| 63 | 63 | export class Downsized extends S.Class<Downsized>("Downsized")({ |
| 64 | - "height": S.String, | |
| 65 | - "size": S.optional(S.NullOr(S.String)), | |
| 64 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 65 | + "size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 66 | 66 | "url": S.String, |
| 67 | - "width": S.String, | |
| 67 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 68 | 68 | }) {} |
| 69 | 69 | |
| 70 | 70 | export class Images extends S.Class<Images>("Images")({ |
Test case
1 generated file · +13 −13test/inputs/json/misc/e2915.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -7,9 +7,9 @@ export const Text = S.Literal( | ||
| 7 | 7 | export type Text = S.Schema.Type<typeof Text>; |
| 8 | 8 | |
| 9 | 9 | export class Wind extends S.Class<Wind>("Wind")({ |
| 10 | - "chill": S.String, | |
| 11 | - "direction": S.String, | |
| 12 | - "speed": S.String, | |
| 10 | + "chill": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 11 | + "direction": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 12 | + "speed": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 13 | 13 | }) {} |
| 14 | 14 | |
| 15 | 15 | export class Units extends S.Class<Units>("Units")({ |
| @@ -30,18 +30,18 @@ export class Guid extends S.Class<Guid>("Guid")({ | ||
| 30 | 30 | }) {} |
| 31 | 31 | |
| 32 | 32 | export class Forecast extends S.Class<Forecast>("Forecast")({ |
| 33 | - "code": S.String, | |
| 33 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 34 | 34 | "date": S.String, |
| 35 | 35 | "day": S.String, |
| 36 | - "high": S.String, | |
| 37 | - "low": S.String, | |
| 36 | + "high": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 37 | + "low": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 38 | 38 | "text": Text, |
| 39 | 39 | }) {} |
| 40 | 40 | |
| 41 | 41 | export class Condition extends S.Class<Condition>("Condition")({ |
| 42 | - "code": S.String, | |
| 42 | + "code": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 43 | 43 | "date": S.String, |
| 44 | - "temp": S.String, | |
| 44 | + "temp": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 45 | 45 | "text": S.String, |
| 46 | 46 | }) {} |
| 47 | 47 | |
| @@ -58,17 +58,17 @@ export class Item extends S.Class<Item>("Item")({ | ||
| 58 | 58 | }) {} |
| 59 | 59 | |
| 60 | 60 | export class Image extends S.Class<Image>("Image")({ |
| 61 | - "height": S.String, | |
| 61 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 62 | 62 | "link": S.String, |
| 63 | 63 | "title": S.String, |
| 64 | 64 | "url": S.String, |
| 65 | - "width": S.String, | |
| 65 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 66 | 66 | }) {} |
| 67 | 67 | |
| 68 | 68 | export class Atmosphere extends S.Class<Atmosphere>("Atmosphere")({ |
| 69 | - "humidity": S.String, | |
| 69 | + "humidity": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 70 | 70 | "pressure": S.String, |
| 71 | - "rising": S.String, | |
| 71 | + "rising": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 72 | 72 | "visibility": S.String, |
| 73 | 73 | }) {} |
| 74 | 74 | |
| @@ -88,7 +88,7 @@ export class Channel extends S.Class<Channel>("Channel")({ | ||
| 88 | 88 | "link": S.String, |
| 89 | 89 | "location": Location, |
| 90 | 90 | "title": S.String, |
| 91 | - "ttl": S.String, | |
| 91 | + "ttl": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 92 | 92 | "units": Units, |
| 93 | 93 | "wind": Wind, |
| 94 | 94 | }) {} |
Test case
1 generated file · +4 −4test/inputs/json/misc/e53b5.json
Mtypescript-effect-schemadefault / TopLevel.ts+4 −4
| @@ -17,7 +17,7 @@ export type Value = S.Schema.Type<typeof Value>; | ||
| 17 | 17 | export class FluffyTopLevel extends S.Class<FluffyTopLevel>("FluffyTopLevel")({ |
| 18 | 18 | "page": S.Int, |
| 19 | 19 | "pages": S.Int, |
| 20 | - "per_page": S.String, | |
| 20 | + "per_page": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 21 | 21 | "total": S.Int, |
| 22 | 22 | }) {} |
| 23 | 23 | |
| @@ -28,10 +28,10 @@ export class Country extends S.Class<Country>("Country")({ | ||
| 28 | 28 | |
| 29 | 29 | export class PurpleTopLevel extends S.Class<PurpleTopLevel>("PurpleTopLevel")({ |
| 30 | 30 | "country": Country, |
| 31 | - "date": S.String, | |
| 32 | - "decimal": S.String, | |
| 31 | + "date": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 32 | + "decimal": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 33 | 33 | "indicator": Country, |
| 34 | - "value": S.String, | |
| 34 | + "value": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 35 | 35 | }) {} |
| 36 | 36 | |
| 37 | 37 | export const TopLevel = S.Array(S.Union(S.Array(PurpleTopLevel), FluffyTopLevel)); |
Test case
1 generated file · +2 −2test/inputs/json/misc/e8b04.json
Mtypescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -168,7 +168,7 @@ export class AccessPoints extends S.Class<AccessPoints>("AccessPoints")({ | ||
| 168 | 168 | |
| 169 | 169 | export class V1ArchivedProperties extends S.Class<V1ArchivedProperties>("V1ArchivedProperties")({ |
| 170 | 170 | "accessPoints": AccessPoints, |
| 171 | - "blist_id": S.String, | |
| 171 | + "blist_id": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 172 | 172 | "renderTypeConfig": V1ArchivedPropertiesRenderTypeConfig, |
| 173 | 173 | }) {} |
| 174 | 174 | |
| @@ -269,7 +269,7 @@ export class TopLevelMetadata extends S.Class<TopLevelMetadata>("TopLevelMetadat | ||
| 269 | 269 | "custom_fields": S.optional(S.NullOr(CustomFields)), |
| 270 | 270 | "jsonQuery": S.optional(S.NullOr(JsonQuery)), |
| 271 | 271 | "rdfClass": S.optional(S.NullOr(S.String)), |
| 272 | - "rdfSubject": S.optional(S.NullOr(S.String)), | |
| 272 | + "rdfSubject": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 273 | 273 | "renderTypeConfig": S.optional(S.NullOr(MetadataRenderTypeConfig)), |
| 274 | 274 | "richRendererConfigs": S.optional(S.NullOr(RichRendererConfigs)), |
| 275 | 275 | "rowIdentifier": S.optional(S.NullOr(S.String)), |
Test case
1 generated file · +13 −13test/inputs/json/misc/f6a65.json
Mtypescript-effect-schemadefault / TopLevel.ts+13 −13
| @@ -47,34 +47,34 @@ export class User extends S.Class<User>("User")({ | ||
| 47 | 47 | |
| 48 | 48 | export class Looping extends S.Class<Looping>("Looping")({ |
| 49 | 49 | "mp4": S.String, |
| 50 | - "mp4_size": S.String, | |
| 50 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 51 | 51 | }) {} |
| 52 | 52 | |
| 53 | 53 | export class FixedHeight extends S.Class<FixedHeight>("FixedHeight")({ |
| 54 | - "frames": S.optional(S.NullOr(S.String)), | |
| 54 | + "frames": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 55 | 55 | "hash": S.optional(S.NullOr(S.String)), |
| 56 | - "height": S.String, | |
| 56 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 57 | 57 | "mp4": S.optional(S.NullOr(S.String)), |
| 58 | - "mp4_size": S.optional(S.NullOr(S.String)), | |
| 59 | - "size": S.String, | |
| 58 | + "mp4_size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 59 | + "size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 60 | 60 | "url": S.String, |
| 61 | 61 | "webp": S.String, |
| 62 | - "webp_size": S.String, | |
| 63 | - "width": S.String, | |
| 62 | + "webp_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 63 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 64 | 64 | }) {} |
| 65 | 65 | |
| 66 | 66 | export class DownsizedSmall extends S.Class<DownsizedSmall>("DownsizedSmall")({ |
| 67 | - "height": S.String, | |
| 67 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 68 | 68 | "mp4": S.String, |
| 69 | - "mp4_size": S.String, | |
| 70 | - "width": S.String, | |
| 69 | + "mp4_size": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 70 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 71 | 71 | }) {} |
| 72 | 72 | |
| 73 | 73 | export class Downsized extends S.Class<Downsized>("Downsized")({ |
| 74 | - "height": S.String, | |
| 75 | - "size": S.optional(S.NullOr(S.String)), | |
| 74 | + "height": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 75 | + "size": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 76 | 76 | "url": S.String, |
| 77 | - "width": S.String, | |
| 77 | + "width": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 78 | 78 | }) {} |
| 79 | 79 | |
| 80 | 80 | export class Images extends S.Class<Images>("Images")({ |
Test case
1 generated file · +3 −3test/inputs/json/misc/f74d5.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -25,9 +25,9 @@ export class RenderTypeConfig extends S.Class<RenderTypeConfig>("RenderTypeConfi | ||
| 25 | 25 | export class Metadata extends S.Class<Metadata>("Metadata")({ |
| 26 | 26 | "availableDisplayTypes": S.Array(S.String), |
| 27 | 27 | "rdfClass": S.String, |
| 28 | - "rdfSubject": S.String, | |
| 28 | + "rdfSubject": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 29 | 29 | "renderTypeConfig": RenderTypeConfig, |
| 30 | - "rowIdentifier": S.String, | |
| 30 | + "rowIdentifier": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 31 | 31 | }) {} |
| 32 | 32 | |
| 33 | 33 | export class License extends S.Class<License>("License")({ |
| @@ -54,7 +54,7 @@ export class CachedContents extends S.Class<CachedContents>("CachedContents")({ | ||
| 54 | 54 | "non_null": S.Int, |
| 55 | 55 | "null": S.Int, |
| 56 | 56 | "smallest": S.String, |
| 57 | - "sum": S.optional(S.NullOr(S.String)), | |
| 57 | + "sum": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 58 | 58 | "top": S.Array(Top), |
| 59 | 59 | }) {} |
Test case
1 generated file · +2 −2test/inputs/json/misc/fcca3.json
Mtypescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -122,7 +122,7 @@ export class ViewMetadata extends S.Class<ViewMetadata>("ViewMetadata")({ | ||
| 122 | 122 | "custom_fields": CustomFields, |
| 123 | 123 | "filterCondition": FilterCondition, |
| 124 | 124 | "jsonQuery": JsonQuery, |
| 125 | - "rdfSubject": S.String, | |
| 125 | + "rdfSubject": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 126 | 126 | "renderTypeConfig": RenderTypeConfig, |
| 127 | 127 | "rowLabel": S.String, |
| 128 | 128 | }) {} |
| @@ -150,7 +150,7 @@ export class CachedContents extends S.Class<CachedContents>("CachedContents")({ | ||
| 150 | 150 | "non_null": S.Int, |
| 151 | 151 | "null": S.Int, |
| 152 | 152 | "smallest": S.String, |
| 153 | - "sum": S.optional(S.NullOr(S.String)), | |
| 153 | + "sum": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 154 | 154 | "top": S.Array(Top), |
| 155 | 155 | }) {} |
Test case
1 generated file · +3 −3test/inputs/json/priority/blns-object.json
Mtypescript-effect-schemadefault / TopLevel.ts+3 −3
| @@ -366,7 +366,7 @@ export class A extends S.Class<A>("A")({ | ||
| 366 | 366 | "-0": S.String, |
| 367 | 367 | "0,00": S.String, |
| 368 | 368 | "0.0/0.0": S.String, |
| 369 | - "1": S.String, | |
| 369 | + "1": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 370 | 370 | "1'000'000.00": S.String, |
| 371 | 371 | "1E02": S.String, |
| 372 | 372 | "';alert(123);t='": S.String, |
| @@ -487,7 +487,7 @@ export class A extends S.Class<A>("A")({ | ||
| 487 | 487 | "perl -e 'print \"<IMG SRC=java\\0script:alert(\\\"XSS\\\")>\";' > out": S.String, |
| 488 | 488 | "PRN": S.String, |
| 489 | 489 | "'": S.String, |
| 490 | - "0": S.String, | |
| 490 | + "0": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 491 | 491 | "\u2066test\u2067": S.String, |
| 492 | 492 | "RomansInSussex.co.uk": S.String, |
| 493 | 493 | "%s": S.String, |
| @@ -539,7 +539,7 @@ export class A extends S.Class<A>("A")({ | ||
| 539 | 539 | "0,0/0,0": S.String, |
| 540 | 540 | "00˙Ɩ$-": S.String, |
| 541 | 541 | "0x0": S.String, |
| 542 | - "-1": S.String, | |
| 542 | + "-1": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 543 | 543 | "1/0": S.String, |
| 544 | 544 | "1.00": S.String, |
| 545 | 545 | "1.0/0.0": S.String, |
Test case
1 generated file · +1 −1test/inputs/json/priority/bug855-short.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as S from "effect/Schema"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export class TopLevelValue extends S.Class<TopLevelValue>("TopLevelValue")({ |
| 5 | - "channel_id": S.String, | |
| 5 | + "channel_id": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 6 | 6 | "channel_name": S.String, |
| 7 | 7 | "code": S.String, |
| 8 | 8 | "emoticon_set": S.Int, |
Test case
1 generated file · +2 −2test/inputs/json/priority/nbl-stats.json
Mtypescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -161,7 +161,7 @@ export class Pl extends S.Class<Pl>("Pl")({ | ||
| 161 | 161 | "sTwoPointersAttempted": S.Int, |
| 162 | 162 | "sTwoPointersMade": S.Int, |
| 163 | 163 | "sTwoPointersPercentage": S.Int, |
| 164 | - "shirtNumber": S.String, | |
| 164 | + "shirtNumber": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 165 | 165 | "starter": S.Int, |
| 166 | 166 | }) {} |
| 167 | 167 | |
| @@ -239,7 +239,7 @@ export class Team extends S.Class<Team>("Team")({ | ||
| 239 | 239 | export class Othermatch extends S.Class<Othermatch>("Othermatch")({ |
| 240 | 240 | "clock": S.String, |
| 241 | 241 | "competitionName": S.String, |
| 242 | - "id": S.String, | |
| 242 | + "id": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 243 | 243 | "period": S.Int, |
| 244 | 244 | "periodType": PerType, |
| 245 | 245 | "team1": Team, |
Test case
1 generated file · +1 −1test/inputs/json/priority/nst-test-suite.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -54,7 +54,7 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 54 | 54 | "y_array_empty-string.json": S.Array(S.String), |
| 55 | 55 | "y_array_ending_with_newline.json": S.Array(S.String), |
| 56 | 56 | "y_array_false.json": S.Array(S.Boolean), |
| 57 | - "y_array_heterogeneous.json": S.Array(S.Union(S.Int, S.String, Json, S.Null)), | |
| 57 | + "y_array_heterogeneous.json": S.Array(S.Union(S.Int, S.NumberFromString.pipe(S.int()), Json, S.Null)), | |
| 58 | 58 | "y_array_null.json": S.Array(S.Null), |
| 59 | 59 | "y_array_with_1_and_newline.json": S.Array(S.Int), |
| 60 | 60 | "y_array_with_leading_space.json": S.Array(S.Int), |
Test case
1 generated file · +2 −2test/inputs/json/samples/kitchen-sink.json
Mtypescript-effect-schemadefault / TopLevel.ts+2 −2
| @@ -7,7 +7,7 @@ export class PurplePerson extends S.Class<PurplePerson>("PurplePerson")({ | ||
| 7 | 7 | }) {} |
| 8 | 8 | |
| 9 | 9 | export class PersonElement extends S.Class<PersonElement>("PersonElement")({ |
| 10 | - "intOrString": S.Union(S.Int, S.String), | |
| 10 | + "intOrString": S.Union(S.Int, S.NumberFromString.pipe(S.int())), | |
| 11 | 11 | "name": S.String, |
| 12 | 12 | "optionalValue": S.optional(S.NullOr(S.Boolean)), |
| 13 | 13 | }) {} |
| @@ -19,7 +19,7 @@ export class DifferentThingClass extends S.Class<DifferentThingClass>("Different | ||
| 19 | 19 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 20 | 20 | "booleanValue": S.Boolean, |
| 21 | 21 | "dateValue": S.String, |
| 22 | - "differentThings": S.Array(S.Union(S.Int, S.String, DifferentThingClass)), | |
| 22 | + "differentThings": S.Array(S.Union(S.Int, S.NumberFromString.pipe(S.int()), DifferentThingClass)), | |
| 23 | 23 | "doubleValue": S.Number, |
| 24 | 24 | "intValue": S.Int, |
| 25 | 25 | "mapValue": S.Record({ key: S.String, value: S.NullOr(S.Int)}), |
Test case
1 generated file · +1 −1test/inputs/json/samples/spotify-album.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -68,7 +68,7 @@ export class TopLevel extends S.Class<TopLevel>("TopLevel")({ | ||
| 68 | 68 | "images": S.Array(Image), |
| 69 | 69 | "name": S.String, |
| 70 | 70 | "popularity": S.Int, |
| 71 | - "release_date": S.String, | |
| 71 | + "release_date": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 72 | 72 | "release_date_precision": S.String, |
| 73 | 73 | "tracks": Tracks, |
| 74 | 74 | "type": S.String, |
Test case
1 generated file · +1 −1test/inputs/json/samples/us-senators.json
Mtypescript-effect-schemadefault / TopLevel.ts+1 −1
| @@ -92,7 +92,7 @@ export class Person extends S.Class<Person>("Person")({ | ||
| 92 | 92 | "namemod": Namemod, |
| 93 | 93 | "nickname": S.String, |
| 94 | 94 | "osid": S.String, |
| 95 | - "pvsid": S.String, | |
| 95 | + "pvsid": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 96 | 96 | "sortname": S.String, |
| 97 | 97 | "twitterid": S.NullOr(S.String), |
| 98 | 98 | "youtubeid": S.NullOr(S.String), |
Test case
1 generated file · +12 −7test/inputs/schema/integer-string.schema
Mschema-typescript-effect-schemadefault / TopLevel.ts+12 −7
| @@ -1,12 +1,17 @@ | ||
| 1 | 1 | import * as S from "effect/Schema"; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +export const UnionWithIntAndEnumEnum = S.Literal( | |
| 5 | + "foo", | |
| 6 | +); | |
| 7 | +export type UnionWithIntAndEnumEnum = S.Schema.Type<typeof UnionWithIntAndEnumEnum>; | |
| 8 | + | |
| 4 | 9 | export class TopLevel extends S.Class<TopLevel>("TopLevel")({ |
| 5 | - "arrNullable": S.optional(S.NullOr(S.Array(S.NullOr(S.String)))), | |
| 6 | - "arrOne": S.optional(S.NullOr(S.Array(S.String))), | |
| 7 | - "nullable": S.NullOr(S.String), | |
| 8 | - "one": S.String, | |
| 9 | - "optional": S.optional(S.NullOr(S.String)), | |
| 10 | - "unionWithInt": S.Union(S.Int, S.String), | |
| 11 | - "unionWithIntAndEnum": S.Union(S.Int, S.String), | |
| 10 | + "arrNullable": S.optional(S.NullOr(S.Array(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))))), | |
| 11 | + "arrOne": S.optional(S.NullOr(S.Array(S.String.pipe(S.pattern(/^-?\d+$/))))), | |
| 12 | + "nullable": S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/))), | |
| 13 | + "one": S.String.pipe(S.pattern(/^-?\d+$/)), | |
| 14 | + "optional": S.optional(S.NullOr(S.String.pipe(S.pattern(/^-?\d+$/)))), | |
| 15 | + "unionWithInt": S.Union(S.Int, S.NumberFromString.pipe(S.int())), | |
| 16 | + "unionWithIntAndEnum": S.Union(UnionWithIntAndEnumEnum, S.Int, S.NumberFromString.pipe(S.int())), | |
| 12 | 17 | }) {} |
No generated files match these filters.