Test case
1 generated file · +5 −5test/inputs/json/misc/010b1.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -7,12 +7,12 @@ export const CountrySchema = z.enum([ | ||
| 7 | 7 | export type Country = z.infer<typeof CountrySchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelElementSchema = z.object({ |
| 10 | - "age": z.number(), | |
| 10 | + "age": z.number().int(), | |
| 11 | 11 | "country": CountrySchema, |
| 12 | - "females": z.number(), | |
| 13 | - "males": z.number(), | |
| 14 | - "total": z.number(), | |
| 15 | - "year": z.number(), | |
| 12 | + "females": z.number().int(), | |
| 13 | + "males": z.number().int(), | |
| 14 | + "total": z.number().int(), | |
| 15 | + "year": z.number().int(), | |
| 16 | 16 | }); |
| 17 | 17 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/016af.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/09f54.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -9,7 +9,7 @@ export type Datum = z.infer<typeof DatumSchema>; | ||
| 9 | 9 | |
| 10 | 10 | export const DescriptionSchema = z.object({ |
| 11 | 11 | "base_period": z.string(), |
| 12 | - "missing": z.number(), | |
| 12 | + "missing": z.number().int(), | |
| 13 | 13 | "title": z.string(), |
| 14 | 14 | "units": z.string(), |
| 15 | 15 | }); |
Test case
1 generated file · +4 −4test/inputs/json/misc/0a358.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -8,7 +8,7 @@ export type Facets = z.infer<typeof FacetsSchema>; | ||
| 8 | 8 | export const ResultSchema = z.object({ |
| 9 | 9 | "code": z.string(), |
| 10 | 10 | "created_at": z.coerce.date(), |
| 11 | - "id": z.number(), | |
| 11 | + "id": z.number().int(), | |
| 12 | 12 | "name": z.string(), |
| 13 | 13 | "updated_at": z.coerce.date(), |
| 14 | 14 | "uri": z.string(), |
| @@ -16,11 +16,11 @@ export const ResultSchema = z.object({ | ||
| 16 | 16 | export type Result = z.infer<typeof ResultSchema>; |
| 17 | 17 | |
| 18 | 18 | export const TopLevelSchema = z.object({ |
| 19 | - "count": z.number(), | |
| 19 | + "count": z.number().int(), | |
| 20 | 20 | "facets": FacetsSchema, |
| 21 | - "limit": z.number(), | |
| 21 | + "limit": z.number().int(), | |
| 22 | 22 | "next": z.string(), |
| 23 | - "offset": z.number(), | |
| 23 | + "offset": z.number().int(), | |
| 24 | 24 | "previous": z.boolean(), |
| 25 | 25 | "results": z.array(ResultSchema), |
| 26 | 26 | }); |
Test case
1 generated file · +24 −24test/inputs/json/misc/0a91a.json
Mtypescript-zoddefault / TopLevel.ts+24 −24
| @@ -14,7 +14,7 @@ export const ActorSchema = z.object({ | ||
| 14 | 14 | "avatar_url": z.string(), |
| 15 | 15 | "display_login": z.string().optional(), |
| 16 | 16 | "gravatar_id": z.string(), |
| 17 | - "id": z.number(), | |
| 17 | + "id": z.number().int(), | |
| 18 | 18 | "login": z.string(), |
| 19 | 19 | "url": z.string(), |
| 20 | 20 | }); |
| @@ -34,7 +34,7 @@ export const MergedBySchema = z.object({ | ||
| 34 | 34 | "gists_url": z.string(), |
| 35 | 35 | "gravatar_id": z.string(), |
| 36 | 36 | "html_url": z.string(), |
| 37 | - "id": z.number(), | |
| 37 | + "id": z.number().int(), | |
| 38 | 38 | "login": z.string(), |
| 39 | 39 | "organizations_url": z.string(), |
| 40 | 40 | "received_events_url": z.string(), |
| @@ -53,7 +53,7 @@ export const CommentsSchema = z.object({ | ||
| 53 | 53 | export type Comments = z.infer<typeof CommentsSchema>; |
| 54 | 54 | |
| 55 | 55 | export const TopLevelRepoSchema = z.object({ |
| 56 | - "id": z.number(), | |
| 56 | + "id": z.number().int(), | |
| 57 | 57 | "name": z.string(), |
| 58 | 58 | "url": z.string(), |
| 59 | 59 | }); |
| @@ -87,8 +87,8 @@ export const BaseRepoSchema = z.object({ | ||
| 87 | 87 | "downloads_url": z.string(), |
| 88 | 88 | "events_url": z.string(), |
| 89 | 89 | "fork": z.boolean(), |
| 90 | - "forks": z.number(), | |
| 91 | - "forks_count": z.number(), | |
| 90 | + "forks": z.number().int(), | |
| 91 | + "forks_count": z.number().int(), | |
| 92 | 92 | "forks_url": z.string(), |
| 93 | 93 | "full_name": z.string(), |
| 94 | 94 | "git_commits_url": z.string(), |
| @@ -103,7 +103,7 @@ export const BaseRepoSchema = z.object({ | ||
| 103 | 103 | "homepage": z.null(), |
| 104 | 104 | "hooks_url": z.string(), |
| 105 | 105 | "html_url": z.string(), |
| 106 | - "id": z.number(), | |
| 106 | + "id": z.number().int(), | |
| 107 | 107 | "issue_comment_url": z.string(), |
| 108 | 108 | "issue_events_url": z.string(), |
| 109 | 109 | "issues_url": z.string(), |
| @@ -116,16 +116,16 @@ export const BaseRepoSchema = z.object({ | ||
| 116 | 116 | "mirror_url": z.null(), |
| 117 | 117 | "name": z.string(), |
| 118 | 118 | "notifications_url": z.string(), |
| 119 | - "open_issues": z.number(), | |
| 120 | - "open_issues_count": z.number(), | |
| 119 | + "open_issues": z.number().int(), | |
| 120 | + "open_issues_count": z.number().int(), | |
| 121 | 121 | "owner": MergedBySchema, |
| 122 | 122 | "private": z.boolean(), |
| 123 | 123 | "pulls_url": z.string(), |
| 124 | 124 | "pushed_at": z.coerce.date(), |
| 125 | 125 | "releases_url": z.string(), |
| 126 | - "size": z.number(), | |
| 126 | + "size": z.number().int(), | |
| 127 | 127 | "ssh_url": z.string(), |
| 128 | - "stargazers_count": z.number(), | |
| 128 | + "stargazers_count": z.number().int(), | |
| 129 | 129 | "stargazers_url": z.string(), |
| 130 | 130 | "statuses_url": z.string(), |
| 131 | 131 | "subscribers_url": z.string(), |
| @@ -136,8 +136,8 @@ export const BaseRepoSchema = z.object({ | ||
| 136 | 136 | "trees_url": z.string(), |
| 137 | 137 | "updated_at": z.coerce.date(), |
| 138 | 138 | "url": z.string(), |
| 139 | - "watchers": z.number(), | |
| 140 | - "watchers_count": z.number(), | |
| 139 | + "watchers": z.number().int(), | |
| 140 | + "watchers_count": z.number().int(), | |
| 141 | 141 | }); |
| 142 | 142 | export type BaseRepo = z.infer<typeof BaseRepoSchema>; |
| 143 | 143 | |
| @@ -163,23 +163,23 @@ export const BaseSchema = z.object({ | ||
| 163 | 163 | export type Base = z.infer<typeof BaseSchema>; |
| 164 | 164 | |
| 165 | 165 | export const PullRequestSchema = z.object({ |
| 166 | - "additions": z.number(), | |
| 166 | + "additions": z.number().int(), | |
| 167 | 167 | "assignee": z.null(), |
| 168 | 168 | "assignees": z.array(z.any()), |
| 169 | 169 | "base": BaseSchema, |
| 170 | 170 | "body": z.string(), |
| 171 | - "changed_files": z.number(), | |
| 171 | + "changed_files": z.number().int(), | |
| 172 | 172 | "closed_at": z.coerce.date(), |
| 173 | - "comments": z.number(), | |
| 173 | + "comments": z.number().int(), | |
| 174 | 174 | "comments_url": z.string(), |
| 175 | - "commits": z.number(), | |
| 175 | + "commits": z.number().int(), | |
| 176 | 176 | "commits_url": z.string(), |
| 177 | 177 | "created_at": z.coerce.date(), |
| 178 | - "deletions": z.number(), | |
| 178 | + "deletions": z.number().int(), | |
| 179 | 179 | "diff_url": z.string(), |
| 180 | 180 | "head": BaseSchema, |
| 181 | 181 | "html_url": z.string(), |
| 182 | - "id": z.number(), | |
| 182 | + "id": z.number().int(), | |
| 183 | 183 | "issue_url": z.string(), |
| 184 | 184 | "_links": LinksSchema, |
| 185 | 185 | "locked": z.boolean(), |
| @@ -191,12 +191,12 @@ export const PullRequestSchema = z.object({ | ||
| 191 | 191 | "merged_at": z.coerce.date(), |
| 192 | 192 | "merged_by": MergedBySchema, |
| 193 | 193 | "milestone": z.null(), |
| 194 | - "number": z.number(), | |
| 194 | + "number": z.number().int(), | |
| 195 | 195 | "patch_url": z.string(), |
| 196 | 196 | "rebaseable": z.null(), |
| 197 | 197 | "requested_reviewers": z.array(z.any()), |
| 198 | 198 | "review_comment_url": z.string(), |
| 199 | - "review_comments": z.number(), | |
| 199 | + "review_comments": z.number().int(), | |
| 200 | 200 | "review_comments_url": z.string(), |
| 201 | 201 | "state": z.string(), |
| 202 | 202 | "statuses_url": z.string(), |
| @@ -212,16 +212,16 @@ export const PayloadSchema = z.object({ | ||
| 212 | 212 | "before": z.string().optional(), |
| 213 | 213 | "commits": z.array(CommitSchema).optional(), |
| 214 | 214 | "description": z.union([z.null(), z.string()]).optional(), |
| 215 | - "distinct_size": z.number().optional(), | |
| 215 | + "distinct_size": z.number().int().optional(), | |
| 216 | 216 | "head": z.string().optional(), |
| 217 | 217 | "master_branch": z.string().optional(), |
| 218 | - "number": z.number().optional(), | |
| 218 | + "number": z.number().int().optional(), | |
| 219 | 219 | "pull_request": PullRequestSchema.optional(), |
| 220 | - "push_id": z.number().optional(), | |
| 220 | + "push_id": z.number().int().optional(), | |
| 221 | 221 | "pusher_type": z.string().optional(), |
| 222 | 222 | "ref": z.string().optional(), |
| 223 | 223 | "ref_type": z.string().optional(), |
| 224 | - "size": z.number().optional(), | |
| 224 | + "size": z.number().int().optional(), | |
| 225 | 225 | }); |
| 226 | 226 | export type Payload = z.infer<typeof PayloadSchema>; |
Test case
1 generated file · +4 −4test/inputs/json/misc/0b91a.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -3,14 +3,14 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const ResponseInfoSchema = z.object({ |
| 5 | 5 | "developerMessage": z.string(), |
| 6 | - "status": z.number(), | |
| 6 | + "status": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type ResponseInfo = z.infer<typeof ResponseInfoSchema>; |
| 9 | 9 | |
| 10 | 10 | export const ResultsetSchema = z.object({ |
| 11 | - "count": z.number(), | |
| 12 | - "page": z.number(), | |
| 13 | - "pagesize": z.number(), | |
| 11 | + "count": z.number().int(), | |
| 12 | + "page": z.number().int(), | |
| 13 | + "pagesize": z.number().int(), | |
| 14 | 14 | }); |
| 15 | 15 | export type Resultset = z.infer<typeof ResultsetSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/0cffa.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -71,14 +71,14 @@ export type User = z.infer<typeof UserSchema>; | ||
| 71 | 71 | export const MetaSchema = z.object({ |
| 72 | 72 | "msg": z.string(), |
| 73 | 73 | "response_id": z.string(), |
| 74 | - "status": z.number(), | |
| 74 | + "status": z.number().int(), | |
| 75 | 75 | }); |
| 76 | 76 | export type Meta = z.infer<typeof MetaSchema>; |
| 77 | 77 | |
| 78 | 78 | export const PaginationSchema = z.object({ |
| 79 | - "count": z.number(), | |
| 80 | - "offset": z.number(), | |
| 81 | - "total_count": z.number(), | |
| 79 | + "count": z.number().int(), | |
| 80 | + "offset": z.number().int(), | |
| 81 | + "total_count": z.number().int(), | |
| 82 | 82 | }); |
| 83 | 83 | export type Pagination = z.infer<typeof PaginationSchema>; |
| 84 | 84 | |
| @@ -117,7 +117,7 @@ export const DatumSchema = z.object({ | ||
| 117 | 117 | "id": z.string(), |
| 118 | 118 | "images": ImagesSchema, |
| 119 | 119 | "import_datetime": z.string(), |
| 120 | - "is_indexable": z.number(), | |
| 120 | + "is_indexable": z.number().int(), | |
| 121 | 121 | "rating": RatingSchema, |
| 122 | 122 | "slug": z.string(), |
| 123 | 123 | "source": z.string(), |
Test case
1 generated file · +14 −14test/inputs/json/misc/0e0c2.json
Mtypescript-zoddefault / TopLevel.ts+14 −14
| @@ -22,8 +22,8 @@ export const ResultLanguageSchema = z.enum([ | ||
| 22 | 22 | export type ResultLanguage = z.infer<typeof ResultLanguageSchema>; |
| 23 | 23 | |
| 24 | 24 | export const CollectionSchema = z.object({ |
| 25 | - "id": z.number(), | |
| 26 | - "movies": z.array(z.number()), | |
| 25 | + "id": z.number().int(), | |
| 26 | + "movies": z.array(z.number().int()), | |
| 27 | 27 | "name": z.string(), |
| 28 | 28 | "slug": z.string(), |
| 29 | 29 | }); |
| @@ -32,7 +32,7 @@ export type Collection = z.infer<typeof CollectionSchema>; | ||
| 32 | 32 | export const DetailSchema = z.object({ |
| 33 | 33 | "cast": z.string(), |
| 34 | 34 | "director": z.string(), |
| 35 | - "id": z.number(), | |
| 35 | + "id": z.number().int(), | |
| 36 | 36 | "language": DetailLanguageSchema, |
| 37 | 37 | "storyline": z.string(), |
| 38 | 38 | "tagline": z.string(), |
| @@ -48,8 +48,8 @@ export const FavMovieSchema = z.object({ | ||
| 48 | 48 | export type FavMovie = z.infer<typeof FavMovieSchema>; |
| 49 | 49 | |
| 50 | 50 | export const ImageSchema = z.object({ |
| 51 | - "favs": z.number(), | |
| 52 | - "id": z.number(), | |
| 51 | + "favs": z.number().int(), | |
| 52 | + "id": z.number().int(), | |
| 53 | 53 | "thumbnail": z.string(), |
| 54 | 54 | "type": TypeSchema, |
| 55 | 55 | "url": z.string(), |
| @@ -65,33 +65,33 @@ export const VideoSchema = z.object({ | ||
| 65 | 65 | export type Video = z.infer<typeof VideoSchema>; |
| 66 | 66 | |
| 67 | 67 | export const VoteScoreSchema = z.object({ |
| 68 | - "avg": z.number(), | |
| 69 | - "score": z.number(), | |
| 70 | - "total": z.number(), | |
| 68 | + "avg": z.number().int(), | |
| 69 | + "score": z.number().int(), | |
| 70 | + "total": z.number().int(), | |
| 71 | 71 | }); |
| 72 | 72 | export type VoteScore = z.infer<typeof VoteScoreSchema>; |
| 73 | 73 | |
| 74 | 74 | export const ResultSchema = z.object({ |
| 75 | - "active_screens": z.number(), | |
| 75 | + "active_screens": z.number().int(), | |
| 76 | 76 | "collections": z.array(CollectionSchema), |
| 77 | 77 | "details": z.array(DetailSchema), |
| 78 | - "duration": z.number(), | |
| 78 | + "duration": z.number().int(), | |
| 79 | 79 | "fav_movie": FavMovieSchema, |
| 80 | - "id": z.number(), | |
| 80 | + "id": z.number().int(), | |
| 81 | 81 | "images": z.array(ImageSchema), |
| 82 | 82 | "language": ResultLanguageSchema, |
| 83 | 83 | "release_date": z.string(), |
| 84 | - "stars": z.number(), | |
| 84 | + "stars": z.number().int(), | |
| 85 | 85 | "tags": z.union([z.null(), z.array(z.any())]), |
| 86 | 86 | "title": z.string(), |
| 87 | 87 | "videos": z.array(VideoSchema), |
| 88 | 88 | "vote_score": VoteScoreSchema, |
| 89 | - "watches": z.number(), | |
| 89 | + "watches": z.number().int(), | |
| 90 | 90 | }); |
| 91 | 91 | export type Result = z.infer<typeof ResultSchema>; |
| 92 | 92 | |
| 93 | 93 | export const TopLevelSchema = z.object({ |
| 94 | - "count": z.number(), | |
| 94 | + "count": z.number().int(), | |
| 95 | 95 | "next": z.string(), |
| 96 | 96 | "previous": z.null(), |
| 97 | 97 | "results": z.array(ResultSchema), |
Test case
1 generated file · +5 −5test/inputs/json/misc/127a1.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -70,14 +70,14 @@ export type User = z.infer<typeof UserSchema>; | ||
| 70 | 70 | export const MetaSchema = z.object({ |
| 71 | 71 | "msg": z.string(), |
| 72 | 72 | "response_id": z.string(), |
| 73 | - "status": z.number(), | |
| 73 | + "status": z.number().int(), | |
| 74 | 74 | }); |
| 75 | 75 | export type Meta = z.infer<typeof MetaSchema>; |
| 76 | 76 | |
| 77 | 77 | export const PaginationSchema = z.object({ |
| 78 | - "count": z.number(), | |
| 79 | - "offset": z.number(), | |
| 80 | - "total_count": z.number(), | |
| 78 | + "count": z.number().int(), | |
| 79 | + "offset": z.number().int(), | |
| 80 | + "total_count": z.number().int(), | |
| 81 | 81 | }); |
| 82 | 82 | export type Pagination = z.infer<typeof PaginationSchema>; |
| 83 | 83 | |
| @@ -116,7 +116,7 @@ export const DatumSchema = z.object({ | ||
| 116 | 116 | "id": z.string(), |
| 117 | 117 | "images": ImagesSchema, |
| 118 | 118 | "import_datetime": z.string(), |
| 119 | - "is_indexable": z.number(), | |
| 119 | + "is_indexable": z.number().int(), | |
| 120 | 120 | "rating": RatingSchema, |
| 121 | 121 | "slug": z.string(), |
| 122 | 122 | "source": z.string(), |
Test case
1 generated file · +1 −1test/inputs/json/misc/16bc5.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -105,7 +105,7 @@ export const ResultsSchema = z.object({ | ||
| 105 | 105 | export type Results = z.infer<typeof ResultsSchema>; |
| 106 | 106 | |
| 107 | 107 | export const QuerySchema = z.object({ |
| 108 | - "count": z.number(), | |
| 108 | + "count": z.number().int(), | |
| 109 | 109 | "created": z.coerce.date(), |
| 110 | 110 | "lang": z.string(), |
| 111 | 111 | "results": ResultsSchema, |
Test case
1 generated file · +1 −1test/inputs/json/misc/176f1.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -29,7 +29,7 @@ export type Results = z.infer<typeof ResultsSchema>; | ||
| 29 | 29 | |
| 30 | 30 | export const TopLevelSchema = z.object({ |
| 31 | 31 | "message": z.array(z.any()), |
| 32 | - "responseTime": z.number(), | |
| 32 | + "responseTime": z.number().int(), | |
| 33 | 33 | "Results": ResultsSchema, |
| 34 | 34 | "status": z.string(), |
| 35 | 35 | }); |
Test case
1 generated file · +5 −5test/inputs/json/misc/1a7f5.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -7,12 +7,12 @@ export const CountrySchema = z.enum([ | ||
| 7 | 7 | export type Country = z.infer<typeof CountrySchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelElementSchema = z.object({ |
| 10 | - "age": z.number(), | |
| 10 | + "age": z.number().int(), | |
| 11 | 11 | "country": CountrySchema, |
| 12 | - "females": z.number(), | |
| 13 | - "males": z.number(), | |
| 14 | - "total": z.number(), | |
| 15 | - "year": z.number(), | |
| 12 | + "females": z.number().int(), | |
| 13 | + "males": z.number().int(), | |
| 14 | + "total": z.number().int(), | |
| 15 | + "year": z.number().int(), | |
| 16 | 16 | }); |
| 17 | 17 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/1b28c.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +8 −8test/inputs/json/misc/1b409.json
Mtypescript-zoddefault / TopLevel.ts+8 −8
| @@ -53,9 +53,9 @@ export const TitleSchema = z.enum([ | ||
| 53 | 53 | export type Title = z.infer<typeof TitleSchema>; |
| 54 | 54 | |
| 55 | 55 | export const MetaSchema = z.object({ |
| 56 | - "limit": z.number(), | |
| 57 | - "offset": z.number(), | |
| 58 | - "total_count": z.number(), | |
| 56 | + "limit": z.number().int(), | |
| 57 | + "offset": z.number().int(), | |
| 58 | + "total_count": z.number().int(), | |
| 59 | 59 | }); |
| 60 | 60 | export type Meta = z.infer<typeof MetaSchema>; |
| 61 | 61 | |
| @@ -71,11 +71,11 @@ export type Extra = z.infer<typeof ExtraSchema>; | ||
| 71 | 71 | export const PersonSchema = z.object({ |
| 72 | 72 | "bioguideid": z.string(), |
| 73 | 73 | "birthday": z.string(), |
| 74 | - "cspanid": z.number(), | |
| 74 | + "cspanid": z.number().int(), | |
| 75 | 75 | "firstname": z.string(), |
| 76 | 76 | "gender": GenderSchema, |
| 77 | 77 | "gender_label": GenderLabelSchema, |
| 78 | - "id": z.number(), | |
| 78 | + "id": z.number().int(), | |
| 79 | 79 | "lastname": z.string(), |
| 80 | 80 | "link": z.string(), |
| 81 | 81 | "middlename": z.string(), |
| @@ -92,13 +92,13 @@ export type Person = z.infer<typeof PersonSchema>; | ||
| 92 | 92 | |
| 93 | 93 | export const ObjectElementSchema = z.object({ |
| 94 | 94 | "caucus": z.null(), |
| 95 | - "congress_numbers": z.array(z.number()), | |
| 95 | + "congress_numbers": z.array(z.number().int()), | |
| 96 | 96 | "current": z.boolean(), |
| 97 | 97 | "description": z.string(), |
| 98 | - "district": z.number(), | |
| 98 | + "district": z.number().int(), | |
| 99 | 99 | "enddate": z.string(), |
| 100 | 100 | "extra": ExtraSchema, |
| 101 | - "id": z.number(), | |
| 101 | + "id": z.number().int(), | |
| 102 | 102 | "leadership_title": z.union([z.null(), z.string()]), |
| 103 | 103 | "party": PartySchema, |
| 104 | 104 | "person": PersonSchema, |
Test case
1 generated file · +1 −1test/inputs/json/misc/262f0.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -112,7 +112,7 @@ export const ResultsSchema = z.object({ | ||
| 112 | 112 | export type Results = z.infer<typeof ResultsSchema>; |
| 113 | 113 | |
| 114 | 114 | export const QuerySchema = z.object({ |
| 115 | - "count": z.number(), | |
| 115 | + "count": z.number().int(), | |
| 116 | 116 | "created": z.coerce.date(), |
| 117 | 117 | "lang": z.string(), |
| 118 | 118 | "results": ResultsSchema, |
Test case
1 generated file · +5 −5test/inputs/json/misc/26b49.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -64,14 +64,14 @@ export type User = z.infer<typeof UserSchema>; | ||
| 64 | 64 | export const MetaSchema = z.object({ |
| 65 | 65 | "msg": z.string(), |
| 66 | 66 | "response_id": z.string(), |
| 67 | - "status": z.number(), | |
| 67 | + "status": z.number().int(), | |
| 68 | 68 | }); |
| 69 | 69 | export type Meta = z.infer<typeof MetaSchema>; |
| 70 | 70 | |
| 71 | 71 | export const PaginationSchema = z.object({ |
| 72 | - "count": z.number(), | |
| 73 | - "offset": z.number(), | |
| 74 | - "total_count": z.number(), | |
| 72 | + "count": z.number().int(), | |
| 73 | + "offset": z.number().int(), | |
| 74 | + "total_count": z.number().int(), | |
| 75 | 75 | }); |
| 76 | 76 | export type Pagination = z.infer<typeof PaginationSchema>; |
| 77 | 77 | |
| @@ -111,7 +111,7 @@ export const DatumSchema = z.object({ | ||
| 111 | 111 | "id": z.string(), |
| 112 | 112 | "images": ImagesSchema, |
| 113 | 113 | "import_datetime": z.string(), |
| 114 | - "is_indexable": z.number(), | |
| 114 | + "is_indexable": z.number().int(), | |
| 115 | 115 | "rating": RatingSchema, |
| 116 | 116 | "slug": z.string(), |
| 117 | 117 | "source": z.string(), |
Test case
1 generated file · +22 −22test/inputs/json/misc/26c9c.json
Mtypescript-zoddefault / TopLevel.ts+22 −22
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopSchema = z.object({ |
| 5 | - "count": z.number(), | |
| 5 | + "count": z.number().int(), | |
| 6 | 6 | "item": z.string(), |
| 7 | 7 | }); |
| 8 | 8 | export type Top = z.infer<typeof TopSchema>; |
| @@ -90,7 +90,7 @@ export const OwnerSchema = z.object({ | ||
| 90 | 90 | export type Owner = z.infer<typeof OwnerSchema>; |
| 91 | 91 | |
| 92 | 92 | export const ExpressionSchema = z.object({ |
| 93 | - "columnId": z.number(), | |
| 93 | + "columnId": z.number().int(), | |
| 94 | 94 | "type": z.string(), |
| 95 | 95 | }); |
| 96 | 96 | export type Expression = z.infer<typeof ExpressionSchema>; |
| @@ -98,8 +98,8 @@ export type Expression = z.infer<typeof ExpressionSchema>; | ||
| 98 | 98 | export const CachedContentsSchema = z.object({ |
| 99 | 99 | "average": z.string().optional(), |
| 100 | 100 | "largest": z.string(), |
| 101 | - "non_null": z.number(), | |
| 102 | - "null": z.number(), | |
| 101 | + "non_null": z.number().int(), | |
| 102 | + "null": z.number().int(), | |
| 103 | 103 | "smallest": z.string(), |
| 104 | 104 | "sum": z.string().optional(), |
| 105 | 105 | "top": z.array(TopSchema), |
| @@ -137,12 +137,12 @@ export const ColumnSchema = z.object({ | ||
| 137 | 137 | "fieldName": z.string(), |
| 138 | 138 | "flags": z.array(z.string()).optional(), |
| 139 | 139 | "format": FormatSchema, |
| 140 | - "id": z.number(), | |
| 140 | + "id": z.number().int(), | |
| 141 | 141 | "name": z.string(), |
| 142 | - "position": z.number(), | |
| 142 | + "position": z.number().int(), | |
| 143 | 143 | "renderTypeName": z.string(), |
| 144 | - "tableColumnId": z.number().optional(), | |
| 145 | - "width": z.number().optional(), | |
| 144 | + "tableColumnId": z.number().int().optional(), | |
| 145 | + "width": z.number().int().optional(), | |
| 146 | 146 | }); |
| 147 | 147 | export type Column = z.infer<typeof ColumnSchema>; |
| 148 | 148 | |
| @@ -164,41 +164,41 @@ export type Query = z.infer<typeof QuerySchema>; | ||
| 164 | 164 | export const ViewSchema = z.object({ |
| 165 | 165 | "attribution": z.string(), |
| 166 | 166 | "attributionLink": z.string(), |
| 167 | - "averageRating": z.number(), | |
| 167 | + "averageRating": z.number().int(), | |
| 168 | 168 | "category": z.string(), |
| 169 | 169 | "columns": z.array(ColumnSchema), |
| 170 | - "createdAt": z.number(), | |
| 170 | + "createdAt": z.number().int(), | |
| 171 | 171 | "description": z.string(), |
| 172 | 172 | "displayType": z.string(), |
| 173 | - "downloadCount": z.number(), | |
| 173 | + "downloadCount": z.number().int(), | |
| 174 | 174 | "flags": z.array(z.string()), |
| 175 | 175 | "grants": z.array(GrantSchema), |
| 176 | 176 | "hideFromCatalog": z.boolean(), |
| 177 | 177 | "hideFromDataJson": z.boolean(), |
| 178 | 178 | "id": z.string(), |
| 179 | - "indexUpdatedAt": z.number(), | |
| 179 | + "indexUpdatedAt": z.number().int(), | |
| 180 | 180 | "locale": z.string(), |
| 181 | 181 | "metadata": MetadataSchema, |
| 182 | 182 | "name": z.string(), |
| 183 | 183 | "newBackend": z.boolean(), |
| 184 | - "numberOfComments": z.number(), | |
| 185 | - "oid": z.number(), | |
| 184 | + "numberOfComments": z.number().int(), | |
| 185 | + "oid": z.number().int(), | |
| 186 | 186 | "owner": OwnerSchema, |
| 187 | 187 | "provenance": z.string(), |
| 188 | 188 | "publicationAppendEnabled": z.boolean(), |
| 189 | - "publicationDate": z.number(), | |
| 190 | - "publicationGroup": z.number(), | |
| 189 | + "publicationDate": z.number().int(), | |
| 190 | + "publicationGroup": z.number().int(), | |
| 191 | 191 | "publicationStage": z.string(), |
| 192 | 192 | "query": QuerySchema, |
| 193 | 193 | "rights": z.array(z.string()), |
| 194 | - "rowsUpdatedAt": z.number(), | |
| 194 | + "rowsUpdatedAt": z.number().int(), | |
| 195 | 195 | "rowsUpdatedBy": z.string(), |
| 196 | 196 | "tableAuthor": OwnerSchema, |
| 197 | - "tableId": z.number(), | |
| 197 | + "tableId": z.number().int(), | |
| 198 | 198 | "tags": z.array(z.string()), |
| 199 | - "totalTimesRated": z.number(), | |
| 200 | - "viewCount": z.number(), | |
| 201 | - "viewLastModified": z.number(), | |
| 199 | + "totalTimesRated": z.number().int(), | |
| 200 | + "viewCount": z.number().int(), | |
| 201 | + "viewLastModified": z.number().int(), | |
| 202 | 202 | "viewType": z.string(), |
| 203 | 203 | }); |
| 204 | 204 | export type View = z.infer<typeof ViewSchema>; |
| @@ -209,7 +209,7 @@ export const MetaSchema = z.object({ | ||
| 209 | 209 | export type Meta = z.infer<typeof MetaSchema>; |
| 210 | 210 | |
| 211 | 211 | export const TopLevelSchema = z.object({ |
| 212 | - "data": z.array(z.array(z.union([z.null(), z.number(), z.string()]))), | |
| 212 | + "data": z.array(z.array(z.union([z.null(), z.number().int(), z.string()]))), | |
| 213 | 213 | "meta": MetaSchema, |
| 214 | 214 | }); |
| 215 | 215 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +15 −15test/inputs/json/misc/27332.json
Mtypescript-zoddefault / TopLevel.ts+15 −15
| @@ -48,32 +48,32 @@ export type Kind = z.infer<typeof KindSchema>; | ||
| 48 | 48 | |
| 49 | 49 | export const OembedSchema = z.object({ |
| 50 | 50 | "description": z.string(), |
| 51 | - "height": z.number(), | |
| 51 | + "height": z.number().int(), | |
| 52 | 52 | "html": z.string(), |
| 53 | 53 | "provider_name": z.string(), |
| 54 | 54 | "provider_url": z.string(), |
| 55 | - "thumbnail_height": z.number(), | |
| 55 | + "thumbnail_height": z.number().int(), | |
| 56 | 56 | "thumbnail_url": z.string(), |
| 57 | - "thumbnail_width": z.number(), | |
| 57 | + "thumbnail_width": z.number().int(), | |
| 58 | 58 | "title": z.string(), |
| 59 | 59 | "type": z.string(), |
| 60 | 60 | "version": z.string(), |
| 61 | - "width": z.number(), | |
| 61 | + "width": z.number().int(), | |
| 62 | 62 | }); |
| 63 | 63 | export type Oembed = z.infer<typeof OembedSchema>; |
| 64 | 64 | |
| 65 | 65 | export const MediaEmbedSchema = z.object({ |
| 66 | 66 | "content": z.string().optional(), |
| 67 | - "height": z.number().optional(), | |
| 67 | + "height": z.number().int().optional(), | |
| 68 | 68 | "scrolling": z.boolean().optional(), |
| 69 | - "width": z.number().optional(), | |
| 69 | + "width": z.number().int().optional(), | |
| 70 | 70 | }); |
| 71 | 71 | export type MediaEmbed = z.infer<typeof MediaEmbedSchema>; |
| 72 | 72 | |
| 73 | 73 | export const SourceSchema = z.object({ |
| 74 | - "height": z.number(), | |
| 74 | + "height": z.number().int(), | |
| 75 | 75 | "url": z.string(), |
| 76 | - "width": z.number(), | |
| 76 | + "width": z.number().int(), | |
| 77 | 77 | }); |
| 78 | 78 | export type Source = z.infer<typeof SourceSchema>; |
| 79 | 79 | |
| @@ -119,9 +119,9 @@ export const ChildDataSchema = z.object({ | ||
| 119 | 119 | "created_utc": z.number(), |
| 120 | 120 | "distinguished": z.union([z.null(), z.string()]), |
| 121 | 121 | "domain": DomainSchema, |
| 122 | - "downs": z.number(), | |
| 122 | + "downs": z.number().int(), | |
| 123 | 123 | "edited": z.boolean(), |
| 124 | - "gilded": z.number(), | |
| 124 | + "gilded": z.number().int(), | |
| 125 | 125 | "hidden": z.boolean(), |
| 126 | 126 | "hide_score": z.boolean(), |
| 127 | 127 | "id": z.string(), |
| @@ -135,7 +135,7 @@ export const ChildDataSchema = z.object({ | ||
| 135 | 135 | "media_embed": MediaEmbedSchema, |
| 136 | 136 | "mod_reports": z.array(z.any()), |
| 137 | 137 | "name": z.string(), |
| 138 | - "num_comments": z.number(), | |
| 138 | + "num_comments": z.number().int(), | |
| 139 | 139 | "num_reports": z.null(), |
| 140 | 140 | "over_18": z.boolean(), |
| 141 | 141 | "permalink": z.string(), |
| @@ -145,7 +145,7 @@ export const ChildDataSchema = z.object({ | ||
| 145 | 145 | "removal_reason": z.null(), |
| 146 | 146 | "report_reasons": z.null(), |
| 147 | 147 | "saved": z.boolean(), |
| 148 | - "score": z.number(), | |
| 148 | + "score": z.number().int(), | |
| 149 | 149 | "secure_media": z.union([z.null(), MediaSchema]), |
| 150 | 150 | "secure_media_embed": MediaEmbedSchema, |
| 151 | 151 | "selftext": z.string(), |
| @@ -158,10 +158,10 @@ export const ChildDataSchema = z.object({ | ||
| 158 | 158 | "subreddit_type": SubredditTypeSchema, |
| 159 | 159 | "suggested_sort": z.null(), |
| 160 | 160 | "thumbnail": z.string(), |
| 161 | - "thumbnail_height": z.union([z.null(), z.number()]), | |
| 162 | - "thumbnail_width": z.union([z.null(), z.number()]), | |
| 161 | + "thumbnail_height": z.union([z.null(), z.number().int()]), | |
| 162 | + "thumbnail_width": z.union([z.null(), z.number().int()]), | |
| 163 | 163 | "title": z.string(), |
| 164 | - "ups": z.number(), | |
| 164 | + "ups": z.number().int(), | |
| 165 | 165 | "url": z.string(), |
| 166 | 166 | "user_reports": z.array(z.any()), |
| 167 | 167 | "view_count": z.null(), |
Test case
1 generated file · +9 −9test/inputs/json/misc/29f47.json
Mtypescript-zoddefault / TopLevel.ts+9 −9
| @@ -55,9 +55,9 @@ export const MediaEmbedSchema = z.object({ | ||
| 55 | 55 | export type MediaEmbed = z.infer<typeof MediaEmbedSchema>; |
| 56 | 56 | |
| 57 | 57 | export const SourceSchema = z.object({ |
| 58 | - "height": z.number(), | |
| 58 | + "height": z.number().int(), | |
| 59 | 59 | "url": z.string(), |
| 60 | - "width": z.number(), | |
| 60 | + "width": z.number().int(), | |
| 61 | 61 | }); |
| 62 | 62 | export type Source = z.infer<typeof SourceSchema>; |
| 63 | 63 | |
| @@ -105,9 +105,9 @@ export const ChildDataSchema = z.object({ | ||
| 105 | 105 | "created_utc": z.number(), |
| 106 | 106 | "distinguished": DistinguishedSchema, |
| 107 | 107 | "domain": DomainSchema, |
| 108 | - "downs": z.number(), | |
| 108 | + "downs": z.number().int(), | |
| 109 | 109 | "edited": z.union([z.boolean(), z.number()]), |
| 110 | - "gilded": z.number(), | |
| 110 | + "gilded": z.number().int(), | |
| 111 | 111 | "hidden": z.boolean(), |
| 112 | 112 | "hide_score": z.boolean(), |
| 113 | 113 | "id": z.string(), |
| @@ -121,7 +121,7 @@ export const ChildDataSchema = z.object({ | ||
| 121 | 121 | "media_embed": MediaEmbedSchema, |
| 122 | 122 | "mod_reports": z.array(z.any()), |
| 123 | 123 | "name": z.string(), |
| 124 | - "num_comments": z.number(), | |
| 124 | + "num_comments": z.number().int(), | |
| 125 | 125 | "num_reports": z.null(), |
| 126 | 126 | "over_18": z.boolean(), |
| 127 | 127 | "permalink": z.string(), |
| @@ -131,7 +131,7 @@ export const ChildDataSchema = z.object({ | ||
| 131 | 131 | "removal_reason": z.null(), |
| 132 | 132 | "report_reasons": z.null(), |
| 133 | 133 | "saved": z.boolean(), |
| 134 | - "score": z.number(), | |
| 134 | + "score": z.number().int(), | |
| 135 | 135 | "secure_media": z.null(), |
| 136 | 136 | "secure_media_embed": MediaEmbedSchema, |
| 137 | 137 | "selftext": z.string(), |
| @@ -144,10 +144,10 @@ export const ChildDataSchema = z.object({ | ||
| 144 | 144 | "subreddit_type": SubredditTypeSchema, |
| 145 | 145 | "suggested_sort": z.union([z.null(), z.string()]), |
| 146 | 146 | "thumbnail": z.string(), |
| 147 | - "thumbnail_height": z.union([z.null(), z.number()]), | |
| 148 | - "thumbnail_width": z.union([z.null(), z.number()]), | |
| 147 | + "thumbnail_height": z.union([z.null(), z.number().int()]), | |
| 148 | + "thumbnail_width": z.union([z.null(), z.number().int()]), | |
| 149 | 149 | "title": z.string(), |
| 150 | - "ups": z.number(), | |
| 150 | + "ups": z.number().int(), | |
| 151 | 151 | "url": z.string(), |
| 152 | 152 | "user_reports": z.array(z.any()), |
| 153 | 153 | "view_count": z.null(), |
Test case
1 generated file · +7 −7test/inputs/json/misc/2d4e2.json
Mtypescript-zoddefault / TopLevel.ts+7 −7
| @@ -79,9 +79,9 @@ export const TitleSchema = z.enum([ | ||
| 79 | 79 | export type Title = z.infer<typeof TitleSchema>; |
| 80 | 80 | |
| 81 | 81 | export const MetaSchema = z.object({ |
| 82 | - "limit": z.number(), | |
| 83 | - "offset": z.number(), | |
| 84 | - "total_count": z.number(), | |
| 82 | + "limit": z.number().int(), | |
| 83 | + "offset": z.number().int(), | |
| 84 | + "total_count": z.number().int(), | |
| 85 | 85 | }); |
| 86 | 86 | export type Meta = z.infer<typeof MetaSchema>; |
| 87 | 87 | |
| @@ -97,11 +97,11 @@ export type Extra = z.infer<typeof ExtraSchema>; | ||
| 97 | 97 | export const PersonSchema = z.object({ |
| 98 | 98 | "bioguideid": z.string(), |
| 99 | 99 | "birthday": z.string(), |
| 100 | - "cspanid": z.number(), | |
| 100 | + "cspanid": z.number().int(), | |
| 101 | 101 | "firstname": z.string(), |
| 102 | 102 | "gender": GenderSchema, |
| 103 | 103 | "gender_label": GenderLabelSchema, |
| 104 | - "id": z.number(), | |
| 104 | + "id": z.number().int(), | |
| 105 | 105 | "lastname": z.string(), |
| 106 | 106 | "link": z.string(), |
| 107 | 107 | "middlename": z.string(), |
| @@ -118,13 +118,13 @@ export type Person = z.infer<typeof PersonSchema>; | ||
| 118 | 118 | |
| 119 | 119 | export const ObjectElementSchema = z.object({ |
| 120 | 120 | "caucus": z.union([z.null(), PartySchema]), |
| 121 | - "congress_numbers": z.array(z.number()), | |
| 121 | + "congress_numbers": z.array(z.number().int()), | |
| 122 | 122 | "current": z.boolean(), |
| 123 | 123 | "description": z.string(), |
| 124 | 124 | "district": z.null(), |
| 125 | 125 | "enddate": z.string(), |
| 126 | 126 | "extra": ExtraSchema, |
| 127 | - "id": z.number(), | |
| 127 | + "id": z.number().int(), | |
| 128 | 128 | "leadership_title": z.union([z.null(), z.string()]), |
| 129 | 129 | "party": PartySchema, |
| 130 | 130 | "person": PersonSchema, |
Test case
1 generated file · +10 −10test/inputs/json/misc/32431.json
Mtypescript-zoddefault / TopLevel.ts+10 −10
| @@ -46,34 +46,34 @@ export const PropertiesSchema = z.object({ | ||
| 46 | 46 | "detail": z.string(), |
| 47 | 47 | "dmin": z.union([z.null(), z.number()]), |
| 48 | 48 | "felt": z.null(), |
| 49 | - "gap": z.union([z.null(), z.number()]), | |
| 49 | + "gap": z.union([z.null(), z.number().int()]), | |
| 50 | 50 | "ids": z.string(), |
| 51 | 51 | "mag": z.number(), |
| 52 | 52 | "magType": MagTypeSchema, |
| 53 | 53 | "mmi": z.null(), |
| 54 | 54 | "net": z.string(), |
| 55 | - "nst": z.union([z.null(), z.number()]), | |
| 55 | + "nst": z.union([z.null(), z.number().int()]), | |
| 56 | 56 | "place": z.string(), |
| 57 | 57 | "rms": z.number(), |
| 58 | - "sig": z.number(), | |
| 58 | + "sig": z.number().int(), | |
| 59 | 59 | "sources": z.string(), |
| 60 | 60 | "status": StatusSchema, |
| 61 | - "time": z.number(), | |
| 61 | + "time": z.number().int(), | |
| 62 | 62 | "title": z.string(), |
| 63 | - "tsunami": z.number(), | |
| 63 | + "tsunami": z.number().int(), | |
| 64 | 64 | "type": PropertiesTypeSchema, |
| 65 | 65 | "types": z.string(), |
| 66 | - "tz": z.number(), | |
| 67 | - "updated": z.number(), | |
| 66 | + "tz": z.number().int(), | |
| 67 | + "updated": z.number().int(), | |
| 68 | 68 | "url": z.string(), |
| 69 | 69 | }); |
| 70 | 70 | export type Properties = z.infer<typeof PropertiesSchema>; |
| 71 | 71 | |
| 72 | 72 | export const MetadataSchema = z.object({ |
| 73 | 73 | "api": z.string(), |
| 74 | - "count": z.number(), | |
| 75 | - "generated": z.number(), | |
| 76 | - "status": z.number(), | |
| 74 | + "count": z.number().int(), | |
| 75 | + "generated": z.number().int(), | |
| 76 | + "status": z.number().int(), | |
| 77 | 77 | "title": z.string(), |
| 78 | 78 | "url": z.string(), |
| 79 | 79 | }); |
Test case
1 generated file · +19 −19test/inputs/json/misc/337ed.json
Mtypescript-zoddefault / TopLevel.ts+19 −19
| @@ -27,7 +27,7 @@ export const FacetsSchema = z.object({ | ||
| 27 | 27 | export type Facets = z.infer<typeof FacetsSchema>; |
| 28 | 28 | |
| 29 | 29 | export const CustomIncomeSchema = z.object({ |
| 30 | - "amount": z.number(), | |
| 30 | + "amount": z.number().int(), | |
| 31 | 31 | "created_at": z.coerce.date(), |
| 32 | 32 | "id": z.string(), |
| 33 | 33 | "name": z.string(), |
| @@ -39,35 +39,35 @@ export const CustomIncomeSchema = z.object({ | ||
| 39 | 39 | export type CustomIncome = z.infer<typeof CustomIncomeSchema>; |
| 40 | 40 | |
| 41 | 41 | export const ResultSchema = z.object({ |
| 42 | - "cost_absolute": z.union([z.null(), z.number()]), | |
| 43 | - "cost_max": z.union([z.null(), z.number()]), | |
| 44 | - "cost_min": z.union([z.null(), z.number()]), | |
| 42 | + "cost_absolute": z.union([z.null(), z.number().int()]), | |
| 43 | + "cost_max": z.union([z.null(), z.number().int()]), | |
| 44 | + "cost_min": z.union([z.null(), z.number().int()]), | |
| 45 | 45 | "created_at": z.coerce.date(), |
| 46 | 46 | "customIncomes": z.array(CustomIncomeSchema), |
| 47 | 47 | "direct_rep_costs_max": z.null(), |
| 48 | 48 | "direct_rep_costs_min": z.null(), |
| 49 | 49 | "end_date": z.coerce.date(), |
| 50 | - "eur_sources_grants": z.number(), | |
| 50 | + "eur_sources_grants": z.number().int(), | |
| 51 | 51 | "eur_sources_grants_src": z.union([z.null(), z.string()]), |
| 52 | - "eur_sources_procurement": z.number(), | |
| 52 | + "eur_sources_procurement": z.number().int(), | |
| 53 | 53 | "eur_sources_procurement_src": z.union([z.null(), z.string()]), |
| 54 | 54 | "id": z.string(), |
| 55 | 55 | "new_organisation": z.null(), |
| 56 | 56 | "no_clients": z.union([z.null(), z.string()]), |
| 57 | 57 | "other_financial_information": z.union([z.null(), z.string()]), |
| 58 | - "other_sources_contributions": z.union([z.null(), z.number()]), | |
| 59 | - "other_sources_donation": z.union([z.null(), z.number()]), | |
| 60 | - "other_sources_total": z.union([z.null(), z.number()]), | |
| 61 | - "public_financing_infranational": z.union([z.null(), z.number()]), | |
| 62 | - "public_financing_national": z.union([z.null(), z.number()]), | |
| 63 | - "public_financing_total": z.union([z.null(), z.number()]), | |
| 58 | + "other_sources_contributions": z.union([z.null(), z.number().int()]), | |
| 59 | + "other_sources_donation": z.union([z.null(), z.number().int()]), | |
| 60 | + "other_sources_total": z.union([z.null(), z.number().int()]), | |
| 61 | + "public_financing_infranational": z.union([z.null(), z.number().int()]), | |
| 62 | + "public_financing_national": z.union([z.null(), z.number().int()]), | |
| 63 | + "public_financing_total": z.union([z.null(), z.number().int()]), | |
| 64 | 64 | "representative": z.string(), |
| 65 | 65 | "start_date": z.coerce.date(), |
| 66 | 66 | "status": StatusSchema, |
| 67 | - "total_budget": z.union([z.null(), z.number()]), | |
| 68 | - "turnover_absolute": z.union([z.null(), z.number()]), | |
| 69 | - "turnover_max": z.union([z.null(), z.number()]), | |
| 70 | - "turnover_min": z.union([z.null(), z.number()]), | |
| 67 | + "total_budget": z.union([z.null(), z.number().int()]), | |
| 68 | + "turnover_absolute": z.union([z.null(), z.number().int()]), | |
| 69 | + "turnover_max": z.union([z.null(), z.number().int()]), | |
| 70 | + "turnover_min": z.union([z.null(), z.number().int()]), | |
| 71 | 71 | "type": ResultTypeSchema, |
| 72 | 72 | "updated_at": z.coerce.date(), |
| 73 | 73 | "uri": z.string(), |
| @@ -75,11 +75,11 @@ export const ResultSchema = z.object({ | ||
| 75 | 75 | export type Result = z.infer<typeof ResultSchema>; |
| 76 | 76 | |
| 77 | 77 | export const TopLevelSchema = z.object({ |
| 78 | - "count": z.number(), | |
| 78 | + "count": z.number().int(), | |
| 79 | 79 | "facets": FacetsSchema, |
| 80 | - "limit": z.number(), | |
| 80 | + "limit": z.number().int(), | |
| 81 | 81 | "next": z.string(), |
| 82 | - "offset": z.number(), | |
| 82 | + "offset": z.number().int(), | |
| 83 | 83 | "previous": z.boolean(), |
| 84 | 84 | "results": z.array(ResultSchema), |
| 85 | 85 | }); |
Test case
1 generated file · +2 −2test/inputs/json/misc/34702.json
Mtypescript-zoddefault / TopLevel.ts+2 −2
| @@ -83,7 +83,7 @@ export const FeaturePropertiesSchema = z.object({ | ||
| 83 | 83 | "longitude": z.number(), |
| 84 | 84 | "no": z.union([z.null(), z.string()]), |
| 85 | 85 | "phone": z.number(), |
| 86 | - "postcode": z.number(), | |
| 86 | + "postcode": z.number().int(), | |
| 87 | 87 | "psa": z.string(), |
| 88 | 88 | "region": RegionSchema, |
| 89 | 89 | "station": z.string(), |
| @@ -111,7 +111,7 @@ export type Feature = z.infer<typeof FeatureSchema>; | ||
| 111 | 111 | export const TopLevelSchema = z.object({ |
| 112 | 112 | "crs": CrsSchema, |
| 113 | 113 | "features": z.array(FeatureSchema), |
| 114 | - "totalFeatures": z.number(), | |
| 114 | + "totalFeatures": z.number().int(), | |
| 115 | 115 | "type": z.string(), |
| 116 | 116 | }); |
| 117 | 117 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/3659d.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/3e9a3.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -29,7 +29,7 @@ export type Results = z.infer<typeof ResultsSchema>; | ||
| 29 | 29 | |
| 30 | 30 | export const TopLevelSchema = z.object({ |
| 31 | 31 | "message": z.array(z.any()), |
| 32 | - "responseTime": z.number(), | |
| 32 | + "responseTime": z.number().int(), | |
| 33 | 33 | "Results": ResultsSchema, |
| 34 | 34 | "status": z.string(), |
| 35 | 35 | }); |
Test case
1 generated file · +1 −1test/inputs/json/misc/3f1ce.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -110,7 +110,7 @@ export const ResultsSchema = z.object({ | ||
| 110 | 110 | export type Results = z.infer<typeof ResultsSchema>; |
| 111 | 111 | |
| 112 | 112 | export const QuerySchema = z.object({ |
| 113 | - "count": z.number(), | |
| 113 | + "count": z.number().int(), | |
| 114 | 114 | "created": z.coerce.date(), |
| 115 | 115 | "lang": z.string(), |
| 116 | 116 | "results": ResultsSchema, |
Test case
1 generated file · +21 −21test/inputs/json/misc/421d4.json
Mtypescript-zoddefault / TopLevel.ts+21 −21
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopSchema = z.object({ |
| 5 | - "count": z.number(), | |
| 5 | + "count": z.number().int(), | |
| 6 | 6 | "item": z.string(), |
| 7 | 7 | }); |
| 8 | 8 | export type Top = z.infer<typeof TopSchema>; |
| @@ -38,8 +38,8 @@ export type Owner = z.infer<typeof OwnerSchema>; | ||
| 38 | 38 | export const CachedContentsSchema = z.object({ |
| 39 | 39 | "average": z.string().optional(), |
| 40 | 40 | "largest": z.string().optional(), |
| 41 | - "non_null": z.number(), | |
| 42 | - "null": z.number(), | |
| 41 | + "non_null": z.number().int(), | |
| 42 | + "null": z.number().int(), | |
| 43 | 43 | "smallest": z.string().optional(), |
| 44 | 44 | "sum": z.string().optional(), |
| 45 | 45 | "top": z.array(TopSchema).optional(), |
| @@ -57,12 +57,12 @@ export const ColumnSchema = z.object({ | ||
| 57 | 57 | "fieldName": z.string(), |
| 58 | 58 | "flags": z.array(z.string()).optional(), |
| 59 | 59 | "format": QuerySchema, |
| 60 | - "id": z.number(), | |
| 60 | + "id": z.number().int(), | |
| 61 | 61 | "name": z.string(), |
| 62 | - "position": z.number(), | |
| 62 | + "position": z.number().int(), | |
| 63 | 63 | "renderTypeName": z.string(), |
| 64 | - "tableColumnId": z.number().optional(), | |
| 65 | - "width": z.number().optional(), | |
| 64 | + "tableColumnId": z.number().int().optional(), | |
| 65 | + "width": z.number().int().optional(), | |
| 66 | 66 | }); |
| 67 | 67 | export type Column = z.infer<typeof ColumnSchema>; |
| 68 | 68 | |
| @@ -77,44 +77,44 @@ export type Metadata = z.infer<typeof MetadataSchema>; | ||
| 77 | 77 | |
| 78 | 78 | export const ViewSchema = z.object({ |
| 79 | 79 | "attribution": z.string(), |
| 80 | - "averageRating": z.number(), | |
| 80 | + "averageRating": z.number().int(), | |
| 81 | 81 | "category": z.string(), |
| 82 | 82 | "columns": z.array(ColumnSchema), |
| 83 | - "createdAt": z.number(), | |
| 83 | + "createdAt": z.number().int(), | |
| 84 | 84 | "description": z.string(), |
| 85 | 85 | "displayType": z.string(), |
| 86 | - "downloadCount": z.number(), | |
| 86 | + "downloadCount": z.number().int(), | |
| 87 | 87 | "flags": z.array(z.string()), |
| 88 | 88 | "grants": z.array(GrantSchema), |
| 89 | 89 | "hideFromCatalog": z.boolean(), |
| 90 | 90 | "hideFromDataJson": z.boolean(), |
| 91 | 91 | "id": z.string(), |
| 92 | - "indexUpdatedAt": z.number(), | |
| 92 | + "indexUpdatedAt": z.number().int(), | |
| 93 | 93 | "license": LicenseSchema, |
| 94 | 94 | "licenseId": z.string(), |
| 95 | 95 | "locale": z.string(), |
| 96 | 96 | "metadata": MetadataSchema, |
| 97 | 97 | "name": z.string(), |
| 98 | 98 | "newBackend": z.boolean(), |
| 99 | - "numberOfComments": z.number(), | |
| 100 | - "oid": z.number(), | |
| 99 | + "numberOfComments": z.number().int(), | |
| 100 | + "oid": z.number().int(), | |
| 101 | 101 | "owner": OwnerSchema, |
| 102 | 102 | "provenance": z.string(), |
| 103 | 103 | "publicationAppendEnabled": z.boolean(), |
| 104 | - "publicationDate": z.number(), | |
| 105 | - "publicationGroup": z.number(), | |
| 104 | + "publicationDate": z.number().int(), | |
| 105 | + "publicationGroup": z.number().int(), | |
| 106 | 106 | "publicationStage": z.string(), |
| 107 | 107 | "query": QuerySchema, |
| 108 | 108 | "rights": z.array(z.string()), |
| 109 | 109 | "rowClass": z.string(), |
| 110 | - "rowsUpdatedAt": z.number(), | |
| 110 | + "rowsUpdatedAt": z.number().int(), | |
| 111 | 111 | "rowsUpdatedBy": z.string(), |
| 112 | 112 | "tableAuthor": OwnerSchema, |
| 113 | - "tableId": z.number(), | |
| 113 | + "tableId": z.number().int(), | |
| 114 | 114 | "tags": z.array(z.string()), |
| 115 | - "totalTimesRated": z.number(), | |
| 116 | - "viewCount": z.number(), | |
| 117 | - "viewLastModified": z.number(), | |
| 115 | + "totalTimesRated": z.number().int(), | |
| 116 | + "viewCount": z.number().int(), | |
| 117 | + "viewLastModified": z.number().int(), | |
| 118 | 118 | "viewType": z.string(), |
| 119 | 119 | }); |
| 120 | 120 | export type View = z.infer<typeof ViewSchema>; |
| @@ -125,7 +125,7 @@ export const MetaSchema = z.object({ | ||
| 125 | 125 | export type Meta = z.infer<typeof MetaSchema>; |
| 126 | 126 | |
| 127 | 127 | export const TopLevelSchema = z.object({ |
| 128 | - "data": z.array(z.array(z.union([z.null(), z.number(), z.string()]))), | |
| 128 | + "data": z.array(z.array(z.union([z.null(), z.number().int(), z.string()]))), | |
| 129 | 129 | "meta": MetaSchema, |
| 130 | 130 | }); |
| 131 | 131 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/437e7.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -63,14 +63,14 @@ export type User = z.infer<typeof UserSchema>; | ||
| 63 | 63 | export const MetaSchema = z.object({ |
| 64 | 64 | "msg": z.string(), |
| 65 | 65 | "response_id": z.string(), |
| 66 | - "status": z.number(), | |
| 66 | + "status": z.number().int(), | |
| 67 | 67 | }); |
| 68 | 68 | export type Meta = z.infer<typeof MetaSchema>; |
| 69 | 69 | |
| 70 | 70 | export const PaginationSchema = z.object({ |
| 71 | - "count": z.number(), | |
| 72 | - "offset": z.number(), | |
| 73 | - "total_count": z.number(), | |
| 71 | + "count": z.number().int(), | |
| 72 | + "offset": z.number().int(), | |
| 73 | + "total_count": z.number().int(), | |
| 74 | 74 | }); |
| 75 | 75 | export type Pagination = z.infer<typeof PaginationSchema>; |
| 76 | 76 | |
| @@ -108,7 +108,7 @@ export const DatumSchema = z.object({ | ||
| 108 | 108 | "id": z.string(), |
| 109 | 109 | "images": ImagesSchema, |
| 110 | 110 | "import_datetime": z.string(), |
| 111 | - "is_indexable": z.number(), | |
| 111 | + "is_indexable": z.number().int(), | |
| 112 | 112 | "rating": RatingSchema, |
| 113 | 113 | "slug": z.string(), |
| 114 | 114 | "source": z.string(), |
Test case
1 generated file · +4 −4test/inputs/json/misc/458db.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -8,14 +8,14 @@ export type Name = z.infer<typeof NameSchema>; | ||
| 8 | 8 | |
| 9 | 9 | export const ResponseInfoSchema = z.object({ |
| 10 | 10 | "developerMessage": z.string(), |
| 11 | - "status": z.number(), | |
| 11 | + "status": z.number().int(), | |
| 12 | 12 | }); |
| 13 | 13 | export type ResponseInfo = z.infer<typeof ResponseInfoSchema>; |
| 14 | 14 | |
| 15 | 15 | export const ResultsetSchema = z.object({ |
| 16 | - "count": z.number(), | |
| 17 | - "page": z.number(), | |
| 18 | - "pagesize": z.number(), | |
| 16 | + "count": z.number().int(), | |
| 17 | + "page": z.number().int(), | |
| 18 | + "pagesize": z.number().int(), | |
| 19 | 19 | }); |
| 20 | 20 | export type Resultset = z.infer<typeof ResultsetSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/4961a.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/4a0d7.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/4a455.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -57,7 +57,7 @@ export type Feature = z.infer<typeof FeatureSchema>; | ||
| 57 | 57 | export const TopLevelSchema = z.object({ |
| 58 | 58 | "crs": CrsSchema, |
| 59 | 59 | "features": z.array(FeatureSchema), |
| 60 | - "totalFeatures": z.number(), | |
| 60 | + "totalFeatures": z.number().int(), | |
| 61 | 61 | "type": z.string(), |
| 62 | 62 | }); |
| 63 | 63 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/4c547.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -105,7 +105,7 @@ export const ResultsSchema = z.object({ | ||
| 105 | 105 | export type Results = z.infer<typeof ResultsSchema>; |
| 106 | 106 | |
| 107 | 107 | export const QuerySchema = z.object({ |
| 108 | - "count": z.number(), | |
| 108 | + "count": z.number().int(), | |
| 109 | 109 | "created": z.coerce.date(), |
| 110 | 110 | "lang": z.string(), |
| 111 | 111 | "results": ResultsSchema, |
Test case
1 generated file · +1 −1test/inputs/json/misc/4e336.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +3 −3test/inputs/json/misc/54d32.json
Mtypescript-zoddefault / TopLevel.ts+3 −3
| @@ -22,11 +22,11 @@ export const ResultSchema = z.object({ | ||
| 22 | 22 | export type Result = z.infer<typeof ResultSchema>; |
| 23 | 23 | |
| 24 | 24 | export const TopLevelSchema = z.object({ |
| 25 | - "count": z.number(), | |
| 25 | + "count": z.number().int(), | |
| 26 | 26 | "facets": FacetsSchema, |
| 27 | - "limit": z.number(), | |
| 27 | + "limit": z.number().int(), | |
| 28 | 28 | "next": z.string(), |
| 29 | - "offset": z.number(), | |
| 29 | + "offset": z.number().int(), | |
| 30 | 30 | "previous": z.boolean(), |
| 31 | 31 | "results": z.array(ResultSchema), |
| 32 | 32 | }); |
Test case
1 generated file · +22 −22test/inputs/json/misc/5f7fe.json
Mtypescript-zoddefault / TopLevel.ts+22 −22
| @@ -9,7 +9,7 @@ export const TypeNameSchema = z.enum([ | ||
| 9 | 9 | export type TypeName = z.infer<typeof TypeNameSchema>; |
| 10 | 10 | |
| 11 | 11 | export const TopSchema = z.object({ |
| 12 | - "count": z.number(), | |
| 12 | + "count": z.number().int(), | |
| 13 | 13 | "item": z.string(), |
| 14 | 14 | }); |
| 15 | 15 | export type Top = z.infer<typeof TopSchema>; |
| @@ -95,15 +95,15 @@ export const OwnerSchema = z.object({ | ||
| 95 | 95 | export type Owner = z.infer<typeof OwnerSchema>; |
| 96 | 96 | |
| 97 | 97 | export const ExpressionSchema = z.object({ |
| 98 | - "columnId": z.number(), | |
| 98 | + "columnId": z.number().int(), | |
| 99 | 99 | "type": z.string(), |
| 100 | 100 | }); |
| 101 | 101 | export type Expression = z.infer<typeof ExpressionSchema>; |
| 102 | 102 | |
| 103 | 103 | export const CachedContentsSchema = z.object({ |
| 104 | 104 | "largest": z.string(), |
| 105 | - "non_null": z.number(), | |
| 106 | - "null": z.number(), | |
| 105 | + "non_null": z.number().int(), | |
| 106 | + "null": z.number().int(), | |
| 107 | 107 | "smallest": z.string(), |
| 108 | 108 | "top": z.array(TopSchema), |
| 109 | 109 | }); |
| @@ -140,12 +140,12 @@ export const ColumnSchema = z.object({ | ||
| 140 | 140 | "fieldName": z.string(), |
| 141 | 141 | "flags": z.array(z.string()).optional(), |
| 142 | 142 | "format": FormatSchema, |
| 143 | - "id": z.number(), | |
| 143 | + "id": z.number().int(), | |
| 144 | 144 | "name": z.string(), |
| 145 | - "position": z.number(), | |
| 145 | + "position": z.number().int(), | |
| 146 | 146 | "renderTypeName": TypeNameSchema, |
| 147 | - "tableColumnId": z.number().optional(), | |
| 148 | - "width": z.number().optional(), | |
| 147 | + "tableColumnId": z.number().int().optional(), | |
| 148 | + "width": z.number().int().optional(), | |
| 149 | 149 | }); |
| 150 | 150 | export type Column = z.infer<typeof ColumnSchema>; |
| 151 | 151 | |
| @@ -167,41 +167,41 @@ export type Query = z.infer<typeof QuerySchema>; | ||
| 167 | 167 | export const ViewSchema = z.object({ |
| 168 | 168 | "attribution": z.string(), |
| 169 | 169 | "attributionLink": z.string(), |
| 170 | - "averageRating": z.number(), | |
| 170 | + "averageRating": z.number().int(), | |
| 171 | 171 | "category": z.string(), |
| 172 | 172 | "columns": z.array(ColumnSchema), |
| 173 | - "createdAt": z.number(), | |
| 173 | + "createdAt": z.number().int(), | |
| 174 | 174 | "description": z.string(), |
| 175 | 175 | "displayType": z.string(), |
| 176 | - "downloadCount": z.number(), | |
| 176 | + "downloadCount": z.number().int(), | |
| 177 | 177 | "flags": z.array(z.string()), |
| 178 | 178 | "grants": z.array(GrantSchema), |
| 179 | 179 | "hideFromCatalog": z.boolean(), |
| 180 | 180 | "hideFromDataJson": z.boolean(), |
| 181 | 181 | "id": z.string(), |
| 182 | - "indexUpdatedAt": z.number(), | |
| 182 | + "indexUpdatedAt": z.number().int(), | |
| 183 | 183 | "locale": z.string(), |
| 184 | 184 | "metadata": MetadataSchema, |
| 185 | 185 | "name": z.string(), |
| 186 | 186 | "newBackend": z.boolean(), |
| 187 | - "numberOfComments": z.number(), | |
| 188 | - "oid": z.number(), | |
| 187 | + "numberOfComments": z.number().int(), | |
| 188 | + "oid": z.number().int(), | |
| 189 | 189 | "owner": OwnerSchema, |
| 190 | 190 | "provenance": z.string(), |
| 191 | 191 | "publicationAppendEnabled": z.boolean(), |
| 192 | - "publicationDate": z.number(), | |
| 193 | - "publicationGroup": z.number(), | |
| 192 | + "publicationDate": z.number().int(), | |
| 193 | + "publicationGroup": z.number().int(), | |
| 194 | 194 | "publicationStage": z.string(), |
| 195 | 195 | "query": QuerySchema, |
| 196 | 196 | "rights": z.array(z.string()), |
| 197 | - "rowsUpdatedAt": z.number(), | |
| 197 | + "rowsUpdatedAt": z.number().int(), | |
| 198 | 198 | "rowsUpdatedBy": z.string(), |
| 199 | 199 | "tableAuthor": OwnerSchema, |
| 200 | - "tableId": z.number(), | |
| 200 | + "tableId": z.number().int(), | |
| 201 | 201 | "tags": z.array(z.string()), |
| 202 | - "totalTimesRated": z.number(), | |
| 203 | - "viewCount": z.number(), | |
| 204 | - "viewLastModified": z.number(), | |
| 202 | + "totalTimesRated": z.number().int(), | |
| 203 | + "viewCount": z.number().int(), | |
| 204 | + "viewLastModified": z.number().int(), | |
| 205 | 205 | "viewType": z.string(), |
| 206 | 206 | }); |
| 207 | 207 | export type View = z.infer<typeof ViewSchema>; |
| @@ -212,7 +212,7 @@ export const MetaSchema = z.object({ | ||
| 212 | 212 | export type Meta = z.infer<typeof MetaSchema>; |
| 213 | 213 | |
| 214 | 214 | export const TopLevelSchema = z.object({ |
| 215 | - "data": z.array(z.array(z.union([z.null(), z.number(), z.string()]))), | |
| 215 | + "data": z.array(z.array(z.union([z.null(), z.number().int(), z.string()]))), | |
| 216 | 216 | "meta": MetaSchema, |
| 217 | 217 | }); |
| 218 | 218 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +22 −22test/inputs/json/misc/617e8.json
Mtypescript-zoddefault / TopLevel.ts+22 −22
| @@ -9,7 +9,7 @@ export const TypeNameSchema = z.enum([ | ||
| 9 | 9 | export type TypeName = z.infer<typeof TypeNameSchema>; |
| 10 | 10 | |
| 11 | 11 | export const TopSchema = z.object({ |
| 12 | - "count": z.number(), | |
| 12 | + "count": z.number().int(), | |
| 13 | 13 | "item": z.string(), |
| 14 | 14 | }); |
| 15 | 15 | export type Top = z.infer<typeof TopSchema>; |
| @@ -93,15 +93,15 @@ export const OwnerSchema = z.object({ | ||
| 93 | 93 | export type Owner = z.infer<typeof OwnerSchema>; |
| 94 | 94 | |
| 95 | 95 | export const ExpressionSchema = z.object({ |
| 96 | - "columnId": z.number(), | |
| 96 | + "columnId": z.number().int(), | |
| 97 | 97 | "type": z.string(), |
| 98 | 98 | }); |
| 99 | 99 | export type Expression = z.infer<typeof ExpressionSchema>; |
| 100 | 100 | |
| 101 | 101 | export const CachedContentsSchema = z.object({ |
| 102 | 102 | "largest": z.string(), |
| 103 | - "non_null": z.number(), | |
| 104 | - "null": z.number(), | |
| 103 | + "non_null": z.number().int(), | |
| 104 | + "null": z.number().int(), | |
| 105 | 105 | "smallest": z.string(), |
| 106 | 106 | "top": z.array(TopSchema), |
| 107 | 107 | }); |
| @@ -139,12 +139,12 @@ export const ColumnSchema = z.object({ | ||
| 139 | 139 | "fieldName": z.string(), |
| 140 | 140 | "flags": z.array(z.string()).optional(), |
| 141 | 141 | "format": FormatSchema, |
| 142 | - "id": z.number(), | |
| 142 | + "id": z.number().int(), | |
| 143 | 143 | "name": z.string(), |
| 144 | - "position": z.number(), | |
| 144 | + "position": z.number().int(), | |
| 145 | 145 | "renderTypeName": TypeNameSchema, |
| 146 | - "tableColumnId": z.number().optional(), | |
| 147 | - "width": z.number().optional(), | |
| 146 | + "tableColumnId": z.number().int().optional(), | |
| 147 | + "width": z.number().int().optional(), | |
| 148 | 148 | }); |
| 149 | 149 | export type Column = z.infer<typeof ColumnSchema>; |
| 150 | 150 | |
| @@ -166,41 +166,41 @@ export type Query = z.infer<typeof QuerySchema>; | ||
| 166 | 166 | export const ViewSchema = z.object({ |
| 167 | 167 | "attribution": z.string(), |
| 168 | 168 | "attributionLink": z.string(), |
| 169 | - "averageRating": z.number(), | |
| 169 | + "averageRating": z.number().int(), | |
| 170 | 170 | "category": z.string(), |
| 171 | 171 | "columns": z.array(ColumnSchema), |
| 172 | - "createdAt": z.number(), | |
| 172 | + "createdAt": z.number().int(), | |
| 173 | 173 | "description": z.string(), |
| 174 | 174 | "displayType": z.string(), |
| 175 | - "downloadCount": z.number(), | |
| 175 | + "downloadCount": z.number().int(), | |
| 176 | 176 | "flags": z.array(z.string()), |
| 177 | 177 | "grants": z.array(GrantSchema), |
| 178 | 178 | "hideFromCatalog": z.boolean(), |
| 179 | 179 | "hideFromDataJson": z.boolean(), |
| 180 | 180 | "id": z.string(), |
| 181 | - "indexUpdatedAt": z.number(), | |
| 181 | + "indexUpdatedAt": z.number().int(), | |
| 182 | 182 | "locale": z.string(), |
| 183 | 183 | "metadata": MetadataSchema, |
| 184 | 184 | "name": z.string(), |
| 185 | 185 | "newBackend": z.boolean(), |
| 186 | - "numberOfComments": z.number(), | |
| 187 | - "oid": z.number(), | |
| 186 | + "numberOfComments": z.number().int(), | |
| 187 | + "oid": z.number().int(), | |
| 188 | 188 | "owner": OwnerSchema, |
| 189 | 189 | "provenance": z.string(), |
| 190 | 190 | "publicationAppendEnabled": z.boolean(), |
| 191 | - "publicationDate": z.number(), | |
| 192 | - "publicationGroup": z.number(), | |
| 191 | + "publicationDate": z.number().int(), | |
| 192 | + "publicationGroup": z.number().int(), | |
| 193 | 193 | "publicationStage": z.string(), |
| 194 | 194 | "query": QuerySchema, |
| 195 | 195 | "rights": z.array(z.string()), |
| 196 | - "rowsUpdatedAt": z.number(), | |
| 196 | + "rowsUpdatedAt": z.number().int(), | |
| 197 | 197 | "rowsUpdatedBy": z.string(), |
| 198 | 198 | "tableAuthor": OwnerSchema, |
| 199 | - "tableId": z.number(), | |
| 199 | + "tableId": z.number().int(), | |
| 200 | 200 | "tags": z.array(z.string()), |
| 201 | - "totalTimesRated": z.number(), | |
| 202 | - "viewCount": z.number(), | |
| 203 | - "viewLastModified": z.number(), | |
| 201 | + "totalTimesRated": z.number().int(), | |
| 202 | + "viewCount": z.number().int(), | |
| 203 | + "viewLastModified": z.number().int(), | |
| 204 | 204 | "viewType": z.string(), |
| 205 | 205 | }); |
| 206 | 206 | export type View = z.infer<typeof ViewSchema>; |
| @@ -211,7 +211,7 @@ export const MetaSchema = z.object({ | ||
| 211 | 211 | export type Meta = z.infer<typeof MetaSchema>; |
| 212 | 212 | |
| 213 | 213 | export const TopLevelSchema = z.object({ |
| 214 | - "data": z.array(z.array(z.union([z.null(), z.number(), z.string()]))), | |
| 214 | + "data": z.array(z.array(z.union([z.null(), z.number().int(), z.string()]))), | |
| 215 | 215 | "meta": MetaSchema, |
| 216 | 216 | }); |
| 217 | 217 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +4 −4test/inputs/json/misc/65dec.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -68,7 +68,7 @@ export type Ruling = z.infer<typeof RulingSchema>; | ||
| 68 | 68 | |
| 69 | 69 | export const CardSchema = z.object({ |
| 70 | 70 | "artist": z.string(), |
| 71 | - "cmc": z.number(), | |
| 71 | + "cmc": z.number().int(), | |
| 72 | 72 | "colorIdentity": z.array(ColorIdentitySchema).optional(), |
| 73 | 73 | "colors": z.array(WatermarkSchema).optional(), |
| 74 | 74 | "flavor": z.string().optional(), |
| @@ -78,7 +78,7 @@ export const CardSchema = z.object({ | ||
| 78 | 78 | "legalities": z.array(LegalityElementSchema), |
| 79 | 79 | "manaCost": z.string().optional(), |
| 80 | 80 | "mciNumber": z.string().optional(), |
| 81 | - "multiverseid": z.number(), | |
| 81 | + "multiverseid": z.number().int(), | |
| 82 | 82 | "name": z.string(), |
| 83 | 83 | "originalText": z.string(), |
| 84 | 84 | "originalType": z.string(), |
| @@ -93,7 +93,7 @@ export const CardSchema = z.object({ | ||
| 93 | 93 | "toughness": z.string().optional(), |
| 94 | 94 | "type": z.string(), |
| 95 | 95 | "types": z.array(TypeSchema), |
| 96 | - "variations": z.array(z.number()).optional(), | |
| 96 | + "variations": z.array(z.number().int()).optional(), | |
| 97 | 97 | "watermark": WatermarkSchema.optional(), |
| 98 | 98 | }); |
| 99 | 99 | export type Card = z.infer<typeof CardSchema>; |
| @@ -105,7 +105,7 @@ export const TopLevelSchema = z.object({ | ||
| 105 | 105 | "code": z.string(), |
| 106 | 106 | "gathererCode": z.string(), |
| 107 | 107 | "magicCardsInfoCode": z.string(), |
| 108 | - "mkm_id": z.number(), | |
| 108 | + "mkm_id": z.number().int(), | |
| 109 | 109 | "mkm_name": z.string(), |
| 110 | 110 | "name": z.string(), |
| 111 | 111 | "releaseDate": z.string(), |
Test case
1 generated file · +1 −1test/inputs/json/misc/6617c.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -10,6 +10,6 @@ export type IssPosition = z.infer<typeof IssPositionSchema>; | ||
| 10 | 10 | export const TopLevelSchema = z.object({ |
| 11 | 11 | "iss_position": IssPositionSchema, |
| 12 | 12 | "message": z.string(), |
| 13 | - "timestamp": z.number(), | |
| 13 | + "timestamp": z.number().int(), | |
| 14 | 14 | }); |
| 15 | 15 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/67c03.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -9,7 +9,7 @@ export type Person = z.infer<typeof PersonSchema>; | ||
| 9 | 9 | |
| 10 | 10 | export const TopLevelSchema = z.object({ |
| 11 | 11 | "message": z.string(), |
| 12 | - "number": z.number(), | |
| 12 | + "number": z.number().int(), | |
| 13 | 13 | "people": z.array(PersonSchema), |
| 14 | 14 | }); |
| 15 | 15 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +12 −12test/inputs/json/misc/68c30.json
Mtypescript-zoddefault / TopLevel.ts+12 −12
| @@ -3,19 +3,19 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const OutSchema = z.object({ |
| 5 | 5 | "addr": z.string(), |
| 6 | - "n": z.number(), | |
| 6 | + "n": z.number().int(), | |
| 7 | 7 | "script": z.string(), |
| 8 | 8 | "spent": z.boolean(), |
| 9 | - "tx_index": z.number(), | |
| 10 | - "type": z.number(), | |
| 11 | - "value": z.number(), | |
| 9 | + "tx_index": z.number().int(), | |
| 10 | + "type": z.number().int(), | |
| 11 | + "value": z.number().int(), | |
| 12 | 12 | }); |
| 13 | 13 | export type Out = z.infer<typeof OutSchema>; |
| 14 | 14 | |
| 15 | 15 | export const InputSchema = z.object({ |
| 16 | 16 | "prev_out": OutSchema, |
| 17 | 17 | "script": z.string(), |
| 18 | - "sequence": z.number(), | |
| 18 | + "sequence": z.number().int(), | |
| 19 | 19 | }); |
| 20 | 20 | export type Input = z.infer<typeof InputSchema>; |
| 21 | 21 | |
| @@ -23,15 +23,15 @@ export const TxSchema = z.object({ | ||
| 23 | 23 | "double_spend": z.boolean(), |
| 24 | 24 | "hash": z.string(), |
| 25 | 25 | "inputs": z.array(InputSchema), |
| 26 | - "lock_time": z.number(), | |
| 26 | + "lock_time": z.number().int(), | |
| 27 | 27 | "out": z.array(OutSchema), |
| 28 | 28 | "relayed_by": z.string(), |
| 29 | - "size": z.number(), | |
| 30 | - "time": z.number(), | |
| 31 | - "tx_index": z.number(), | |
| 32 | - "ver": z.number(), | |
| 33 | - "vin_sz": z.number(), | |
| 34 | - "vout_sz": z.number(), | |
| 29 | + "size": z.number().int(), | |
| 30 | + "time": z.number().int(), | |
| 31 | + "tx_index": z.number().int(), | |
| 32 | + "ver": z.number().int(), | |
| 33 | + "vin_sz": z.number().int(), | |
| 34 | + "vout_sz": z.number().int(), | |
| 35 | 35 | }); |
| 36 | 36 | export type Tx = z.infer<typeof TxSchema>; |
Test case
1 generated file · +4 −4test/inputs/json/misc/6c155.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -3,14 +3,14 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const ResponseInfoSchema = z.object({ |
| 5 | 5 | "developerMessage": z.string(), |
| 6 | - "status": z.number(), | |
| 6 | + "status": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type ResponseInfo = z.infer<typeof ResponseInfoSchema>; |
| 9 | 9 | |
| 10 | 10 | export const ResultsetSchema = z.object({ |
| 11 | - "count": z.number(), | |
| 12 | - "page": z.number(), | |
| 13 | - "pagesize": z.number(), | |
| 11 | + "count": z.number().int(), | |
| 12 | + "page": z.number().int(), | |
| 13 | + "pagesize": z.number().int(), | |
| 14 | 14 | }); |
| 15 | 15 | export type Resultset = z.infer<typeof ResultsetSchema>; |
Test case
1 generated file · +15 −15test/inputs/json/misc/6de06.json
Mtypescript-zoddefault / TopLevel.ts+15 −15
| @@ -22,32 +22,32 @@ export type Kind = z.infer<typeof KindSchema>; | ||
| 22 | 22 | |
| 23 | 23 | export const OembedSchema = z.object({ |
| 24 | 24 | "description": z.string(), |
| 25 | - "height": z.number(), | |
| 25 | + "height": z.number().int(), | |
| 26 | 26 | "html": z.string(), |
| 27 | 27 | "provider_name": z.string(), |
| 28 | 28 | "provider_url": z.string(), |
| 29 | - "thumbnail_height": z.number(), | |
| 29 | + "thumbnail_height": z.number().int(), | |
| 30 | 30 | "thumbnail_url": z.string(), |
| 31 | - "thumbnail_width": z.number(), | |
| 31 | + "thumbnail_width": z.number().int(), | |
| 32 | 32 | "title": z.string(), |
| 33 | 33 | "type": z.string(), |
| 34 | 34 | "version": z.string(), |
| 35 | - "width": z.number(), | |
| 35 | + "width": z.number().int(), | |
| 36 | 36 | }); |
| 37 | 37 | export type Oembed = z.infer<typeof OembedSchema>; |
| 38 | 38 | |
| 39 | 39 | export const MediaEmbedSchema = z.object({ |
| 40 | 40 | "content": z.string().optional(), |
| 41 | - "height": z.number().optional(), | |
| 41 | + "height": z.number().int().optional(), | |
| 42 | 42 | "scrolling": z.boolean().optional(), |
| 43 | - "width": z.number().optional(), | |
| 43 | + "width": z.number().int().optional(), | |
| 44 | 44 | }); |
| 45 | 45 | export type MediaEmbed = z.infer<typeof MediaEmbedSchema>; |
| 46 | 46 | |
| 47 | 47 | export const SourceSchema = z.object({ |
| 48 | - "height": z.number(), | |
| 48 | + "height": z.number().int(), | |
| 49 | 49 | "url": z.string(), |
| 50 | - "width": z.number(), | |
| 50 | + "width": z.number().int(), | |
| 51 | 51 | }); |
| 52 | 52 | export type Source = z.infer<typeof SourceSchema>; |
| 53 | 53 | |
| @@ -103,9 +103,9 @@ export const ChildDataSchema = z.object({ | ||
| 103 | 103 | "created_utc": z.number(), |
| 104 | 104 | "distinguished": z.null(), |
| 105 | 105 | "domain": z.string(), |
| 106 | - "downs": z.number(), | |
| 106 | + "downs": z.number().int(), | |
| 107 | 107 | "edited": z.boolean(), |
| 108 | - "gilded": z.number(), | |
| 108 | + "gilded": z.number().int(), | |
| 109 | 109 | "hidden": z.boolean(), |
| 110 | 110 | "hide_score": z.boolean(), |
| 111 | 111 | "id": z.string(), |
| @@ -119,7 +119,7 @@ export const ChildDataSchema = z.object({ | ||
| 119 | 119 | "media_embed": MediaEmbedSchema, |
| 120 | 120 | "mod_reports": z.array(z.any()), |
| 121 | 121 | "name": z.string(), |
| 122 | - "num_comments": z.number(), | |
| 122 | + "num_comments": z.number().int(), | |
| 123 | 123 | "num_reports": z.null(), |
| 124 | 124 | "over_18": z.boolean(), |
| 125 | 125 | "permalink": z.string(), |
| @@ -129,7 +129,7 @@ export const ChildDataSchema = z.object({ | ||
| 129 | 129 | "removal_reason": z.null(), |
| 130 | 130 | "report_reasons": z.null(), |
| 131 | 131 | "saved": z.boolean(), |
| 132 | - "score": z.number(), | |
| 132 | + "score": z.number().int(), | |
| 133 | 133 | "secure_media": z.union([z.null(), MediaSchema]), |
| 134 | 134 | "secure_media_embed": MediaEmbedSchema, |
| 135 | 135 | "selftext": z.string(), |
| @@ -142,10 +142,10 @@ export const ChildDataSchema = z.object({ | ||
| 142 | 142 | "subreddit_type": SubredditTypeSchema, |
| 143 | 143 | "suggested_sort": z.union([z.null(), z.string()]), |
| 144 | 144 | "thumbnail": z.string(), |
| 145 | - "thumbnail_height": z.union([z.null(), z.number()]), | |
| 146 | - "thumbnail_width": z.union([z.null(), z.number()]), | |
| 145 | + "thumbnail_height": z.union([z.null(), z.number().int()]), | |
| 146 | + "thumbnail_width": z.union([z.null(), z.number().int()]), | |
| 147 | 147 | "title": z.string(), |
| 148 | - "ups": z.number(), | |
| 148 | + "ups": z.number().int(), | |
| 149 | 149 | "url": z.string(), |
| 150 | 150 | "user_reports": z.array(z.any()), |
| 151 | 151 | "view_count": z.null(), |
Test case
1 generated file · +1 −1test/inputs/json/misc/6dec6.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -112,7 +112,7 @@ export const ResultsSchema = z.object({ | ||
| 112 | 112 | export type Results = z.infer<typeof ResultsSchema>; |
| 113 | 113 | |
| 114 | 114 | export const QuerySchema = z.object({ |
| 115 | - "count": z.number(), | |
| 115 | + "count": z.number().int(), | |
| 116 | 116 | "created": z.coerce.date(), |
| 117 | 117 | "lang": z.string(), |
| 118 | 118 | "results": ResultsSchema, |
Test case
1 generated file · +12 −12test/inputs/json/misc/734ad.json
Mtypescript-zoddefault / TopLevel.ts+12 −12
| @@ -30,7 +30,7 @@ export const ResultSchema = z.object({ | ||
| 30 | 30 | "be_office_street": z.string().optional(), |
| 31 | 31 | "be_office_town": z.string().optional(), |
| 32 | 32 | "code_of_conduct": z.string(), |
| 33 | - "contact_country": z.number(), | |
| 33 | + "contact_country": z.number().int(), | |
| 34 | 34 | "created_at": z.coerce.date(), |
| 35 | 35 | "entity": z.string(), |
| 36 | 36 | "goals": z.string(), |
| @@ -49,23 +49,23 @@ export const ResultSchema = z.object({ | ||
| 49 | 49 | "last_update_date": z.coerce.date(), |
| 50 | 50 | "legal": z.string(), |
| 51 | 51 | "legal_status": z.string(), |
| 52 | - "main_category": z.number(), | |
| 52 | + "main_category": z.number().int(), | |
| 53 | 53 | "main_category_title": z.string(), |
| 54 | - "members": z.number(), | |
| 55 | - "members_100": z.union([z.null(), z.number()]), | |
| 56 | - "members_25": z.union([z.null(), z.number()]), | |
| 57 | - "members_50": z.union([z.null(), z.number()]), | |
| 58 | - "members_75": z.union([z.null(), z.number()]), | |
| 54 | + "members": z.number().int(), | |
| 55 | + "members_100": z.union([z.null(), z.number().int()]), | |
| 56 | + "members_25": z.union([z.null(), z.number().int()]), | |
| 57 | + "members_50": z.union([z.null(), z.number().int()]), | |
| 58 | + "members_75": z.union([z.null(), z.number().int()]), | |
| 59 | 59 | "members_fte": z.number(), |
| 60 | 60 | "name": z.string(), |
| 61 | 61 | "native_name": z.null(), |
| 62 | 62 | "networking": z.union([z.null(), z.string()]), |
| 63 | - "number_of_natural_persons": z.union([z.null(), z.number()]), | |
| 63 | + "number_of_natural_persons": z.union([z.null(), z.number().int()]), | |
| 64 | 64 | "other_code_of_conduct": z.union([z.null(), z.string()]), |
| 65 | 65 | "registration_date": z.coerce.date(), |
| 66 | 66 | "status": StatusSchema, |
| 67 | 67 | "structure_members": z.string(), |
| 68 | - "sub_category": z.number(), | |
| 68 | + "sub_category": z.number().int(), | |
| 69 | 69 | "sub_category_title": z.string(), |
| 70 | 70 | "updated_at": z.coerce.date(), |
| 71 | 71 | "uri": z.string(), |
| @@ -74,11 +74,11 @@ export const ResultSchema = z.object({ | ||
| 74 | 74 | export type Result = z.infer<typeof ResultSchema>; |
| 75 | 75 | |
| 76 | 76 | export const TopLevelSchema = z.object({ |
| 77 | - "count": z.number(), | |
| 77 | + "count": z.number().int(), | |
| 78 | 78 | "facets": FacetsSchema, |
| 79 | - "limit": z.number(), | |
| 79 | + "limit": z.number().int(), | |
| 80 | 80 | "next": z.string(), |
| 81 | - "offset": z.number(), | |
| 81 | + "offset": z.number().int(), | |
| 82 | 82 | "previous": z.boolean(), |
| 83 | 83 | "results": z.array(ResultSchema), |
| 84 | 84 | }); |
Test case
1 generated file · +5 −5test/inputs/json/misc/7681c.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -72,14 +72,14 @@ export type User = z.infer<typeof UserSchema>; | ||
| 72 | 72 | export const MetaSchema = z.object({ |
| 73 | 73 | "msg": z.string(), |
| 74 | 74 | "response_id": z.string(), |
| 75 | - "status": z.number(), | |
| 75 | + "status": z.number().int(), | |
| 76 | 76 | }); |
| 77 | 77 | export type Meta = z.infer<typeof MetaSchema>; |
| 78 | 78 | |
| 79 | 79 | export const PaginationSchema = z.object({ |
| 80 | - "count": z.number(), | |
| 81 | - "offset": z.number(), | |
| 82 | - "total_count": z.number(), | |
| 80 | + "count": z.number().int(), | |
| 81 | + "offset": z.number().int(), | |
| 82 | + "total_count": z.number().int(), | |
| 83 | 83 | }); |
| 84 | 84 | export type Pagination = z.infer<typeof PaginationSchema>; |
| 85 | 85 | |
| @@ -118,7 +118,7 @@ export const DatumSchema = z.object({ | ||
| 118 | 118 | "id": z.string(), |
| 119 | 119 | "images": ImagesSchema, |
| 120 | 120 | "import_datetime": z.string(), |
| 121 | - "is_indexable": z.number(), | |
| 121 | + "is_indexable": z.number().int(), | |
| 122 | 122 | "rating": RatingSchema, |
| 123 | 123 | "slug": z.string(), |
| 124 | 124 | "source": z.string(), |
Test case
1 generated file · +2 −2test/inputs/json/misc/7df41.json
Mtypescript-zoddefault / TopLevel.ts+2 −2
| @@ -2,9 +2,9 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const PcSchema = z.object({ |
| 5 | - "count": z.number(), | |
| 5 | + "count": z.number().int(), | |
| 6 | 6 | "label": z.string(), |
| 7 | - "peak24": z.number(), | |
| 7 | + "peak24": z.number().int(), | |
| 8 | 8 | }); |
| 9 | 9 | export type Pc = z.infer<typeof PcSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/7dfa6.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/7eb30.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -46,20 +46,20 @@ export const ResultSchema = z.object({ | ||
| 46 | 46 | "fav": z.boolean(), |
| 47 | 47 | "group": GroupSchema, |
| 48 | 48 | "location": LocationSchema, |
| 49 | - "min_screens": z.number(), | |
| 50 | - "num_views": z.number(), | |
| 49 | + "min_screens": z.number().int(), | |
| 50 | + "num_views": z.number().int(), | |
| 51 | 51 | "showtimes": z.string(), |
| 52 | - "stars": z.number(), | |
| 52 | + "stars": z.number().int(), | |
| 53 | 53 | "tel": TelSchema, |
| 54 | 54 | "thai": z.string(), |
| 55 | - "today_screens": z.number(), | |
| 55 | + "today_screens": z.number().int(), | |
| 56 | 56 | "url": z.string(), |
| 57 | 57 | "website": z.string(), |
| 58 | 58 | }); |
| 59 | 59 | export type Result = z.infer<typeof ResultSchema>; |
| 60 | 60 | |
| 61 | 61 | export const TopLevelSchema = z.object({ |
| 62 | - "count": z.number(), | |
| 62 | + "count": z.number().int(), | |
| 63 | 63 | "next": z.string(), |
| 64 | 64 | "previous": z.null(), |
| 65 | 65 | "results": z.array(ResultSchema), |
Test case
1 generated file · +6 −6test/inputs/json/misc/80aff.json
Mtypescript-zoddefault / TopLevel.ts+6 −6
| @@ -7,21 +7,21 @@ export type Facets = z.infer<typeof FacetsSchema>; | ||
| 7 | 7 | |
| 8 | 8 | export const ResultSchema = z.object({ |
| 9 | 9 | "created_at": z.coerce.date(), |
| 10 | - "id": z.number(), | |
| 11 | - "items": z.number(), | |
| 10 | + "id": z.number().int(), | |
| 11 | + "items": z.number().int(), | |
| 12 | 12 | "name": z.string(), |
| 13 | - "parent": z.union([z.null(), z.number()]), | |
| 13 | + "parent": z.union([z.null(), z.number().int()]), | |
| 14 | 14 | "updated_at": z.coerce.date(), |
| 15 | 15 | "uri": z.string(), |
| 16 | 16 | }); |
| 17 | 17 | export type Result = z.infer<typeof ResultSchema>; |
| 18 | 18 | |
| 19 | 19 | export const TopLevelSchema = z.object({ |
| 20 | - "count": z.number(), | |
| 20 | + "count": z.number().int(), | |
| 21 | 21 | "facets": FacetsSchema, |
| 22 | - "limit": z.number(), | |
| 22 | + "limit": z.number().int(), | |
| 23 | 23 | "next": z.boolean(), |
| 24 | - "offset": z.number(), | |
| 24 | + "offset": z.number().int(), | |
| 25 | 25 | "previous": z.boolean(), |
| 26 | 26 | "results": z.array(ResultSchema), |
| 27 | 27 | }); |
Test case
1 generated file · +1 −1test/inputs/json/misc/88130.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -105,7 +105,7 @@ export const ResultsSchema = z.object({ | ||
| 105 | 105 | export type Results = z.infer<typeof ResultsSchema>; |
| 106 | 106 | |
| 107 | 107 | export const QuerySchema = z.object({ |
| 108 | - "count": z.number(), | |
| 108 | + "count": z.number().int(), | |
| 109 | 109 | "created": z.coerce.date(), |
| 110 | 110 | "lang": z.string(), |
| 111 | 111 | "results": ResultsSchema, |
Test case
1 generated file · +1 −1test/inputs/json/misc/8a62c.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/9929c.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -105,7 +105,7 @@ export const ResultsSchema = z.object({ | ||
| 105 | 105 | export type Results = z.infer<typeof ResultsSchema>; |
| 106 | 106 | |
| 107 | 107 | export const QuerySchema = z.object({ |
| 108 | - "count": z.number(), | |
| 108 | + "count": z.number().int(), | |
| 109 | 109 | "created": z.coerce.date(), |
| 110 | 110 | "lang": z.string(), |
| 111 | 111 | "results": ResultsSchema, |
Test case
1 generated file · +3 −3test/inputs/json/misc/9ac3b.json
Mtypescript-zoddefault / TopLevel.ts+3 −3
| @@ -34,11 +34,11 @@ export const ResultSchema = z.object({ | ||
| 34 | 34 | export type Result = z.infer<typeof ResultSchema>; |
| 35 | 35 | |
| 36 | 36 | export const TopLevelSchema = z.object({ |
| 37 | - "count": z.number(), | |
| 37 | + "count": z.number().int(), | |
| 38 | 38 | "facets": FacetsSchema, |
| 39 | - "limit": z.number(), | |
| 39 | + "limit": z.number().int(), | |
| 40 | 40 | "next": z.string(), |
| 41 | - "offset": z.number(), | |
| 41 | + "offset": z.number().int(), | |
| 42 | 42 | "previous": z.boolean(), |
| 43 | 43 | "results": z.array(ResultSchema), |
| 44 | 44 | }); |
Test case
1 generated file · +1 −1test/inputs/json/misc/a0496.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -14,7 +14,7 @@ export const TopLevelSchema = z.object({ | ||
| 14 | 14 | "errors": ErrorsSchema, |
| 15 | 15 | "frequency": z.string(), |
| 16 | 16 | "from_date": z.string(), |
| 17 | - "id": z.number(), | |
| 17 | + "id": z.number().int(), | |
| 18 | 18 | "name": z.string(), |
| 19 | 19 | "premium": z.boolean(), |
| 20 | 20 | "source_code": z.string(), |
Test case
1 generated file · +1 −1test/inputs/json/misc/a1eca.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -105,7 +105,7 @@ export const ResultsSchema = z.object({ | ||
| 105 | 105 | export type Results = z.infer<typeof ResultsSchema>; |
| 106 | 106 | |
| 107 | 107 | export const QuerySchema = z.object({ |
| 108 | - "count": z.number(), | |
| 108 | + "count": z.number().int(), | |
| 109 | 109 | "created": z.coerce.date(), |
| 110 | 110 | "lang": z.string(), |
| 111 | 111 | "results": ResultsSchema, |
Test case
1 generated file · +21 −21test/inputs/json/misc/a3d8c.json
Mtypescript-zoddefault / TopLevel.ts+21 −21
| @@ -9,7 +9,7 @@ export const TypeNameSchema = z.enum([ | ||
| 9 | 9 | export type TypeName = z.infer<typeof TypeNameSchema>; |
| 10 | 10 | |
| 11 | 11 | export const TopSchema = z.object({ |
| 12 | - "count": z.number(), | |
| 12 | + "count": z.number().int(), | |
| 13 | 13 | "item": z.string(), |
| 14 | 14 | }); |
| 15 | 15 | export type Top = z.infer<typeof TopSchema>; |
| @@ -45,8 +45,8 @@ export type Owner = z.infer<typeof OwnerSchema>; | ||
| 45 | 45 | export const CachedContentsSchema = z.object({ |
| 46 | 46 | "average": z.string().optional(), |
| 47 | 47 | "largest": z.string(), |
| 48 | - "non_null": z.number(), | |
| 49 | - "null": z.number(), | |
| 48 | + "non_null": z.number().int(), | |
| 49 | + "null": z.number().int(), | |
| 50 | 50 | "smallest": z.string(), |
| 51 | 51 | "sum": z.string().optional(), |
| 52 | 52 | "top": z.array(TopSchema), |
| @@ -64,12 +64,12 @@ export const ColumnSchema = z.object({ | ||
| 64 | 64 | "fieldName": z.string(), |
| 65 | 65 | "flags": z.array(z.string()).optional(), |
| 66 | 66 | "format": QuerySchema, |
| 67 | - "id": z.number(), | |
| 67 | + "id": z.number().int(), | |
| 68 | 68 | "name": z.string(), |
| 69 | - "position": z.number(), | |
| 69 | + "position": z.number().int(), | |
| 70 | 70 | "renderTypeName": TypeNameSchema, |
| 71 | - "tableColumnId": z.number().optional(), | |
| 72 | - "width": z.number().optional(), | |
| 71 | + "tableColumnId": z.number().int().optional(), | |
| 72 | + "width": z.number().int().optional(), | |
| 73 | 73 | }); |
| 74 | 74 | export type Column = z.infer<typeof ColumnSchema>; |
| 75 | 75 | |
| @@ -83,42 +83,42 @@ export const MetadataSchema = z.object({ | ||
| 83 | 83 | export type Metadata = z.infer<typeof MetadataSchema>; |
| 84 | 84 | |
| 85 | 85 | export const ViewSchema = z.object({ |
| 86 | - "averageRating": z.number(), | |
| 86 | + "averageRating": z.number().int(), | |
| 87 | 87 | "category": z.string(), |
| 88 | 88 | "columns": z.array(ColumnSchema), |
| 89 | - "createdAt": z.number(), | |
| 89 | + "createdAt": z.number().int(), | |
| 90 | 90 | "displayType": z.string(), |
| 91 | - "downloadCount": z.number(), | |
| 91 | + "downloadCount": z.number().int(), | |
| 92 | 92 | "flags": z.array(z.string()), |
| 93 | 93 | "grants": z.array(GrantSchema), |
| 94 | 94 | "hideFromCatalog": z.boolean(), |
| 95 | 95 | "hideFromDataJson": z.boolean(), |
| 96 | 96 | "id": z.string(), |
| 97 | - "indexUpdatedAt": z.number(), | |
| 97 | + "indexUpdatedAt": z.number().int(), | |
| 98 | 98 | "license": LicenseSchema, |
| 99 | 99 | "licenseId": z.string(), |
| 100 | 100 | "locale": z.string(), |
| 101 | 101 | "metadata": MetadataSchema, |
| 102 | 102 | "name": z.string(), |
| 103 | 103 | "newBackend": z.boolean(), |
| 104 | - "numberOfComments": z.number(), | |
| 105 | - "oid": z.number(), | |
| 104 | + "numberOfComments": z.number().int(), | |
| 105 | + "oid": z.number().int(), | |
| 106 | 106 | "owner": OwnerSchema, |
| 107 | 107 | "provenance": z.string(), |
| 108 | 108 | "publicationAppendEnabled": z.boolean(), |
| 109 | - "publicationDate": z.number(), | |
| 110 | - "publicationGroup": z.number(), | |
| 109 | + "publicationDate": z.number().int(), | |
| 110 | + "publicationGroup": z.number().int(), | |
| 111 | 111 | "publicationStage": z.string(), |
| 112 | 112 | "query": QuerySchema, |
| 113 | 113 | "rights": z.array(z.string()), |
| 114 | 114 | "rowClass": z.string(), |
| 115 | - "rowsUpdatedAt": z.number(), | |
| 115 | + "rowsUpdatedAt": z.number().int(), | |
| 116 | 116 | "rowsUpdatedBy": z.string(), |
| 117 | 117 | "tableAuthor": OwnerSchema, |
| 118 | - "tableId": z.number(), | |
| 119 | - "totalTimesRated": z.number(), | |
| 120 | - "viewCount": z.number(), | |
| 121 | - "viewLastModified": z.number(), | |
| 118 | + "tableId": z.number().int(), | |
| 119 | + "totalTimesRated": z.number().int(), | |
| 120 | + "viewCount": z.number().int(), | |
| 121 | + "viewLastModified": z.number().int(), | |
| 122 | 122 | "viewType": z.string(), |
| 123 | 123 | }); |
| 124 | 124 | export type View = z.infer<typeof ViewSchema>; |
| @@ -129,7 +129,7 @@ export const MetaSchema = z.object({ | ||
| 129 | 129 | export type Meta = z.infer<typeof MetaSchema>; |
| 130 | 130 | |
| 131 | 131 | export const TopLevelSchema = z.object({ |
| 132 | - "data": z.array(z.array(z.union([z.null(), z.number(), z.string()]))), | |
| 132 | + "data": z.array(z.array(z.union([z.null(), z.number().int(), z.string()]))), | |
| 133 | 133 | "meta": MetaSchema, |
| 134 | 134 | }); |
| 135 | 135 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/a45b0.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -7,12 +7,12 @@ export const CountrySchema = z.enum([ | ||
| 7 | 7 | export type Country = z.infer<typeof CountrySchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelElementSchema = z.object({ |
| 10 | - "age": z.number(), | |
| 10 | + "age": z.number().int(), | |
| 11 | 11 | "country": CountrySchema, |
| 12 | - "females": z.number(), | |
| 13 | - "males": z.number(), | |
| 14 | - "total": z.number(), | |
| 15 | - "year": z.number(), | |
| 12 | + "females": z.number().int(), | |
| 13 | + "males": z.number().int(), | |
| 14 | + "total": z.number().int(), | |
| 15 | + "year": z.number().int(), | |
| 16 | 16 | }); |
| 17 | 17 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/ab0d1.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -7,12 +7,12 @@ export const CountrySchema = z.enum([ | ||
| 7 | 7 | export type Country = z.infer<typeof CountrySchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelElementSchema = z.object({ |
| 10 | - "age": z.number(), | |
| 10 | + "age": z.number().int(), | |
| 11 | 11 | "country": CountrySchema, |
| 12 | - "females": z.number(), | |
| 13 | - "males": z.number(), | |
| 14 | - "total": z.number(), | |
| 15 | - "year": z.number(), | |
| 12 | + "females": z.number().int(), | |
| 13 | + "males": z.number().int(), | |
| 14 | + "total": z.number().int(), | |
| 15 | + "year": z.number().int(), | |
| 16 | 16 | }); |
| 17 | 17 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/abb4b.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +6 −6test/inputs/json/misc/af2d1.json
Mtypescript-zoddefault / TopLevel.ts+6 −6
| @@ -88,7 +88,7 @@ export const FeaturePropertiesSchema = z.object({ | ||
| 88 | 88 | "area_": z.number(), |
| 89 | 89 | "asset_numb": z.string(), |
| 90 | 90 | "comments": z.union([z.null(), z.string()]), |
| 91 | - "condition": z.number(), | |
| 91 | + "condition": z.number().int(), | |
| 92 | 92 | "constructi": z.union([z.null(), z.string()]), |
| 93 | 93 | "createdate": z.null(), |
| 94 | 94 | "createuser": z.null(), |
| @@ -98,19 +98,19 @@ export const FeaturePropertiesSchema = z.object({ | ||
| 98 | 98 | "file_numbe": z.union([z.null(), z.string()]), |
| 99 | 99 | "folder_num": z.union([z.null(), z.string()]), |
| 100 | 100 | "funding_ba": z.union([z.null(), FundingBaSchema]), |
| 101 | - "historic_c": z.number(), | |
| 101 | + "historic_c": z.number().int(), | |
| 102 | 102 | "inspection": z.string(), |
| 103 | 103 | "inspectors": z.null(), |
| 104 | 104 | "last_updat": z.null(), |
| 105 | 105 | "level_accu": z.union([z.null(), LevelAccuSchema]), |
| 106 | 106 | "material": MaterialSchema, |
| 107 | - "mi_prinx": z.number(), | |
| 107 | + "mi_prinx": z.number().int(), | |
| 108 | 108 | "mi_symbolo": MiSymboloSchema, |
| 109 | - "number_lan": z.number(), | |
| 109 | + "number_lan": z.number().int(), | |
| 110 | 110 | "owner": z.union([z.null(), z.string()]), |
| 111 | 111 | "positional": z.union([z.null(), LevelAccuSchema]), |
| 112 | 112 | "project_nu": z.union([z.null(), z.string()]), |
| 113 | - "rec_id": z.number(), | |
| 113 | + "rec_id": z.number().int(), | |
| 114 | 114 | "record_cre": z.union([z.null(), z.string()]), |
| 115 | 115 | "shape_area": z.number(), |
| 116 | 116 | "shape_leng": z.number(), |
| @@ -143,7 +143,7 @@ export type Feature = z.infer<typeof FeatureSchema>; | ||
| 143 | 143 | export const TopLevelSchema = z.object({ |
| 144 | 144 | "crs": CrsSchema, |
| 145 | 145 | "features": z.array(FeatureSchema), |
| 146 | - "totalFeatures": z.number(), | |
| 146 | + "totalFeatures": z.number().int(), | |
| 147 | 147 | "type": z.string(), |
| 148 | 148 | }); |
| 149 | 149 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/b6f2c.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/bb1ec.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +15 −15test/inputs/json/misc/be234.json
Mtypescript-zoddefault / TopLevel.ts+15 −15
| @@ -50,32 +50,32 @@ export type Kind = z.infer<typeof KindSchema>; | ||
| 50 | 50 | |
| 51 | 51 | export const OembedSchema = z.object({ |
| 52 | 52 | "description": z.string(), |
| 53 | - "height": z.number(), | |
| 53 | + "height": z.number().int(), | |
| 54 | 54 | "html": z.string(), |
| 55 | 55 | "provider_name": z.string(), |
| 56 | 56 | "provider_url": z.string(), |
| 57 | - "thumbnail_height": z.number(), | |
| 57 | + "thumbnail_height": z.number().int(), | |
| 58 | 58 | "thumbnail_url": z.string(), |
| 59 | - "thumbnail_width": z.number(), | |
| 59 | + "thumbnail_width": z.number().int(), | |
| 60 | 60 | "title": z.string(), |
| 61 | 61 | "type": z.string(), |
| 62 | 62 | "version": z.string(), |
| 63 | - "width": z.number(), | |
| 63 | + "width": z.number().int(), | |
| 64 | 64 | }); |
| 65 | 65 | export type Oembed = z.infer<typeof OembedSchema>; |
| 66 | 66 | |
| 67 | 67 | export const MediaEmbedSchema = z.object({ |
| 68 | 68 | "content": z.string().optional(), |
| 69 | - "height": z.number().optional(), | |
| 69 | + "height": z.number().int().optional(), | |
| 70 | 70 | "scrolling": z.boolean().optional(), |
| 71 | - "width": z.number().optional(), | |
| 71 | + "width": z.number().int().optional(), | |
| 72 | 72 | }); |
| 73 | 73 | export type MediaEmbed = z.infer<typeof MediaEmbedSchema>; |
| 74 | 74 | |
| 75 | 75 | export const SourceSchema = z.object({ |
| 76 | - "height": z.number(), | |
| 76 | + "height": z.number().int(), | |
| 77 | 77 | "url": z.string(), |
| 78 | - "width": z.number(), | |
| 78 | + "width": z.number().int(), | |
| 79 | 79 | }); |
| 80 | 80 | export type Source = z.infer<typeof SourceSchema>; |
| 81 | 81 | |
| @@ -129,9 +129,9 @@ export const ChildDataSchema = z.object({ | ||
| 129 | 129 | "created_utc": z.number(), |
| 130 | 130 | "distinguished": z.union([z.null(), z.string()]), |
| 131 | 131 | "domain": DomainSchema, |
| 132 | - "downs": z.number(), | |
| 132 | + "downs": z.number().int(), | |
| 133 | 133 | "edited": z.boolean(), |
| 134 | - "gilded": z.number(), | |
| 134 | + "gilded": z.number().int(), | |
| 135 | 135 | "hidden": z.boolean(), |
| 136 | 136 | "hide_score": z.boolean(), |
| 137 | 137 | "id": z.string(), |
| @@ -145,7 +145,7 @@ export const ChildDataSchema = z.object({ | ||
| 145 | 145 | "media_embed": MediaEmbedSchema, |
| 146 | 146 | "mod_reports": z.array(z.any()), |
| 147 | 147 | "name": z.string(), |
| 148 | - "num_comments": z.number(), | |
| 148 | + "num_comments": z.number().int(), | |
| 149 | 149 | "num_reports": z.null(), |
| 150 | 150 | "over_18": z.boolean(), |
| 151 | 151 | "permalink": z.string(), |
| @@ -155,7 +155,7 @@ export const ChildDataSchema = z.object({ | ||
| 155 | 155 | "removal_reason": z.null(), |
| 156 | 156 | "report_reasons": z.null(), |
| 157 | 157 | "saved": z.boolean(), |
| 158 | - "score": z.number(), | |
| 158 | + "score": z.number().int(), | |
| 159 | 159 | "secure_media": z.union([z.null(), MediaSchema]), |
| 160 | 160 | "secure_media_embed": MediaEmbedSchema, |
| 161 | 161 | "selftext": z.string(), |
| @@ -168,10 +168,10 @@ export const ChildDataSchema = z.object({ | ||
| 168 | 168 | "subreddit_type": SubredditTypeSchema, |
| 169 | 169 | "suggested_sort": z.null(), |
| 170 | 170 | "thumbnail": z.string(), |
| 171 | - "thumbnail_height": z.number(), | |
| 172 | - "thumbnail_width": z.number(), | |
| 171 | + "thumbnail_height": z.number().int(), | |
| 172 | + "thumbnail_width": z.number().int(), | |
| 173 | 173 | "title": z.string(), |
| 174 | - "ups": z.number(), | |
| 174 | + "ups": z.number().int(), | |
| 175 | 175 | "url": z.string(), |
| 176 | 176 | "user_reports": z.array(z.any()), |
| 177 | 177 | "view_count": z.null(), |
Test case
1 generated file · +1 −1test/inputs/json/misc/c0356.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -9,7 +9,7 @@ export type Datum = z.infer<typeof DatumSchema>; | ||
| 9 | 9 | |
| 10 | 10 | export const DescriptionSchema = z.object({ |
| 11 | 11 | "base_period": z.string(), |
| 12 | - "missing": z.number(), | |
| 12 | + "missing": z.number().int(), | |
| 13 | 13 | "title": z.string(), |
| 14 | 14 | }); |
| 15 | 15 | export type Description = z.infer<typeof DescriptionSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/c3303.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -69,14 +69,14 @@ export type User = z.infer<typeof UserSchema>; | ||
| 69 | 69 | export const MetaSchema = z.object({ |
| 70 | 70 | "msg": z.string(), |
| 71 | 71 | "response_id": z.string(), |
| 72 | - "status": z.number(), | |
| 72 | + "status": z.number().int(), | |
| 73 | 73 | }); |
| 74 | 74 | export type Meta = z.infer<typeof MetaSchema>; |
| 75 | 75 | |
| 76 | 76 | export const PaginationSchema = z.object({ |
| 77 | - "count": z.number(), | |
| 78 | - "offset": z.number(), | |
| 79 | - "total_count": z.number(), | |
| 77 | + "count": z.number().int(), | |
| 78 | + "offset": z.number().int(), | |
| 79 | + "total_count": z.number().int(), | |
| 80 | 80 | }); |
| 81 | 81 | export type Pagination = z.infer<typeof PaginationSchema>; |
| 82 | 82 | |
| @@ -115,7 +115,7 @@ export const DatumSchema = z.object({ | ||
| 115 | 115 | "id": z.string(), |
| 116 | 116 | "images": ImagesSchema, |
| 117 | 117 | "import_datetime": z.string(), |
| 118 | - "is_indexable": z.number(), | |
| 118 | + "is_indexable": z.number().int(), | |
| 119 | 119 | "rating": RatingSchema, |
| 120 | 120 | "slug": z.string(), |
| 121 | 121 | "source": z.string(), |
Test case
1 generated file · +1 −1test/inputs/json/misc/cf0d8.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -105,7 +105,7 @@ export const ResultsSchema = z.object({ | ||
| 105 | 105 | export type Results = z.infer<typeof ResultsSchema>; |
| 106 | 106 | |
| 107 | 107 | export const QuerySchema = z.object({ |
| 108 | - "count": z.number(), | |
| 108 | + "count": z.number().int(), | |
| 109 | 109 | "created": z.coerce.date(), |
| 110 | 110 | "lang": z.string(), |
| 111 | 111 | "results": ResultsSchema, |
Test case
1 generated file · +1 −1test/inputs/json/misc/d0908.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -3,7 +3,7 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TotalPopulationSchema = z.object({ |
| 5 | 5 | "date": z.string(), |
| 6 | - "population": z.number(), | |
| 6 | + "population": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type TotalPopulation = z.infer<typeof TotalPopulationSchema>; |
Test case
1 generated file · +3 −3test/inputs/json/misc/d23d5.json
Mtypescript-zoddefault / TopLevel.ts+3 −3
| @@ -16,11 +16,11 @@ export const ResultSchema = z.object({ | ||
| 16 | 16 | export type Result = z.infer<typeof ResultSchema>; |
| 17 | 17 | |
| 18 | 18 | export const TopLevelSchema = z.object({ |
| 19 | - "count": z.number(), | |
| 19 | + "count": z.number().int(), | |
| 20 | 20 | "facets": FacetsSchema, |
| 21 | - "limit": z.number(), | |
| 21 | + "limit": z.number().int(), | |
| 22 | 22 | "next": z.string(), |
| 23 | - "offset": z.number(), | |
| 23 | + "offset": z.number().int(), | |
| 24 | 24 | "previous": z.boolean(), |
| 25 | 25 | "results": z.array(ResultSchema), |
| 26 | 26 | }); |
Test case
1 generated file · +1 −1test/inputs/json/misc/dbfb3.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -111,7 +111,7 @@ export const ResultsSchema = z.object({ | ||
| 111 | 111 | export type Results = z.infer<typeof ResultsSchema>; |
| 112 | 112 | |
| 113 | 113 | export const QuerySchema = z.object({ |
| 114 | - "count": z.number(), | |
| 114 | + "count": z.number().int(), | |
| 115 | 115 | "created": z.coerce.date(), |
| 116 | 116 | "lang": z.string(), |
| 117 | 117 | "results": ResultsSchema, |
Test case
1 generated file · +4 −4test/inputs/json/misc/dc44f.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -117,7 +117,7 @@ export type Ruling = z.infer<typeof RulingSchema>; | ||
| 117 | 117 | |
| 118 | 118 | export const CardSchema = z.object({ |
| 119 | 119 | "artist": z.string(), |
| 120 | - "cmc": z.number(), | |
| 120 | + "cmc": z.number().int(), | |
| 121 | 121 | "colorIdentity": z.array(ColorIdentitySchema).optional(), |
| 122 | 122 | "colors": z.array(ColorSchema).optional(), |
| 123 | 123 | "flavor": z.string().optional(), |
| @@ -127,7 +127,7 @@ export const CardSchema = z.object({ | ||
| 127 | 127 | "legalities": z.array(LegalityElementSchema), |
| 128 | 128 | "manaCost": z.string().optional(), |
| 129 | 129 | "mciNumber": z.string().optional(), |
| 130 | - "multiverseid": z.number(), | |
| 130 | + "multiverseid": z.number().int(), | |
| 131 | 131 | "name": z.string(), |
| 132 | 132 | "originalText": z.string().optional(), |
| 133 | 133 | "originalType": z.string(), |
| @@ -142,7 +142,7 @@ export const CardSchema = z.object({ | ||
| 142 | 142 | "toughness": z.string().optional(), |
| 143 | 143 | "type": z.string(), |
| 144 | 144 | "types": z.array(TypeSchema), |
| 145 | - "variations": z.array(z.number()).optional(), | |
| 145 | + "variations": z.array(z.number().int()).optional(), | |
| 146 | 146 | }); |
| 147 | 147 | export type Card = z.infer<typeof CardSchema>; |
| 148 | 148 | |
| @@ -153,7 +153,7 @@ export const TopLevelSchema = z.object({ | ||
| 153 | 153 | "code": z.string(), |
| 154 | 154 | "gathererCode": z.string(), |
| 155 | 155 | "magicCardsInfoCode": z.string(), |
| 156 | - "mkm_id": z.number(), | |
| 156 | + "mkm_id": z.number().int(), | |
| 157 | 157 | "mkm_name": z.string(), |
| 158 | 158 | "name": z.string(), |
| 159 | 159 | "releaseDate": z.string(), |
Test case
1 generated file · +4 −4test/inputs/json/misc/dd1ce.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -117,7 +117,7 @@ export type Ruling = z.infer<typeof RulingSchema>; | ||
| 117 | 117 | |
| 118 | 118 | export const CardSchema = z.object({ |
| 119 | 119 | "artist": z.string(), |
| 120 | - "cmc": z.number(), | |
| 120 | + "cmc": z.number().int(), | |
| 121 | 121 | "colorIdentity": z.array(ColorIdentitySchema).optional(), |
| 122 | 122 | "colors": z.array(ColorSchema).optional(), |
| 123 | 123 | "flavor": z.string().optional(), |
| @@ -127,7 +127,7 @@ export const CardSchema = z.object({ | ||
| 127 | 127 | "legalities": z.array(LegalityElementSchema), |
| 128 | 128 | "manaCost": z.string().optional(), |
| 129 | 129 | "mciNumber": z.string().optional(), |
| 130 | - "multiverseid": z.number(), | |
| 130 | + "multiverseid": z.number().int(), | |
| 131 | 131 | "name": z.string(), |
| 132 | 132 | "originalText": z.string().optional(), |
| 133 | 133 | "originalType": z.string(), |
| @@ -142,7 +142,7 @@ export const CardSchema = z.object({ | ||
| 142 | 142 | "toughness": z.string().optional(), |
| 143 | 143 | "type": z.string(), |
| 144 | 144 | "types": z.array(TypeSchema), |
| 145 | - "variations": z.array(z.number()).optional(), | |
| 145 | + "variations": z.array(z.number().int()).optional(), | |
| 146 | 146 | }); |
| 147 | 147 | export type Card = z.infer<typeof CardSchema>; |
| 148 | 148 | |
| @@ -153,7 +153,7 @@ export const TopLevelSchema = z.object({ | ||
| 153 | 153 | "code": z.string(), |
| 154 | 154 | "gathererCode": z.string(), |
| 155 | 155 | "magicCardsInfoCode": z.string(), |
| 156 | - "mkm_id": z.number(), | |
| 156 | + "mkm_id": z.number().int(), | |
| 157 | 157 | "mkm_name": z.string(), |
| 158 | 158 | "name": z.string(), |
| 159 | 159 | "releaseDate": z.string(), |
Test case
1 generated file · +4 −4test/inputs/json/misc/dec3a.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -3,14 +3,14 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const ResponseInfoSchema = z.object({ |
| 5 | 5 | "developerMessage": z.string(), |
| 6 | - "status": z.number(), | |
| 6 | + "status": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type ResponseInfo = z.infer<typeof ResponseInfoSchema>; |
| 9 | 9 | |
| 10 | 10 | export const ResultsetSchema = z.object({ |
| 11 | - "count": z.number(), | |
| 12 | - "page": z.number(), | |
| 13 | - "pagesize": z.number(), | |
| 11 | + "count": z.number().int(), | |
| 12 | + "page": z.number().int(), | |
| 13 | + "pagesize": z.number().int(), | |
| 14 | 14 | }); |
| 15 | 15 | export type Resultset = z.infer<typeof ResultsetSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/df957.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -105,7 +105,7 @@ export const ResultsSchema = z.object({ | ||
| 105 | 105 | export type Results = z.infer<typeof ResultsSchema>; |
| 106 | 106 | |
| 107 | 107 | export const QuerySchema = z.object({ |
| 108 | - "count": z.number(), | |
| 108 | + "count": z.number().int(), | |
| 109 | 109 | "created": z.coerce.date(), |
| 110 | 110 | "lang": z.string(), |
| 111 | 111 | "results": ResultsSchema, |
Test case
1 generated file · +5 −5test/inputs/json/misc/e0ac7.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -63,14 +63,14 @@ export type User = z.infer<typeof UserSchema>; | ||
| 63 | 63 | export const MetaSchema = z.object({ |
| 64 | 64 | "msg": z.string(), |
| 65 | 65 | "response_id": z.string(), |
| 66 | - "status": z.number(), | |
| 66 | + "status": z.number().int(), | |
| 67 | 67 | }); |
| 68 | 68 | export type Meta = z.infer<typeof MetaSchema>; |
| 69 | 69 | |
| 70 | 70 | export const PaginationSchema = z.object({ |
| 71 | - "count": z.number(), | |
| 72 | - "offset": z.number(), | |
| 73 | - "total_count": z.number(), | |
| 71 | + "count": z.number().int(), | |
| 72 | + "offset": z.number().int(), | |
| 73 | + "total_count": z.number().int(), | |
| 74 | 74 | }); |
| 75 | 75 | export type Pagination = z.infer<typeof PaginationSchema>; |
| 76 | 76 | |
| @@ -109,7 +109,7 @@ export const DatumSchema = z.object({ | ||
| 109 | 109 | "id": z.string(), |
| 110 | 110 | "images": ImagesSchema, |
| 111 | 111 | "import_datetime": z.string(), |
| 112 | - "is_indexable": z.number(), | |
| 112 | + "is_indexable": z.number().int(), | |
| 113 | 113 | "rating": RatingSchema, |
| 114 | 114 | "slug": z.string(), |
| 115 | 115 | "source": z.string(), |
Test case
1 generated file · +1 −1test/inputs/json/misc/e2915.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -110,7 +110,7 @@ export const ResultsSchema = z.object({ | ||
| 110 | 110 | export type Results = z.infer<typeof ResultsSchema>; |
| 111 | 111 | |
| 112 | 112 | export const QuerySchema = z.object({ |
| 113 | - "count": z.number(), | |
| 113 | + "count": z.number().int(), | |
| 114 | 114 | "created": z.coerce.date(), |
| 115 | 115 | "lang": z.string(), |
| 116 | 116 | "results": ResultsSchema, |
Test case
1 generated file · +5 −5test/inputs/json/misc/e8a0b.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -7,12 +7,12 @@ export const CountrySchema = z.enum([ | ||
| 7 | 7 | export type Country = z.infer<typeof CountrySchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelElementSchema = z.object({ |
| 10 | - "age": z.number(), | |
| 10 | + "age": z.number().int(), | |
| 11 | 11 | "country": CountrySchema, |
| 12 | - "females": z.number(), | |
| 13 | - "males": z.number(), | |
| 14 | - "total": z.number(), | |
| 15 | - "year": z.number(), | |
| 12 | + "females": z.number().int(), | |
| 13 | + "males": z.number().int(), | |
| 14 | + "total": z.number().int(), | |
| 15 | + "year": z.number().int(), | |
| 16 | 16 | }); |
| 17 | 17 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +20 −20test/inputs/json/misc/e8b04.json
Mtypescript-zoddefault / TopLevel.ts+20 −20
| @@ -159,7 +159,7 @@ export const SelectSchema = z.object({ | ||
| 159 | 159 | export type Select = z.infer<typeof SelectSchema>; |
| 160 | 160 | |
| 161 | 161 | export const TableColumnIdSchema = z.object({ |
| 162 | - "2819740": z.number(), | |
| 162 | + "2819740": z.number().int(), | |
| 163 | 163 | }); |
| 164 | 164 | export type TableColumnId = z.infer<typeof TableColumnIdSchema>; |
| 165 | 165 | |
| @@ -170,7 +170,7 @@ export const PurpleVisibleSchema = z.object({ | ||
| 170 | 170 | export type PurpleVisible = z.infer<typeof PurpleVisibleSchema>; |
| 171 | 171 | |
| 172 | 172 | export const FieldSchema = z.object({ |
| 173 | - "tableColumnId": z.number(), | |
| 173 | + "tableColumnId": z.number().int(), | |
| 174 | 174 | "type": FieldTypeSchema, |
| 175 | 175 | }); |
| 176 | 176 | export type Field = z.infer<typeof FieldSchema>; |
| @@ -194,7 +194,7 @@ export const OwnerSchema = z.object({ | ||
| 194 | 194 | "displayName": z.string(), |
| 195 | 195 | "flags": z.array(z.string()).optional(), |
| 196 | 196 | "id": z.string(), |
| 197 | - "lastNotificationSeenAt": z.number().optional(), | |
| 197 | + "lastNotificationSeenAt": z.number().int().optional(), | |
| 198 | 198 | "profileImageUrlLarge": z.string().optional(), |
| 199 | 199 | "profileImageUrlMedium": z.string().optional(), |
| 200 | 200 | "profileImageUrlSmall": z.string().optional(), |
| @@ -205,7 +205,7 @@ export const OwnerSchema = z.object({ | ||
| 205 | 205 | export type Owner = z.infer<typeof OwnerSchema>; |
| 206 | 206 | |
| 207 | 207 | export const RatingsSchema = z.object({ |
| 208 | - "rating": z.number(), | |
| 208 | + "rating": z.number().int(), | |
| 209 | 209 | }); |
| 210 | 210 | export type Ratings = z.infer<typeof RatingsSchema>; |
| 211 | 211 | |
| @@ -226,10 +226,10 @@ export type CustomFields = z.infer<typeof CustomFieldsSchema>; | ||
| 226 | 226 | export const ChildMetadataSchema = z.object({ |
| 227 | 227 | "customValues": z.array(z.string()).optional(), |
| 228 | 228 | "freeform": z.boolean().optional(), |
| 229 | - "includeAuto": z.number().optional(), | |
| 229 | + "includeAuto": z.number().int().optional(), | |
| 230 | 230 | "operator": MetadataOperatorSchema.optional(), |
| 231 | 231 | "tableColumnId": TableColumnIdSchema.optional(), |
| 232 | - "unifiedVersion": z.number().optional(), | |
| 232 | + "unifiedVersion": z.number().int().optional(), | |
| 233 | 233 | }); |
| 234 | 234 | export type ChildMetadata = z.infer<typeof ChildMetadataSchema>; |
| 235 | 235 | |
| @@ -311,45 +311,45 @@ export const TopLevelMetadataSchema = z.object({ | ||
| 311 | 311 | export type TopLevelMetadata = z.infer<typeof TopLevelMetadataSchema>; |
| 312 | 312 | |
| 313 | 313 | export const TopLevelElementSchema = z.object({ |
| 314 | - "averageRating": z.number(), | |
| 314 | + "averageRating": z.number().int(), | |
| 315 | 315 | "category": z.string().optional(), |
| 316 | - "createdAt": z.number(), | |
| 316 | + "createdAt": z.number().int(), | |
| 317 | 317 | "description": z.string().optional(), |
| 318 | 318 | "displayType": DisplayTypeSchema.optional(), |
| 319 | - "downloadCount": z.number(), | |
| 319 | + "downloadCount": z.number().int(), | |
| 320 | 320 | "flags": z.array(TopLevelFlagSchema).optional(), |
| 321 | 321 | "grants": z.array(GrantSchema), |
| 322 | 322 | "hideFromCatalog": z.boolean(), |
| 323 | 323 | "hideFromDataJson": z.boolean(), |
| 324 | 324 | "id": z.string(), |
| 325 | - "indexUpdatedAt": z.number().optional(), | |
| 325 | + "indexUpdatedAt": z.number().int().optional(), | |
| 326 | 326 | "locale": z.string(), |
| 327 | 327 | "metadata": TopLevelMetadataSchema, |
| 328 | 328 | "moderationStatus": z.boolean().optional(), |
| 329 | 329 | "modifyingViewUid": ModifyingViewUidSchema.optional(), |
| 330 | 330 | "name": z.string(), |
| 331 | 331 | "newBackend": z.boolean(), |
| 332 | - "numberOfComments": z.number(), | |
| 333 | - "oid": z.number(), | |
| 332 | + "numberOfComments": z.number().int(), | |
| 333 | + "oid": z.number().int(), | |
| 334 | 334 | "owner": OwnerSchema, |
| 335 | 335 | "provenance": ProvenanceSchema, |
| 336 | 336 | "publicationAppendEnabled": z.boolean(), |
| 337 | - "publicationDate": z.number().optional(), | |
| 338 | - "publicationGroup": z.number(), | |
| 337 | + "publicationDate": z.number().int().optional(), | |
| 338 | + "publicationGroup": z.number().int(), | |
| 339 | 339 | "publicationStage": PublicationStageSchema, |
| 340 | 340 | "ratings": RatingsSchema.optional(), |
| 341 | 341 | "resourceName": z.string().optional(), |
| 342 | 342 | "rights": z.array(RightSchema), |
| 343 | 343 | "rowClass": z.string().optional(), |
| 344 | - "rowIdentifierColumnId": z.number().optional(), | |
| 345 | - "rowsUpdatedAt": z.number().optional(), | |
| 344 | + "rowIdentifierColumnId": z.number().int().optional(), | |
| 345 | + "rowsUpdatedAt": z.number().int().optional(), | |
| 346 | 346 | "rowsUpdatedBy": RowsUpdatedBySchema.optional(), |
| 347 | 347 | "tableAuthor": TableAuthorSchema, |
| 348 | - "tableId": z.number(), | |
| 348 | + "tableId": z.number().int(), | |
| 349 | 349 | "tags": z.array(z.string()).optional(), |
| 350 | - "totalTimesRated": z.number(), | |
| 351 | - "viewCount": z.number(), | |
| 352 | - "viewLastModified": z.number(), | |
| 350 | + "totalTimesRated": z.number().int(), | |
| 351 | + "viewCount": z.number().int(), | |
| 352 | + "viewLastModified": z.number().int(), | |
| 353 | 353 | "viewType": ViewTypeSchema, |
| 354 | 354 | }); |
| 355 | 355 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/f3edf.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -7,12 +7,12 @@ export const CountrySchema = z.enum([ | ||
| 7 | 7 | export type Country = z.infer<typeof CountrySchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelElementSchema = z.object({ |
| 10 | - "age": z.number(), | |
| 10 | + "age": z.number().int(), | |
| 11 | 11 | "country": CountrySchema, |
| 12 | - "females": z.number(), | |
| 13 | - "males": z.number(), | |
| 14 | - "total": z.number(), | |
| 15 | - "year": z.number(), | |
| 12 | + "females": z.number().int(), | |
| 13 | + "males": z.number().int(), | |
| 14 | + "total": z.number().int(), | |
| 15 | + "year": z.number().int(), | |
| 16 | 16 | }); |
| 17 | 17 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/f466a.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -7,12 +7,12 @@ export const CountrySchema = z.enum([ | ||
| 7 | 7 | export type Country = z.infer<typeof CountrySchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelElementSchema = z.object({ |
| 10 | - "age": z.number(), | |
| 10 | + "age": z.number().int(), | |
| 11 | 11 | "country": CountrySchema, |
| 12 | - "females": z.number(), | |
| 13 | - "males": z.number(), | |
| 14 | - "total": z.number(), | |
| 15 | - "year": z.number(), | |
| 12 | + "females": z.number().int(), | |
| 13 | + "males": z.number().int(), | |
| 14 | + "total": z.number().int(), | |
| 15 | + "year": z.number().int(), | |
| 16 | 16 | }); |
| 17 | 17 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/misc/f6a65.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -73,14 +73,14 @@ export type User = z.infer<typeof UserSchema>; | ||
| 73 | 73 | export const MetaSchema = z.object({ |
| 74 | 74 | "msg": z.string(), |
| 75 | 75 | "response_id": z.string(), |
| 76 | - "status": z.number(), | |
| 76 | + "status": z.number().int(), | |
| 77 | 77 | }); |
| 78 | 78 | export type Meta = z.infer<typeof MetaSchema>; |
| 79 | 79 | |
| 80 | 80 | export const PaginationSchema = z.object({ |
| 81 | - "count": z.number(), | |
| 82 | - "offset": z.number(), | |
| 83 | - "total_count": z.number(), | |
| 81 | + "count": z.number().int(), | |
| 82 | + "offset": z.number().int(), | |
| 83 | + "total_count": z.number().int(), | |
| 84 | 84 | }); |
| 85 | 85 | export type Pagination = z.infer<typeof PaginationSchema>; |
| 86 | 86 | |
| @@ -119,7 +119,7 @@ export const DatumSchema = z.object({ | ||
| 119 | 119 | "id": z.string(), |
| 120 | 120 | "images": ImagesSchema, |
| 121 | 121 | "import_datetime": z.string(), |
| 122 | - "is_indexable": z.number(), | |
| 122 | + "is_indexable": z.number().int(), | |
| 123 | 123 | "rating": RatingSchema, |
| 124 | 124 | "slug": z.string(), |
| 125 | 125 | "source": z.string(), |
Test case
1 generated file · +21 −21test/inputs/json/misc/f74d5.json
Mtypescript-zoddefault / TopLevel.ts+21 −21
| @@ -9,7 +9,7 @@ export const TypeNameSchema = z.enum([ | ||
| 9 | 9 | export type TypeName = z.infer<typeof TypeNameSchema>; |
| 10 | 10 | |
| 11 | 11 | export const TopSchema = z.object({ |
| 12 | - "count": z.number(), | |
| 12 | + "count": z.number().int(), | |
| 13 | 13 | "item": z.string(), |
| 14 | 14 | }); |
| 15 | 15 | export type Top = z.infer<typeof TopSchema>; |
| @@ -45,8 +45,8 @@ export type Owner = z.infer<typeof OwnerSchema>; | ||
| 45 | 45 | export const CachedContentsSchema = z.object({ |
| 46 | 46 | "average": z.string().optional(), |
| 47 | 47 | "largest": z.string(), |
| 48 | - "non_null": z.number(), | |
| 49 | - "null": z.number(), | |
| 48 | + "non_null": z.number().int(), | |
| 49 | + "null": z.number().int(), | |
| 50 | 50 | "smallest": z.string(), |
| 51 | 51 | "sum": z.string().optional(), |
| 52 | 52 | "top": z.array(TopSchema), |
| @@ -64,12 +64,12 @@ export const ColumnSchema = z.object({ | ||
| 64 | 64 | "fieldName": z.string(), |
| 65 | 65 | "flags": z.array(z.string()).optional(), |
| 66 | 66 | "format": QuerySchema, |
| 67 | - "id": z.number(), | |
| 67 | + "id": z.number().int(), | |
| 68 | 68 | "name": z.string(), |
| 69 | - "position": z.number(), | |
| 69 | + "position": z.number().int(), | |
| 70 | 70 | "renderTypeName": TypeNameSchema, |
| 71 | - "tableColumnId": z.number().optional(), | |
| 72 | - "width": z.number().optional(), | |
| 71 | + "tableColumnId": z.number().int().optional(), | |
| 72 | + "width": z.number().int().optional(), | |
| 73 | 73 | }); |
| 74 | 74 | export type Column = z.infer<typeof ColumnSchema>; |
| 75 | 75 | |
| @@ -83,42 +83,42 @@ export const MetadataSchema = z.object({ | ||
| 83 | 83 | export type Metadata = z.infer<typeof MetadataSchema>; |
| 84 | 84 | |
| 85 | 85 | export const ViewSchema = z.object({ |
| 86 | - "averageRating": z.number(), | |
| 86 | + "averageRating": z.number().int(), | |
| 87 | 87 | "category": z.string(), |
| 88 | 88 | "columns": z.array(ColumnSchema), |
| 89 | - "createdAt": z.number(), | |
| 89 | + "createdAt": z.number().int(), | |
| 90 | 90 | "displayType": z.string(), |
| 91 | - "downloadCount": z.number(), | |
| 91 | + "downloadCount": z.number().int(), | |
| 92 | 92 | "flags": z.array(z.string()), |
| 93 | 93 | "grants": z.array(GrantSchema), |
| 94 | 94 | "hideFromCatalog": z.boolean(), |
| 95 | 95 | "hideFromDataJson": z.boolean(), |
| 96 | 96 | "id": z.string(), |
| 97 | - "indexUpdatedAt": z.number(), | |
| 97 | + "indexUpdatedAt": z.number().int(), | |
| 98 | 98 | "license": LicenseSchema, |
| 99 | 99 | "licenseId": z.string(), |
| 100 | 100 | "locale": z.string(), |
| 101 | 101 | "metadata": MetadataSchema, |
| 102 | 102 | "name": z.string(), |
| 103 | 103 | "newBackend": z.boolean(), |
| 104 | - "numberOfComments": z.number(), | |
| 105 | - "oid": z.number(), | |
| 104 | + "numberOfComments": z.number().int(), | |
| 105 | + "oid": z.number().int(), | |
| 106 | 106 | "owner": OwnerSchema, |
| 107 | 107 | "provenance": z.string(), |
| 108 | 108 | "publicationAppendEnabled": z.boolean(), |
| 109 | - "publicationDate": z.number(), | |
| 110 | - "publicationGroup": z.number(), | |
| 109 | + "publicationDate": z.number().int(), | |
| 110 | + "publicationGroup": z.number().int(), | |
| 111 | 111 | "publicationStage": z.string(), |
| 112 | 112 | "query": QuerySchema, |
| 113 | 113 | "rights": z.array(z.string()), |
| 114 | 114 | "rowClass": z.string(), |
| 115 | - "rowsUpdatedAt": z.number(), | |
| 115 | + "rowsUpdatedAt": z.number().int(), | |
| 116 | 116 | "rowsUpdatedBy": z.string(), |
| 117 | 117 | "tableAuthor": OwnerSchema, |
| 118 | - "tableId": z.number(), | |
| 119 | - "totalTimesRated": z.number(), | |
| 120 | - "viewCount": z.number(), | |
| 121 | - "viewLastModified": z.number(), | |
| 118 | + "tableId": z.number().int(), | |
| 119 | + "totalTimesRated": z.number().int(), | |
| 120 | + "viewCount": z.number().int(), | |
| 121 | + "viewLastModified": z.number().int(), | |
| 122 | 122 | "viewType": z.string(), |
| 123 | 123 | }); |
| 124 | 124 | export type View = z.infer<typeof ViewSchema>; |
| @@ -129,7 +129,7 @@ export const MetaSchema = z.object({ | ||
| 129 | 129 | export type Meta = z.infer<typeof MetaSchema>; |
| 130 | 130 | |
| 131 | 131 | export const TopLevelSchema = z.object({ |
| 132 | - "data": z.array(z.array(z.union([z.number(), z.string()]))), | |
| 132 | + "data": z.array(z.array(z.union([z.number().int(), z.string()]))), | |
| 133 | 133 | "meta": MetaSchema, |
| 134 | 134 | }); |
| 135 | 135 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +4 −4test/inputs/json/misc/f974d.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -2,10 +2,10 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "block_index": z.number(), | |
| 5 | + "block_index": z.number().int(), | |
| 6 | 6 | "hash": z.string(), |
| 7 | - "height": z.number(), | |
| 8 | - "time": z.number(), | |
| 9 | - "txIndexes": z.array(z.number()), | |
| 7 | + "height": z.number().int(), | |
| 8 | + "time": z.number().int(), | |
| 9 | + "txIndexes": z.array(z.number().int()), | |
| 10 | 10 | }); |
| 11 | 11 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +2 −2test/inputs/json/misc/faff5.json
Mtypescript-zoddefault / TopLevel.ts+2 −2
| @@ -2,8 +2,8 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const ResponseSchema = z.object({ |
| 5 | - "player_count": z.number(), | |
| 6 | - "result": z.number(), | |
| 5 | + "player_count": z.number().int(), | |
| 6 | + "result": z.number().int(), | |
| 7 | 7 | }); |
| 8 | 8 | export type Response = z.infer<typeof ResponseSchema>; |
Test case
1 generated file · +24 −24test/inputs/json/misc/fcca3.json
Mtypescript-zoddefault / TopLevel.ts+24 −24
| @@ -9,7 +9,7 @@ export const TypeNameSchema = z.enum([ | ||
| 9 | 9 | export type TypeName = z.infer<typeof TypeNameSchema>; |
| 10 | 10 | |
| 11 | 11 | export const TopSchema = z.object({ |
| 12 | - "count": z.number(), | |
| 12 | + "count": z.number().int(), | |
| 13 | 13 | "item": z.string(), |
| 14 | 14 | }); |
| 15 | 15 | export type Top = z.infer<typeof TopSchema>; |
| @@ -65,13 +65,13 @@ export const DisclaimersSchema = z.object({ | ||
| 65 | 65 | export type Disclaimers = z.infer<typeof DisclaimersSchema>; |
| 66 | 66 | |
| 67 | 67 | export const TableColumnIdSchema = z.object({ |
| 68 | - "703610": z.number(), | |
| 68 | + "703610": z.number().int(), | |
| 69 | 69 | }); |
| 70 | 70 | export type TableColumnId = z.infer<typeof TableColumnIdSchema>; |
| 71 | 71 | |
| 72 | 72 | export const FilterConditionMetadataSchema = z.object({ |
| 73 | 73 | "advanced": z.boolean(), |
| 74 | - "unifiedVersion": z.number(), | |
| 74 | + "unifiedVersion": z.number().int(), | |
| 75 | 75 | }); |
| 76 | 76 | export type FilterConditionMetadata = z.infer<typeof FilterConditionMetadataSchema>; |
| 77 | 77 | |
| @@ -99,7 +99,7 @@ export const OwnerSchema = z.object({ | ||
| 99 | 99 | export type Owner = z.infer<typeof OwnerSchema>; |
| 100 | 100 | |
| 101 | 101 | export const ExpressionSchema = z.object({ |
| 102 | - "columnId": z.number(), | |
| 102 | + "columnId": z.number().int(), | |
| 103 | 103 | "type": z.string(), |
| 104 | 104 | }); |
| 105 | 105 | export type Expression = z.infer<typeof ExpressionSchema>; |
| @@ -107,8 +107,8 @@ export type Expression = z.infer<typeof ExpressionSchema>; | ||
| 107 | 107 | export const CachedContentsSchema = z.object({ |
| 108 | 108 | "average": z.string().optional(), |
| 109 | 109 | "largest": z.string(), |
| 110 | - "non_null": z.number(), | |
| 111 | - "null": z.number(), | |
| 110 | + "non_null": z.number().int(), | |
| 111 | + "null": z.number().int(), | |
| 112 | 112 | "smallest": z.string(), |
| 113 | 113 | "sum": z.string().optional(), |
| 114 | 114 | "top": z.array(TopSchema), |
| @@ -153,12 +153,12 @@ export const ColumnSchema = z.object({ | ||
| 153 | 153 | "fieldName": z.string(), |
| 154 | 154 | "flags": z.array(z.string()).optional(), |
| 155 | 155 | "format": FormatSchema, |
| 156 | - "id": z.number(), | |
| 156 | + "id": z.number().int(), | |
| 157 | 157 | "name": z.string(), |
| 158 | - "position": z.number(), | |
| 158 | + "position": z.number().int(), | |
| 159 | 159 | "renderTypeName": TypeNameSchema, |
| 160 | - "tableColumnId": z.number().optional(), | |
| 161 | - "width": z.number().optional(), | |
| 160 | + "tableColumnId": z.number().int().optional(), | |
| 161 | + "width": z.number().int().optional(), | |
| 162 | 162 | }); |
| 163 | 163 | export type Column = z.infer<typeof ColumnSchema>; |
| 164 | 164 | |
| @@ -196,41 +196,41 @@ export type ViewMetadata = z.infer<typeof ViewMetadataSchema>; | ||
| 196 | 196 | |
| 197 | 197 | export const ViewSchema = z.object({ |
| 198 | 198 | "attribution": z.string(), |
| 199 | - "averageRating": z.number(), | |
| 199 | + "averageRating": z.number().int(), | |
| 200 | 200 | "category": z.string(), |
| 201 | 201 | "columns": z.array(ColumnSchema), |
| 202 | - "createdAt": z.number(), | |
| 202 | + "createdAt": z.number().int(), | |
| 203 | 203 | "description": z.string(), |
| 204 | 204 | "displayType": z.string(), |
| 205 | - "downloadCount": z.number(), | |
| 205 | + "downloadCount": z.number().int(), | |
| 206 | 206 | "flags": z.array(z.string()), |
| 207 | 207 | "grants": z.array(GrantSchema), |
| 208 | 208 | "hideFromCatalog": z.boolean(), |
| 209 | 209 | "hideFromDataJson": z.boolean(), |
| 210 | 210 | "id": z.string(), |
| 211 | - "indexUpdatedAt": z.number(), | |
| 211 | + "indexUpdatedAt": z.number().int(), | |
| 212 | 212 | "locale": z.string(), |
| 213 | 213 | "metadata": ViewMetadataSchema, |
| 214 | 214 | "name": z.string(), |
| 215 | 215 | "newBackend": z.boolean(), |
| 216 | - "numberOfComments": z.number(), | |
| 217 | - "oid": z.number(), | |
| 216 | + "numberOfComments": z.number().int(), | |
| 217 | + "oid": z.number().int(), | |
| 218 | 218 | "owner": OwnerSchema, |
| 219 | 219 | "provenance": z.string(), |
| 220 | 220 | "publicationAppendEnabled": z.boolean(), |
| 221 | - "publicationDate": z.number(), | |
| 222 | - "publicationGroup": z.number(), | |
| 221 | + "publicationDate": z.number().int(), | |
| 222 | + "publicationGroup": z.number().int(), | |
| 223 | 223 | "publicationStage": z.string(), |
| 224 | 224 | "query": QuerySchema, |
| 225 | 225 | "rights": z.array(z.string()), |
| 226 | - "rowsUpdatedAt": z.number(), | |
| 226 | + "rowsUpdatedAt": z.number().int(), | |
| 227 | 227 | "rowsUpdatedBy": z.string(), |
| 228 | 228 | "tableAuthor": OwnerSchema, |
| 229 | - "tableId": z.number(), | |
| 229 | + "tableId": z.number().int(), | |
| 230 | 230 | "tags": z.array(z.string()), |
| 231 | - "totalTimesRated": z.number(), | |
| 232 | - "viewCount": z.number(), | |
| 233 | - "viewLastModified": z.number(), | |
| 231 | + "totalTimesRated": z.number().int(), | |
| 232 | + "viewCount": z.number().int(), | |
| 233 | + "viewLastModified": z.number().int(), | |
| 234 | 234 | "viewType": z.string(), |
| 235 | 235 | }); |
| 236 | 236 | export type View = z.infer<typeof ViewSchema>; |
| @@ -241,7 +241,7 @@ export const MetaSchema = z.object({ | ||
| 241 | 241 | export type Meta = z.infer<typeof MetaSchema>; |
| 242 | 242 | |
| 243 | 243 | export const TopLevelSchema = z.object({ |
| 244 | - "data": z.array(z.array(z.union([z.null(), z.number(), z.string()]))), | |
| 244 | + "data": z.array(z.array(z.union([z.null(), z.number().int(), z.string()]))), | |
| 245 | 245 | "meta": MetaSchema, |
| 246 | 246 | }); |
| 247 | 247 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/misc/fd329.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -9,7 +9,7 @@ export type Datum = z.infer<typeof DatumSchema>; | ||
| 9 | 9 | |
| 10 | 10 | export const DescriptionSchema = z.object({ |
| 11 | 11 | "base_period": z.string(), |
| 12 | - "missing": z.number(), | |
| 12 | + "missing": z.number().int(), | |
| 13 | 13 | "title": z.string(), |
| 14 | 14 | "units": z.string(), |
| 15 | 15 | }); |
Test case
1 generated file · +5 −5test/inputs/json/priority/bug790.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -14,12 +14,12 @@ export type TopLevel = { | ||
| 14 | 14 | export const TopLevelSchema: z.ZodType<TopLevel> = z.lazy(() => |
| 15 | 15 | z.object({ |
| 16 | 16 | "children_data": z.array(TopLevelSchema), |
| 17 | - "id": z.number(), | |
| 17 | + "id": z.number().int(), | |
| 18 | 18 | "is_active": z.boolean(), |
| 19 | - "level": z.number(), | |
| 19 | + "level": z.number().int(), | |
| 20 | 20 | "name": z.string(), |
| 21 | - "parent_id": z.number(), | |
| 22 | - "position": z.number(), | |
| 23 | - "product_count": z.number(), | |
| 21 | + "parent_id": z.number().int(), | |
| 22 | + "position": z.number().int(), | |
| 23 | + "product_count": z.number().int(), | |
| 24 | 24 | }) |
| 25 | 25 | ); |
Test case
1 generated file · +35 −35test/inputs/json/priority/bug863.json
Mtypescript-zoddefault / TopLevel.ts+35 −35
| @@ -47,62 +47,62 @@ export const SexSchema = z.enum([ | ||
| 47 | 47 | export type Sex = z.infer<typeof SexSchema>; |
| 48 | 48 | |
| 49 | 49 | export const PurpleTopLevelSchema = z.object({ |
| 50 | - "ALIENLEVEL": z.number(), | |
| 50 | + "ALIENLEVEL": z.number().int(), | |
| 51 | 51 | "BREED": BreedSchema, |
| 52 | - "CHAR_DIMENSION": z.number(), | |
| 53 | - "CHAR_INSTANCE": z.number(), | |
| 52 | + "CHAR_DIMENSION": z.number().int(), | |
| 53 | + "CHAR_INSTANCE": z.number().int(), | |
| 54 | 54 | "DEFENDER_RANK_TITLE": z.string(), |
| 55 | 55 | "FIRSTNAME": FirstnameSchema, |
| 56 | - "HEADID": z.number(), | |
| 56 | + "HEADID": z.number().int(), | |
| 57 | 57 | "LASTNAME": LastnameSchema, |
| 58 | - "LEVELX": z.number(), | |
| 58 | + "LEVELX": z.number().int(), | |
| 59 | 59 | "NAME": z.string(), |
| 60 | 60 | "PROF": z.string(), |
| 61 | 61 | "PROF_TITLE": z.string(), |
| 62 | - "PVPRATING": z.number(), | |
| 62 | + "PVPRATING": z.number().int(), | |
| 63 | 63 | "PVPTITLE": PvptitleSchema, |
| 64 | - "RANK": z.number(), | |
| 64 | + "RANK": z.number().int(), | |
| 65 | 65 | "RANK_TITLE": RankTitleSchema, |
| 66 | 66 | "SEX": SexSchema, |
| 67 | 67 | }); |
| 68 | 68 | export type PurpleTopLevel = z.infer<typeof PurpleTopLevelSchema>; |
| 69 | 69 | |
| 70 | 70 | export const FluffyTopLevelSchema = z.object({ |
| 71 | - "ADVENTURERCOUNT": z.number(), | |
| 72 | - "AGENTCOUNT": z.number(), | |
| 73 | - "ATROXCOUNT": z.number(), | |
| 71 | + "ADVENTURERCOUNT": z.number().int(), | |
| 72 | + "AGENTCOUNT": z.number().int(), | |
| 73 | + "ATROXCOUNT": z.number().int(), | |
| 74 | 74 | "AVGLVL": z.number(), |
| 75 | - "BTCOUNT": z.number(), | |
| 75 | + "BTCOUNT": z.number().int(), | |
| 76 | 76 | "DESCRIPTION": z.string(), |
| 77 | - "DOCTORCOUNT": z.number(), | |
| 78 | - "ENFCOUNT": z.number(), | |
| 79 | - "ENGINEEERCOUNT": z.number(), | |
| 80 | - "FEMALECOUNT": z.number(), | |
| 81 | - "FIXERCOUNT": z.number(), | |
| 77 | + "DOCTORCOUNT": z.number().int(), | |
| 78 | + "ENFCOUNT": z.number().int(), | |
| 79 | + "ENGINEEERCOUNT": z.number().int(), | |
| 80 | + "FEMALECOUNT": z.number().int(), | |
| 81 | + "FIXERCOUNT": z.number().int(), | |
| 82 | 82 | "GOVERNINGNAME": z.string(), |
| 83 | 83 | "HISTORY": z.string(), |
| 84 | - "KEEPERCOUNT": z.number(), | |
| 85 | - "MACOUNT": z.number(), | |
| 86 | - "MALECOUNT": z.number(), | |
| 87 | - "MAXLVL": z.number(), | |
| 88 | - "METACOUNT": z.number(), | |
| 89 | - "MINLVL": z.number(), | |
| 90 | - "MONSTERCOUNT": z.number(), | |
| 84 | + "KEEPERCOUNT": z.number().int(), | |
| 85 | + "MACOUNT": z.number().int(), | |
| 86 | + "MALECOUNT": z.number().int(), | |
| 87 | + "MAXLVL": z.number().int(), | |
| 88 | + "METACOUNT": z.number().int(), | |
| 89 | + "MINLVL": z.number().int(), | |
| 90 | + "MONSTERCOUNT": z.number().int(), | |
| 91 | 91 | "NAME": z.string(), |
| 92 | - "NANOCOUNT": z.number(), | |
| 93 | - "NANORACECOUNT": z.number(), | |
| 94 | - "NEUTERCOUNT": z.number(), | |
| 95 | - "NUMMEMBERS": z.number(), | |
| 92 | + "NANOCOUNT": z.number().int(), | |
| 93 | + "NANORACECOUNT": z.number().int(), | |
| 94 | + "NEUTERCOUNT": z.number().int(), | |
| 95 | + "NUMMEMBERS": z.number().int(), | |
| 96 | 96 | "OBJECTIVE": z.string(), |
| 97 | - "OPIFEXCOUNT": z.number(), | |
| 98 | - "ORG_DIMENSION": z.number(), | |
| 99 | - "ORG_INSTANCE": z.number(), | |
| 100 | - "SHADECOUNT": z.number(), | |
| 101 | - "SIDE": z.number(), | |
| 97 | + "OPIFEXCOUNT": z.number().int(), | |
| 98 | + "ORG_DIMENSION": z.number().int(), | |
| 99 | + "ORG_INSTANCE": z.number().int(), | |
| 100 | + "SHADECOUNT": z.number().int(), | |
| 101 | + "SIDE": z.number().int(), | |
| 102 | 102 | "SIDE_NAME": z.string(), |
| 103 | - "SOLIDERCOUNT": z.number(), | |
| 104 | - "SOLITUSCOUNT": z.number(), | |
| 105 | - "TRADERCOUNT": z.number(), | |
| 103 | + "SOLIDERCOUNT": z.number().int(), | |
| 104 | + "SOLITUSCOUNT": z.number().int(), | |
| 105 | + "TRADERCOUNT": z.number().int(), | |
| 106 | 106 | }); |
| 107 | 107 | export type FluffyTopLevel = z.infer<typeof FluffyTopLevelSchema>; |
Test case
1 generated file · +5 −5test/inputs/json/priority/coin-pairs.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -2,11 +2,11 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const PairSchema = z.object({ |
| 5 | - "decimal_places": z.number(), | |
| 5 | + "decimal_places": z.number().int(), | |
| 6 | 6 | "fee": z.number(), |
| 7 | - "hidden": z.number(), | |
| 8 | - "max_amount": z.number(), | |
| 9 | - "max_price": z.number(), | |
| 7 | + "hidden": z.number().int(), | |
| 8 | + "max_amount": z.number().int(), | |
| 9 | + "max_price": z.number().int(), | |
| 10 | 10 | "min_amount": z.number(), |
| 11 | 11 | "min_price": z.number(), |
| 12 | 12 | "min_total": z.number(), |
| @@ -15,6 +15,6 @@ export type Pair = z.infer<typeof PairSchema>; | ||
| 15 | 15 | |
| 16 | 16 | export const TopLevelSchema = z.object({ |
| 17 | 17 | "pairs": z.record(z.string(), PairSchema), |
| 18 | - "server_time": z.number(), | |
| 18 | + "server_time": z.number().int(), | |
| 19 | 19 | }); |
| 20 | 20 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +29 −29test/inputs/json/priority/combinations1.json
Mtypescript-zoddefault / TopLevel.ts+29 −29
| @@ -32,7 +32,7 @@ export const ChemotherapeuticClassSchema = z.object({ | ||
| 32 | 32 | "catharticalness": z.number().optional(), |
| 33 | 33 | "caulis": z.null().optional(), |
| 34 | 34 | "chalcus": z.null().optional(), |
| 35 | - "Chirotherium": z.number().optional(), | |
| 35 | + "Chirotherium": z.number().int().optional(), | |
| 36 | 36 | "disdiapason": z.string().optional(), |
| 37 | 37 | "enteradenological": z.null().optional(), |
| 38 | 38 | "homocerc": z.boolean().optional(), |
| @@ -56,7 +56,7 @@ export type ChemotherapeuticClass = z.infer<typeof ChemotherapeuticClassSchema>; | ||
| 56 | 56 | |
| 57 | 57 | export const CimeliaClassSchema = z.object({ |
| 58 | 58 | "catharticalness": z.number(), |
| 59 | - "Chirotherium": z.number(), | |
| 59 | + "Chirotherium": z.number().int(), | |
| 60 | 60 | "disdiapason": z.string(), |
| 61 | 61 | "homocerc": z.boolean(), |
| 62 | 62 | "nonbookish": z.null(), |
| @@ -67,7 +67,7 @@ export const CoadjustClassSchema = z.object({ | ||
| 67 | 67 | "amidosulphonal": z.null().optional(), |
| 68 | 68 | "Benny": z.null().optional(), |
| 69 | 69 | "catharticalness": z.number().optional(), |
| 70 | - "Chirotherium": z.number().optional(), | |
| 70 | + "Chirotherium": z.number().int().optional(), | |
| 71 | 71 | "disdiapason": z.string().optional(), |
| 72 | 72 | "ensnare": z.null().optional(), |
| 73 | 73 | "homocerc": z.boolean().optional(), |
| @@ -266,7 +266,7 @@ export const HemocoeleClassSchema = z.object({ | ||
| 266 | 266 | "autobiographic": z.null().optional(), |
| 267 | 267 | "berat": z.null().optional(), |
| 268 | 268 | "catharticalness": z.number().optional(), |
| 269 | - "Chirotherium": z.number().optional(), | |
| 269 | + "Chirotherium": z.number().int().optional(), | |
| 270 | 270 | "disdiapason": z.string().optional(), |
| 271 | 271 | "disproportionably": z.null().optional(), |
| 272 | 272 | "erythrite": z.null().optional(), |
| @@ -293,7 +293,7 @@ export const InteracinarSchema = z.object({ | ||
| 293 | 293 | "assapan": z.number(), |
| 294 | 294 | "benefactorship": z.boolean(), |
| 295 | 295 | "triseriatim": z.string(), |
| 296 | - "tubbing": z.number(), | |
| 296 | + "tubbing": z.number().int(), | |
| 297 | 297 | "untrimmed": z.null(), |
| 298 | 298 | }); |
| 299 | 299 | export type Interacinar = z.infer<typeof InteracinarSchema>; |
| @@ -301,46 +301,46 @@ export type Interacinar = z.infer<typeof InteracinarSchema>; | ||
| 301 | 301 | export const TopLevelSchema = z.object({ |
| 302 | 302 | "centrodesmose": z.string(), |
| 303 | 303 | "cerograph": z.array(z.union([z.null(), CerographClassSchema, z.string()])), |
| 304 | - "chemotherapeutics": z.array(z.union([ChemotherapeuticClassSchema, z.number()])), | |
| 305 | - "cimelia": z.array(z.union([z.null(), z.array(z.number()), CimeliaClassSchema])), | |
| 306 | - "citrated": z.number(), | |
| 304 | + "chemotherapeutics": z.array(z.union([ChemotherapeuticClassSchema, z.number().int()])), | |
| 305 | + "cimelia": z.array(z.union([z.null(), z.array(z.number().int()), CimeliaClassSchema])), | |
| 306 | + "citrated": z.number().int(), | |
| 307 | 307 | "clinodome": z.array(z.union([z.number(), z.string()])), |
| 308 | 308 | "coadjust": z.array(z.union([CoadjustClassSchema, z.number()])), |
| 309 | - "consilience": z.array(z.union([z.number(), z.record(z.string(), z.number())])), | |
| 310 | - "constructor": z.array(z.union([z.boolean(), z.record(z.string(), z.union([z.null(), z.number()]))])), | |
| 311 | - "continuative": z.array(z.union([z.record(z.string(), z.number()), z.string()])), | |
| 312 | - "credulity": z.array(z.union([CredulityClassSchema, z.number(), z.string()])), | |
| 313 | - "creviced": z.array(z.union([z.boolean(), z.record(z.string(), z.number()), z.string()])), | |
| 314 | - "cubiculum": z.array(z.array(z.union([z.null(), z.number()]))), | |
| 309 | + "consilience": z.array(z.union([z.number(), z.record(z.string(), z.number().int())])), | |
| 310 | + "constructor": z.array(z.union([z.boolean(), z.record(z.string(), z.union([z.null(), z.number().int()]))])), | |
| 311 | + "continuative": z.array(z.union([z.record(z.string(), z.number().int()), z.string()])), | |
| 312 | + "credulity": z.array(z.union([CredulityClassSchema, z.number().int(), z.string()])), | |
| 313 | + "creviced": z.array(z.union([z.boolean(), z.record(z.string(), z.number().int()), z.string()])), | |
| 314 | + "cubiculum": z.array(z.array(z.union([z.null(), z.number().int()]))), | |
| 315 | 315 | "deruralize": z.array(z.union([z.array(z.null()), z.boolean(), DeruralizeClassSchema])), |
| 316 | - "diaereses": z.array(z.union([z.array(z.number()), z.boolean(), DiaereseClassSchema])), | |
| 316 | + "diaereses": z.array(z.union([z.array(z.number().int()), z.boolean(), DiaereseClassSchema])), | |
| 317 | 317 | "dissolution": z.array(z.union([z.null(), z.array(z.null())])), |
| 318 | 318 | "downstroke": z.array(z.union([z.array(z.null()), z.boolean(), z.string()])), |
| 319 | 319 | "electrotautomerism": z.array(z.union([z.null(), z.number()])), |
| 320 | - "eleutheromania": z.array(z.union([z.number(), z.record(z.string(), z.number()), z.string()])), | |
| 320 | + "eleutheromania": z.array(z.union([z.number(), z.record(z.string(), z.number().int()), z.string()])), | |
| 321 | 321 | "encrust": EncrustSchema, |
| 322 | - "entomoid": z.array(z.union([CimeliaClassSchema, z.number()])), | |
| 323 | - "epipaleolithic": z.array(z.union([z.array(z.number()), z.number()])), | |
| 322 | + "entomoid": z.array(z.union([CimeliaClassSchema, z.number().int()])), | |
| 323 | + "epipaleolithic": z.array(z.union([z.array(z.number().int()), z.number()])), | |
| 324 | 324 | "expropriable": z.array(z.union([z.array(z.null()), CimeliaClassSchema, z.number()])), |
| 325 | 325 | "faggingly": z.array(z.union([FagginglyClassSchema, z.number()])), |
| 326 | 326 | "fenks": z.array(z.union([FenkClassSchema, z.string()])), |
| 327 | 327 | "flagmaking": z.array(z.union([z.boolean(), FlagmakingClassSchema, z.number()])), |
| 328 | - "fluorometer": z.array(z.union([z.null(), z.number(), z.string()])), | |
| 329 | - "fulsome": z.array(z.union([z.null(), z.number()])), | |
| 330 | - "fuzzy": z.array(z.union([z.number(), z.record(z.string(), z.union([z.null(), z.number()]))])), | |
| 331 | - "gardenwards": z.array(z.union([z.array(z.number()), z.boolean(), z.string()])), | |
| 332 | - "generalissimo": z.array(z.union([z.null(), z.boolean(), z.record(z.string(), z.number())])), | |
| 333 | - "habeas": z.array(z.union([z.null(), z.record(z.string(), z.number())])), | |
| 328 | + "fluorometer": z.array(z.union([z.null(), z.number().int(), z.string()])), | |
| 329 | + "fulsome": z.array(z.union([z.null(), z.number().int()])), | |
| 330 | + "fuzzy": z.array(z.union([z.number().int(), z.record(z.string(), z.union([z.null(), z.number().int()]))])), | |
| 331 | + "gardenwards": z.array(z.union([z.array(z.number().int()), z.boolean(), z.string()])), | |
| 332 | + "generalissimo": z.array(z.union([z.null(), z.boolean(), z.record(z.string(), z.number().int())])), | |
| 333 | + "habeas": z.array(z.union([z.null(), z.record(z.string(), z.number().int())])), | |
| 334 | 334 | "hemicrystalline": z.array(z.union([CimeliaClassSchema, z.string()])), |
| 335 | - "hemocoele": z.array(z.union([z.array(z.number()), HemocoeleClassSchema])), | |
| 335 | + "hemocoele": z.array(z.union([z.array(z.number().int()), HemocoeleClassSchema])), | |
| 336 | 336 | "hoister": z.array(z.union([z.null(), CimeliaClassSchema, z.string()])), |
| 337 | 337 | "hyperpiesis": z.array(z.union([z.null(), z.array(z.null()), CimeliaClassSchema])), |
| 338 | 338 | "hyppish": z.array(z.union([z.null(), z.boolean(), z.string()])), |
| 339 | - "idealizer": z.array(z.union([z.array(z.null()), CimeliaClassSchema, z.number()])), | |
| 340 | - "incrustator": z.array(z.union([z.array(z.number()), z.number(), z.string()])), | |
| 339 | + "idealizer": z.array(z.union([z.array(z.null()), CimeliaClassSchema, z.number().int()])), | |
| 340 | + "incrustator": z.array(z.union([z.array(z.number().int()), z.number().int(), z.string()])), | |
| 341 | 341 | "intentiveness": z.array(z.union([CimeliaClassSchema, z.number(), z.string()])), |
| 342 | 342 | "interacinar": InteracinarSchema, |
| 343 | - "intercorrelation": z.array(z.union([z.null(), z.array(z.number())])), | |
| 344 | - "jacutinga": z.array(z.union([z.array(z.number()), z.record(z.string(), z.union([z.null(), z.number()]))])), | |
| 343 | + "intercorrelation": z.array(z.union([z.null(), z.array(z.number().int())])), | |
| 344 | + "jacutinga": z.array(z.union([z.array(z.number().int()), z.record(z.string(), z.union([z.null(), z.number().int()]))])), | |
| 345 | 345 | }); |
| 346 | 346 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +93 −93test/inputs/json/priority/combinations2.json
Mtypescript-zoddefault / TopLevel.ts+93 −93
| @@ -27,7 +27,7 @@ export type AlleviateClass = z.infer<typeof AlleviateClassSchema>; | ||
| 27 | 27 | |
| 28 | 28 | export const RebeccaSchema = z.object({ |
| 29 | 29 | "catharticalness": z.number(), |
| 30 | - "Chirotherium": z.number(), | |
| 30 | + "Chirotherium": z.number().int(), | |
| 31 | 31 | "disdiapason": z.string(), |
| 32 | 32 | "homocerc": z.boolean(), |
| 33 | 33 | "nonbookish": z.null(), |
| @@ -35,31 +35,31 @@ export const RebeccaSchema = z.object({ | ||
| 35 | 35 | export type Rebecca = z.infer<typeof RebeccaSchema>; |
| 36 | 36 | |
| 37 | 37 | export const AmphithyronSchema = z.object({ |
| 38 | - "akroasis": z.number().optional(), | |
| 39 | - "antiphonical": z.number().optional(), | |
| 40 | - "basebred": z.number().optional(), | |
| 38 | + "akroasis": z.number().int().optional(), | |
| 39 | + "antiphonical": z.number().int().optional(), | |
| 40 | + "basebred": z.number().int().optional(), | |
| 41 | 41 | "catharticalness": z.number().optional(), |
| 42 | - "Chirotherium": z.number().optional(), | |
| 43 | - "conductometric": z.number().optional(), | |
| 42 | + "Chirotherium": z.number().int().optional(), | |
| 43 | + "conductometric": z.number().int().optional(), | |
| 44 | 44 | "disdiapason": z.string().optional(), |
| 45 | - "ensilation": z.number().optional(), | |
| 46 | - "eyebolt": z.number().optional(), | |
| 47 | - "fistulated": z.number().optional(), | |
| 48 | - "heteropod": z.number().optional(), | |
| 45 | + "ensilation": z.number().int().optional(), | |
| 46 | + "eyebolt": z.number().int().optional(), | |
| 47 | + "fistulated": z.number().int().optional(), | |
| 48 | + "heteropod": z.number().int().optional(), | |
| 49 | 49 | "homocerc": z.boolean().optional(), |
| 50 | - "Juniperus": z.number().optional(), | |
| 51 | - "labyrinthically": z.number().optional(), | |
| 52 | - "martyrization": z.number().optional(), | |
| 53 | - "mispolicy": z.number().optional(), | |
| 54 | - "multipara": z.number().optional(), | |
| 55 | - "Nazirite": z.number().optional(), | |
| 50 | + "Juniperus": z.number().int().optional(), | |
| 51 | + "labyrinthically": z.number().int().optional(), | |
| 52 | + "martyrization": z.number().int().optional(), | |
| 53 | + "mispolicy": z.number().int().optional(), | |
| 54 | + "multipara": z.number().int().optional(), | |
| 55 | + "Nazirite": z.number().int().optional(), | |
| 56 | 56 | "nonbookish": z.null().optional(), |
| 57 | - "possessorial": z.number().optional(), | |
| 58 | - "shamed": z.number().optional(), | |
| 59 | - "shelfworn": z.number().optional(), | |
| 60 | - "stagnum": z.number().optional(), | |
| 61 | - "Those": z.number().optional(), | |
| 62 | - "undecimal": z.number().optional(), | |
| 57 | + "possessorial": z.number().int().optional(), | |
| 58 | + "shamed": z.number().int().optional(), | |
| 59 | + "shelfworn": z.number().int().optional(), | |
| 60 | + "stagnum": z.number().int().optional(), | |
| 61 | + "Those": z.number().int().optional(), | |
| 62 | + "undecimal": z.number().int().optional(), | |
| 63 | 63 | }); |
| 64 | 64 | export type Amphithyron = z.infer<typeof AmphithyronSchema>; |
| 65 | 65 | |
| @@ -136,31 +136,31 @@ export const ChytridiaceaeClassSchema = z.object({ | ||
| 136 | 136 | export type ChytridiaceaeClass = z.infer<typeof ChytridiaceaeClassSchema>; |
| 137 | 137 | |
| 138 | 138 | export const DiscordiaClassSchema = z.object({ |
| 139 | - "Altaic": z.number().optional(), | |
| 140 | - "amoristic": z.number().optional(), | |
| 141 | - "blennophthalmia": z.number().optional(), | |
| 139 | + "Altaic": z.number().int().optional(), | |
| 140 | + "amoristic": z.number().int().optional(), | |
| 141 | + "blennophthalmia": z.number().int().optional(), | |
| 142 | 142 | "catharticalness": z.number().optional(), |
| 143 | - "Chirotherium": z.number().optional(), | |
| 144 | - "disciplinability": z.number().optional(), | |
| 143 | + "Chirotherium": z.number().int().optional(), | |
| 144 | + "disciplinability": z.number().int().optional(), | |
| 145 | 145 | "disdiapason": z.string().optional(), |
| 146 | - "goofer": z.number().optional(), | |
| 146 | + "goofer": z.number().int().optional(), | |
| 147 | 147 | "homocerc": z.boolean().optional(), |
| 148 | - "laryngograph": z.number().optional(), | |
| 149 | - "leucitis": z.number().optional(), | |
| 150 | - "lymphocyst": z.number().optional(), | |
| 151 | - "microcosmology": z.number().optional(), | |
| 152 | - "nauseation": z.number().optional(), | |
| 148 | + "laryngograph": z.number().int().optional(), | |
| 149 | + "leucitis": z.number().int().optional(), | |
| 150 | + "lymphocyst": z.number().int().optional(), | |
| 151 | + "microcosmology": z.number().int().optional(), | |
| 152 | + "nauseation": z.number().int().optional(), | |
| 153 | 153 | "nonbookish": z.null().optional(), |
| 154 | - "Patarin": z.number().optional(), | |
| 155 | - "preliberal": z.number().optional(), | |
| 156 | - "prettifier": z.number().optional(), | |
| 157 | - "rangework": z.number().optional(), | |
| 158 | - "redient": z.number().optional(), | |
| 159 | - "subfusiform": z.number().optional(), | |
| 160 | - "suicidical": z.number().optional(), | |
| 161 | - "swow": z.number().optional(), | |
| 162 | - "wastrel": z.number().optional(), | |
| 163 | - "wingle": z.number().optional(), | |
| 154 | + "Patarin": z.number().int().optional(), | |
| 155 | + "preliberal": z.number().int().optional(), | |
| 156 | + "prettifier": z.number().int().optional(), | |
| 157 | + "rangework": z.number().int().optional(), | |
| 158 | + "redient": z.number().int().optional(), | |
| 159 | + "subfusiform": z.number().int().optional(), | |
| 160 | + "suicidical": z.number().int().optional(), | |
| 161 | + "swow": z.number().int().optional(), | |
| 162 | + "wastrel": z.number().int().optional(), | |
| 163 | + "wingle": z.number().int().optional(), | |
| 164 | 164 | }); |
| 165 | 165 | export type DiscordiaClass = z.infer<typeof DiscordiaClassSchema>; |
| 166 | 166 | |
| @@ -189,31 +189,31 @@ export const GryphosaurusClassSchema = z.object({ | ||
| 189 | 189 | export type GryphosaurusClass = z.infer<typeof GryphosaurusClassSchema>; |
| 190 | 190 | |
| 191 | 191 | export const LaviniaClassSchema = z.object({ |
| 192 | - "agitable": z.number().optional(), | |
| 193 | - "asininity": z.number().optional(), | |
| 194 | - "benefiter": z.number().optional(), | |
| 195 | - "bronzelike": z.number().optional(), | |
| 192 | + "agitable": z.number().int().optional(), | |
| 193 | + "asininity": z.number().int().optional(), | |
| 194 | + "benefiter": z.number().int().optional(), | |
| 195 | + "bronzelike": z.number().int().optional(), | |
| 196 | 196 | "catharticalness": z.number().optional(), |
| 197 | - "Chirotherium": z.number().optional(), | |
| 198 | - "cholesteatomatous": z.number().optional(), | |
| 199 | - "deprivement": z.number().optional(), | |
| 197 | + "Chirotherium": z.number().int().optional(), | |
| 198 | + "cholesteatomatous": z.number().int().optional(), | |
| 199 | + "deprivement": z.number().int().optional(), | |
| 200 | 200 | "disdiapason": z.string().optional(), |
| 201 | - "flippantness": z.number().optional(), | |
| 202 | - "fogproof": z.number().optional(), | |
| 201 | + "flippantness": z.number().int().optional(), | |
| 202 | + "fogproof": z.number().int().optional(), | |
| 203 | 203 | "homocerc": z.boolean().optional(), |
| 204 | - "merrymeeting": z.number().optional(), | |
| 204 | + "merrymeeting": z.number().int().optional(), | |
| 205 | 205 | "nonbookish": z.null().optional(), |
| 206 | - "overcareful": z.number().optional(), | |
| 207 | - "panaris": z.number().optional(), | |
| 208 | - "preacceptance": z.number().optional(), | |
| 209 | - "quinoxaline": z.number().optional(), | |
| 210 | - "sig": z.number().optional(), | |
| 211 | - "superconfusion": z.number().optional(), | |
| 212 | - "Tacana": z.number().optional(), | |
| 213 | - "tillotter": z.number().optional(), | |
| 214 | - "tranquillize": z.number().optional(), | |
| 215 | - "unquestionable": z.number().optional(), | |
| 216 | - "uproute": z.number().optional(), | |
| 206 | + "overcareful": z.number().int().optional(), | |
| 207 | + "panaris": z.number().int().optional(), | |
| 208 | + "preacceptance": z.number().int().optional(), | |
| 209 | + "quinoxaline": z.number().int().optional(), | |
| 210 | + "sig": z.number().int().optional(), | |
| 211 | + "superconfusion": z.number().int().optional(), | |
| 212 | + "Tacana": z.number().int().optional(), | |
| 213 | + "tillotter": z.number().int().optional(), | |
| 214 | + "tranquillize": z.number().int().optional(), | |
| 215 | + "unquestionable": z.number().int().optional(), | |
| 216 | + "uproute": z.number().int().optional(), | |
| 217 | 217 | }); |
| 218 | 218 | export type LaviniaClass = z.infer<typeof LaviniaClassSchema>; |
| 219 | 219 | |
| @@ -242,49 +242,49 @@ export const OskarClassSchema = z.object({ | ||
| 242 | 242 | export type OskarClass = z.infer<typeof OskarClassSchema>; |
| 243 | 243 | |
| 244 | 244 | export const TopLevelSchema = z.object({ |
| 245 | - "Abranchiata": z.array(z.union([z.null(), z.array(z.number()), z.number()])), | |
| 246 | - "academe": z.array(z.union([z.array(z.number()), z.number(), z.record(z.string(), z.number())])), | |
| 247 | - "acquirable": z.array(z.union([z.array(z.union([z.null(), z.number()])), z.record(z.string(), z.number())])), | |
| 245 | + "Abranchiata": z.array(z.union([z.null(), z.array(z.number().int()), z.number().int()])), | |
| 246 | + "academe": z.array(z.union([z.array(z.number().int()), z.number().int(), z.record(z.string(), z.number().int())])), | |
| 247 | + "acquirable": z.array(z.union([z.array(z.union([z.null(), z.number().int()])), z.record(z.string(), z.number().int())])), | |
| 248 | 248 | "aerometry": z.array(z.union([z.boolean(), z.number()])), |
| 249 | - "alexin": z.array(z.union([z.array(z.number()), z.boolean()])), | |
| 250 | - "alleviate": z.array(z.union([z.array(z.union([z.null(), z.number()])), AlleviateClassSchema])), | |
| 251 | - "amaas": z.array(z.union([z.boolean(), RebeccaSchema, z.number()])), | |
| 249 | + "alexin": z.array(z.union([z.array(z.number().int()), z.boolean()])), | |
| 250 | + "alleviate": z.array(z.union([z.array(z.union([z.null(), z.number().int()])), AlleviateClassSchema])), | |
| 251 | + "amaas": z.array(z.union([z.boolean(), RebeccaSchema, z.number().int()])), | |
| 252 | 252 | "ambassage": z.array(z.union([z.array(z.null()), z.string()])), |
| 253 | 253 | "amphithyron": z.array(z.union([z.null(), AmphithyronSchema])), |
| 254 | 254 | "Andriana": z.array(z.union([z.null(), z.string()])), |
| 255 | - "ankee": z.array(z.union([z.array(z.number()), AnkeeClassSchema, z.number()])), | |
| 256 | - "annihilator": z.array(z.union([z.null(), z.record(z.string(), z.union([z.null(), z.number()]))])), | |
| 255 | + "ankee": z.array(z.union([z.array(z.number().int()), AnkeeClassSchema, z.number().int()])), | |
| 256 | + "annihilator": z.array(z.union([z.null(), z.record(z.string(), z.union([z.null(), z.number().int()]))])), | |
| 257 | 257 | "annulose": z.null(), |
| 258 | - "Ansarie": z.array(z.union([z.null(), z.array(z.number()), AnsarieClassSchema])), | |
| 259 | - "aphasia": z.array(z.union([z.array(z.number()), z.number()])), | |
| 258 | + "Ansarie": z.array(z.union([z.null(), z.array(z.number().int()), AnsarieClassSchema])), | |
| 259 | + "aphasia": z.array(z.union([z.array(z.number().int()), z.number().int()])), | |
| 260 | 260 | "asprawl": z.array(z.union([z.number(), z.string()])), |
| 261 | 261 | "attractive": z.array(z.union([z.null(), z.boolean()])), |
| 262 | - "barksome": z.record(z.string(), z.number()), | |
| 262 | + "barksome": z.record(z.string(), z.number().int()), | |
| 263 | 263 | "bedesman": z.array(z.union([z.boolean(), z.number(), z.string()])), |
| 264 | - "belard": z.array(z.union([z.array(z.number()), RebeccaSchema, z.number()])), | |
| 265 | - "bocking": z.array(z.union([z.array(z.number()), z.boolean(), z.record(z.string(), z.number())])), | |
| 266 | - "brawlingly": z.array(z.union([z.array(z.null()), z.record(z.string(), z.union([z.null(), z.number()]))])), | |
| 267 | - "brookie": z.array(z.union([z.array(z.number()), RebeccaSchema])), | |
| 264 | + "belard": z.array(z.union([z.array(z.number().int()), RebeccaSchema, z.number()])), | |
| 265 | + "bocking": z.array(z.union([z.array(z.number().int()), z.boolean(), z.record(z.string(), z.number().int())])), | |
| 266 | + "brawlingly": z.array(z.union([z.array(z.null()), z.record(z.string(), z.union([z.null(), z.number().int()]))])), | |
| 267 | + "brookie": z.array(z.union([z.array(z.number().int()), RebeccaSchema])), | |
| 268 | 268 | "bumboatman": z.array(z.union([z.null(), z.array(z.null()), z.string()])), |
| 269 | 269 | "bystreet": z.array(z.null()), |
| 270 | - "calaverite": z.array(z.union([z.array(z.number()), z.string()])), | |
| 271 | - "catallactic": z.array(z.union([z.array(z.null()), z.boolean(), z.record(z.string(), z.number())])), | |
| 272 | - "cemental": z.array(z.union([z.array(z.number()), z.number(), z.record(z.string(), z.number())])), | |
| 270 | + "calaverite": z.array(z.union([z.array(z.number().int()), z.string()])), | |
| 271 | + "catallactic": z.array(z.union([z.array(z.null()), z.boolean(), z.record(z.string(), z.number().int())])), | |
| 272 | + "cemental": z.array(z.union([z.array(z.number().int()), z.number(), z.record(z.string(), z.number().int())])), | |
| 273 | 273 | "Chytridiaceae": z.array(z.union([z.null(), z.boolean(), ChytridiaceaeClassSchema])), |
| 274 | - "Discordia": z.array(z.union([z.array(z.number()), DiscordiaClassSchema])), | |
| 275 | - "Endomyces": z.array(z.union([z.number(), z.string()])), | |
| 276 | - "Epinephelidae": z.array(z.union([z.boolean(), z.number(), z.string()])), | |
| 277 | - "Eupatorium": z.array(z.union([z.array(z.null()), z.record(z.string(), z.number())])), | |
| 278 | - "Gryphosaurus": z.array(z.union([z.array(z.number()), GryphosaurusClassSchema, z.string()])), | |
| 279 | - "Koryak": z.array(z.union([z.record(z.string(), z.union([z.null(), z.number()])), z.string()])), | |
| 274 | + "Discordia": z.array(z.union([z.array(z.number().int()), DiscordiaClassSchema])), | |
| 275 | + "Endomyces": z.array(z.union([z.number().int(), z.string()])), | |
| 276 | + "Epinephelidae": z.array(z.union([z.boolean(), z.number().int(), z.string()])), | |
| 277 | + "Eupatorium": z.array(z.union([z.array(z.null()), z.record(z.string(), z.number().int())])), | |
| 278 | + "Gryphosaurus": z.array(z.union([z.array(z.number().int()), GryphosaurusClassSchema, z.string()])), | |
| 279 | + "Koryak": z.array(z.union([z.record(z.string(), z.union([z.null(), z.number().int()])), z.string()])), | |
| 280 | 280 | "Lavinia": z.array(z.union([LaviniaClassSchema, z.string()])), |
| 281 | - "Oskar": z.array(z.union([z.array(z.number()), OskarClassSchema])), | |
| 282 | - "Rebecca": z.array(z.union([RebeccaSchema, z.number(), z.string()])), | |
| 283 | - "Rhomboganoidei": z.array(z.union([z.array(z.number()), RebeccaSchema, z.string()])), | |
| 281 | + "Oskar": z.array(z.union([z.array(z.number().int()), OskarClassSchema])), | |
| 282 | + "Rebecca": z.array(z.union([RebeccaSchema, z.number().int(), z.string()])), | |
| 283 | + "Rhomboganoidei": z.array(z.union([z.array(z.number().int()), RebeccaSchema, z.string()])), | |
| 284 | 284 | "Rigsmal": z.boolean(), |
| 285 | 285 | "Ruellia": z.array(z.union([z.boolean(), RebeccaSchema, z.string()])), |
| 286 | - "School": z.array(z.union([z.null(), z.number(), z.record(z.string(), z.number())])), | |
| 287 | - "Shakespearolater": z.array(z.union([z.array(z.number()), z.number(), z.string()])), | |
| 286 | + "School": z.array(z.union([z.null(), z.number().int(), z.record(z.string(), z.number().int())])), | |
| 287 | + "Shakespearolater": z.array(z.union([z.array(z.number().int()), z.number(), z.string()])), | |
| 288 | 288 | "Svan": z.array(z.number()), |
| 289 | 289 | "Wayao": z.record(z.string(), z.number()), |
| 290 | 290 | }); |
Test case
1 generated file · +85 −85test/inputs/json/priority/combinations3.json
Mtypescript-zoddefault / TopLevel.ts+85 −85
| @@ -75,77 +75,77 @@ export type LandlubberlyClass = z.infer<typeof LandlubberlyClassSchema>; | ||
| 75 | 75 | |
| 76 | 76 | export const LupusClassSchema = z.object({ |
| 77 | 77 | "catharticalness": z.number().optional(), |
| 78 | - "Chirotherium": z.number().optional(), | |
| 79 | - "Chlorioninae": z.number().optional(), | |
| 80 | - "Corvinae": z.number().optional(), | |
| 81 | - "Crassina": z.number().optional(), | |
| 78 | + "Chirotherium": z.number().int().optional(), | |
| 79 | + "Chlorioninae": z.number().int().optional(), | |
| 80 | + "Corvinae": z.number().int().optional(), | |
| 81 | + "Crassina": z.number().int().optional(), | |
| 82 | 82 | "disdiapason": z.string().optional(), |
| 83 | - "exiguity": z.number().optional(), | |
| 84 | - "farcist": z.number().optional(), | |
| 85 | - "holographical": z.number().optional(), | |
| 83 | + "exiguity": z.number().int().optional(), | |
| 84 | + "farcist": z.number().int().optional(), | |
| 85 | + "holographical": z.number().int().optional(), | |
| 86 | 86 | "homocerc": z.boolean().optional(), |
| 87 | - "ichthyophagan": z.number().optional(), | |
| 88 | - "implacable": z.number().optional(), | |
| 87 | + "ichthyophagan": z.number().int().optional(), | |
| 88 | + "implacable": z.number().int().optional(), | |
| 89 | 89 | "nonbookish": z.null().optional(), |
| 90 | - "outshiner": z.number().optional(), | |
| 91 | - "overweather": z.number().optional(), | |
| 92 | - "protonegroid": z.number().optional(), | |
| 93 | - "shallowish": z.number().optional(), | |
| 94 | - "snoke": z.number().optional(), | |
| 95 | - "snout": z.number().optional(), | |
| 96 | - "surveillance": z.number().optional(), | |
| 97 | - "threshingtime": z.number().optional(), | |
| 98 | - "Thysanocarpus": z.number().optional(), | |
| 99 | - "unsignificantly": z.number().optional(), | |
| 100 | - "unsnap": z.number().optional(), | |
| 101 | - "vendible": z.number().optional(), | |
| 90 | + "outshiner": z.number().int().optional(), | |
| 91 | + "overweather": z.number().int().optional(), | |
| 92 | + "protonegroid": z.number().int().optional(), | |
| 93 | + "shallowish": z.number().int().optional(), | |
| 94 | + "snoke": z.number().int().optional(), | |
| 95 | + "snout": z.number().int().optional(), | |
| 96 | + "surveillance": z.number().int().optional(), | |
| 97 | + "threshingtime": z.number().int().optional(), | |
| 98 | + "Thysanocarpus": z.number().int().optional(), | |
| 99 | + "unsignificantly": z.number().int().optional(), | |
| 100 | + "unsnap": z.number().int().optional(), | |
| 101 | + "vendible": z.number().int().optional(), | |
| 102 | 102 | }); |
| 103 | 103 | export type LupusClass = z.infer<typeof LupusClassSchema>; |
| 104 | 104 | |
| 105 | 105 | export const MaslinSchema = z.object({ |
| 106 | - "Alicant": z.number().optional(), | |
| 106 | + "Alicant": z.number().int().optional(), | |
| 107 | 107 | "antiatonement": z.null().optional(), |
| 108 | - "anticorrosive": z.number().optional(), | |
| 108 | + "anticorrosive": z.number().int().optional(), | |
| 109 | 109 | "aphidozer": z.null().optional(), |
| 110 | 110 | "Bakuninist": z.null().optional(), |
| 111 | - "be": z.number().optional(), | |
| 111 | + "be": z.number().int().optional(), | |
| 112 | 112 | "catharticalness": z.number().optional(), |
| 113 | - "Chirotherium": z.number().optional(), | |
| 114 | - "chub": z.number().optional(), | |
| 115 | - "cuprosilicon": z.number().optional(), | |
| 116 | - "curtailedly": z.number().optional(), | |
| 117 | - "dellenite": z.number().optional(), | |
| 118 | - "Dimitry": z.number().optional(), | |
| 113 | + "Chirotherium": z.number().int().optional(), | |
| 114 | + "chub": z.number().int().optional(), | |
| 115 | + "cuprosilicon": z.number().int().optional(), | |
| 116 | + "curtailedly": z.number().int().optional(), | |
| 117 | + "dellenite": z.number().int().optional(), | |
| 118 | + "Dimitry": z.number().int().optional(), | |
| 119 | 119 | "disdiapason": z.string().optional(), |
| 120 | 120 | "edifying": z.null().optional(), |
| 121 | - "ethmoiditis": z.number().optional(), | |
| 121 | + "ethmoiditis": z.number().int().optional(), | |
| 122 | 122 | "gastralgy": z.null().optional(), |
| 123 | - "goatherd": z.number().optional(), | |
| 124 | - "hammerdress": z.number().optional(), | |
| 123 | + "goatherd": z.number().int().optional(), | |
| 124 | + "hammerdress": z.number().int().optional(), | |
| 125 | 125 | "hangfire": z.null().optional(), |
| 126 | 126 | "homocerc": z.boolean().optional(), |
| 127 | - "lacunosity": z.number().optional(), | |
| 127 | + "lacunosity": z.number().int().optional(), | |
| 128 | 128 | "longiloquence": z.null().optional(), |
| 129 | - "mameliere": z.number().optional(), | |
| 129 | + "mameliere": z.number().int().optional(), | |
| 130 | 130 | "motherless": z.null().optional(), |
| 131 | 131 | "nonbookish": z.null().optional(), |
| 132 | 132 | "noncorrodible": z.null().optional(), |
| 133 | 133 | "nonsensicality": z.null().optional(), |
| 134 | - "oafishly": z.number().optional(), | |
| 134 | + "oafishly": z.number().int().optional(), | |
| 135 | 135 | "pfund": z.null().optional(), |
| 136 | 136 | "preadvisory": z.null().optional(), |
| 137 | 137 | "retroflexed": z.null().optional(), |
| 138 | - "saccharulmic": z.number().optional(), | |
| 139 | - "scowlful": z.number().optional(), | |
| 138 | + "saccharulmic": z.number().int().optional(), | |
| 139 | + "scowlful": z.number().int().optional(), | |
| 140 | 140 | "secluded": z.null().optional(), |
| 141 | 141 | "slackage": z.null().optional(), |
| 142 | - "sphaeridial": z.number().optional(), | |
| 142 | + "sphaeridial": z.number().int().optional(), | |
| 143 | 143 | "spondulics": z.null().optional(), |
| 144 | - "subsecive": z.number().optional(), | |
| 144 | + "subsecive": z.number().int().optional(), | |
| 145 | 145 | "swellmobsman": z.null().optional(), |
| 146 | - "trachyglossate": z.number().optional(), | |
| 146 | + "trachyglossate": z.number().int().optional(), | |
| 147 | 147 | "trialogue": z.null().optional(), |
| 148 | - "unassuaged": z.number().optional(), | |
| 148 | + "unassuaged": z.number().int().optional(), | |
| 149 | 149 | "ungross": z.null().optional(), |
| 150 | 150 | "unjudiciously": z.null().optional(), |
| 151 | 151 | }); |
| @@ -153,7 +153,7 @@ export type Maslin = z.infer<typeof MaslinSchema>; | ||
| 153 | 153 | |
| 154 | 154 | export const MonaziteClassSchema = z.object({ |
| 155 | 155 | "catharticalness": z.number(), |
| 156 | - "Chirotherium": z.number(), | |
| 156 | + "Chirotherium": z.number().int(), | |
| 157 | 157 | "disdiapason": z.string(), |
| 158 | 158 | "homocerc": z.boolean(), |
| 159 | 159 | "nonbookish": z.null(), |
| @@ -164,7 +164,7 @@ export const MonotheisticallyClassSchema = z.object({ | ||
| 164 | 164 | "blaspheme": z.null().optional(), |
| 165 | 165 | "catharticalness": z.number().optional(), |
| 166 | 166 | "celiosalpingectomy": z.null().optional(), |
| 167 | - "Chirotherium": z.number().optional(), | |
| 167 | + "Chirotherium": z.number().int().optional(), | |
| 168 | 168 | "consummativeness": z.null().optional(), |
| 169 | 169 | "disdiapason": z.string().optional(), |
| 170 | 170 | "egestive": z.null().optional(), |
| @@ -192,7 +192,7 @@ export type MonotheisticallyClass = z.infer<typeof MonotheisticallyClassSchema>; | ||
| 192 | 192 | export const NoncontributingSchema = z.object({ |
| 193 | 193 | "estevin": z.string(), |
| 194 | 194 | "jolterhead": z.number(), |
| 195 | - "sauternes": z.number(), | |
| 195 | + "sauternes": z.number().int(), | |
| 196 | 196 | "sparsely": z.boolean(), |
| 197 | 197 | "unrequested": z.null(), |
| 198 | 198 | }); |
| @@ -247,38 +247,38 @@ export const OutrivalClassSchema = z.object({ | ||
| 247 | 247 | export type OutrivalClass = z.infer<typeof OutrivalClassSchema>; |
| 248 | 248 | |
| 249 | 249 | export const PiaculumClassSchema = z.object({ |
| 250 | - "alada": z.number().optional(), | |
| 251 | - "amphistomous": z.number().optional(), | |
| 252 | - "boysenberry": z.number().optional(), | |
| 250 | + "alada": z.number().int().optional(), | |
| 251 | + "amphistomous": z.number().int().optional(), | |
| 252 | + "boysenberry": z.number().int().optional(), | |
| 253 | 253 | "catharticalness": z.number().optional(), |
| 254 | - "Chirotherium": z.number().optional(), | |
| 255 | - "decardinalize": z.number().optional(), | |
| 256 | - "discouragement": z.number().optional(), | |
| 254 | + "Chirotherium": z.number().int().optional(), | |
| 255 | + "decardinalize": z.number().int().optional(), | |
| 256 | + "discouragement": z.number().int().optional(), | |
| 257 | 257 | "disdiapason": z.string().optional(), |
| 258 | - "doitrified": z.number().optional(), | |
| 259 | - "hexaspermous": z.number().optional(), | |
| 258 | + "doitrified": z.number().int().optional(), | |
| 259 | + "hexaspermous": z.number().int().optional(), | |
| 260 | 260 | "homocerc": z.boolean().optional(), |
| 261 | - "insinking": z.number().optional(), | |
| 262 | - "loathfulness": z.number().optional(), | |
| 263 | - "miasmatical": z.number().optional(), | |
| 264 | - "neurofibril": z.number().optional(), | |
| 261 | + "insinking": z.number().int().optional(), | |
| 262 | + "loathfulness": z.number().int().optional(), | |
| 263 | + "miasmatical": z.number().int().optional(), | |
| 264 | + "neurofibril": z.number().int().optional(), | |
| 265 | 265 | "nonbookish": z.null().optional(), |
| 266 | - "phonendoscope": z.number().optional(), | |
| 267 | - "pilferment": z.number().optional(), | |
| 268 | - "predismissory": z.number().optional(), | |
| 269 | - "preinscription": z.number().optional(), | |
| 270 | - "quotative": z.number().optional(), | |
| 271 | - "sienna": z.number().optional(), | |
| 272 | - "thorax": z.number().optional(), | |
| 273 | - "yachting": z.number().optional(), | |
| 274 | - "Zipper": z.number().optional(), | |
| 266 | + "phonendoscope": z.number().int().optional(), | |
| 267 | + "pilferment": z.number().int().optional(), | |
| 268 | + "predismissory": z.number().int().optional(), | |
| 269 | + "preinscription": z.number().int().optional(), | |
| 270 | + "quotative": z.number().int().optional(), | |
| 271 | + "sienna": z.number().int().optional(), | |
| 272 | + "thorax": z.number().int().optional(), | |
| 273 | + "yachting": z.number().int().optional(), | |
| 274 | + "Zipper": z.number().int().optional(), | |
| 275 | 275 | }); |
| 276 | 276 | export type PiaculumClass = z.infer<typeof PiaculumClassSchema>; |
| 277 | 277 | |
| 278 | 278 | export const PneumoceleSchema = z.object({ |
| 279 | 279 | "Carbonarism": z.null().optional(), |
| 280 | 280 | "catharticalness": z.number().optional(), |
| 281 | - "Chirotherium": z.number().optional(), | |
| 281 | + "Chirotherium": z.number().int().optional(), | |
| 282 | 282 | "cineolic": z.null().optional(), |
| 283 | 283 | "cobbly": z.null().optional(), |
| 284 | 284 | "conchyliferous": z.null().optional(), |
| @@ -354,11 +354,11 @@ export type PrefreshmanClass = z.infer<typeof PrefreshmanClassSchema>; | ||
| 354 | 354 | |
| 355 | 355 | export const TopLevelSchema = z.object({ |
| 356 | 356 | "juror": z.array(z.union([z.boolean(), JurorClassSchema])), |
| 357 | - "kongoni": z.array(z.union([z.array(z.number()), z.record(z.string(), z.number())])), | |
| 357 | + "kongoni": z.array(z.union([z.array(z.number().int()), z.record(z.string(), z.number().int())])), | |
| 358 | 358 | "ladronism": z.array(z.union([LadronismClassSchema, z.number(), z.string()])), |
| 359 | - "landlubberly": z.array(z.union([z.boolean(), LandlubberlyClassSchema, z.number()])), | |
| 360 | - "listener": z.array(z.union([z.array(z.null()), z.number()])), | |
| 361 | - "lupus": z.array(z.union([LupusClassSchema, z.number()])), | |
| 359 | + "landlubberly": z.array(z.union([z.boolean(), LandlubberlyClassSchema, z.number().int()])), | |
| 360 | + "listener": z.array(z.union([z.array(z.null()), z.number().int()])), | |
| 361 | + "lupus": z.array(z.union([LupusClassSchema, z.number().int()])), | |
| 362 | 362 | "maslin": z.array(MaslinSchema), |
| 363 | 363 | "monazite": z.array(z.union([MonaziteClassSchema, z.number()])), |
| 364 | 364 | "monoliteral": z.array(z.union([z.array(z.null()), z.boolean()])), |
| @@ -366,34 +366,34 @@ export const TopLevelSchema = z.object({ | ||
| 366 | 366 | "montage": z.array(z.union([z.array(z.null()), z.number(), z.string()])), |
| 367 | 367 | "moralness": z.array(z.union([z.null(), z.array(z.null()), z.number()])), |
| 368 | 368 | "mowra": z.array(z.union([z.null(), MonaziteClassSchema])), |
| 369 | - "mulishly": z.array(z.union([z.null(), z.array(z.number()), z.number()])), | |
| 370 | - "myoscope": z.array(z.union([z.array(z.null()), z.boolean(), z.number()])), | |
| 371 | - "nach": z.array(z.union([z.null(), z.array(z.union([z.null(), z.number()]))])), | |
| 369 | + "mulishly": z.array(z.union([z.null(), z.array(z.number().int()), z.number()])), | |
| 370 | + "myoscope": z.array(z.union([z.array(z.null()), z.boolean(), z.number().int()])), | |
| 371 | + "nach": z.array(z.union([z.null(), z.array(z.union([z.null(), z.number().int()]))])), | |
| 372 | 372 | "neuromastic": z.array(z.union([z.array(z.null()), z.number()])), |
| 373 | 373 | "noncontributing": z.array(NoncontributingSchema), |
| 374 | - "nonnervous": z.array(z.union([z.boolean(), z.number()])), | |
| 374 | + "nonnervous": z.array(z.union([z.boolean(), z.number().int()])), | |
| 375 | 375 | "nonvaluation": z.array(z.union([z.array(z.null()), z.boolean(), z.number()])), |
| 376 | 376 | "occupationalist": z.array(z.union([z.null(), z.array(z.null()), OccupationalistClassSchema])), |
| 377 | 377 | "outrival": z.array(z.union([z.null(), OutrivalClassSchema, z.number()])), |
| 378 | - "paleographically": z.array(z.union([z.number(), z.record(z.string(), z.union([z.null(), z.number()]))])), | |
| 379 | - "pamphletwise": z.array(z.union([z.number(), z.record(z.string(), z.number()), z.string()])), | |
| 378 | + "paleographically": z.array(z.union([z.number(), z.record(z.string(), z.union([z.null(), z.number().int()]))])), | |
| 379 | + "pamphletwise": z.array(z.union([z.number().int(), z.record(z.string(), z.number().int()), z.string()])), | |
| 380 | 380 | "pediatrics": z.array(z.union([z.null(), z.boolean(), z.number()])), |
| 381 | 381 | "perceptive": z.array(z.boolean()), |
| 382 | 382 | "piaculum": z.array(z.union([PiaculumClassSchema, z.number()])), |
| 383 | 383 | "piccadilly": z.array(z.union([z.null(), z.number(), z.string()])), |
| 384 | 384 | "piffler": z.array(z.union([z.array(z.null()), MonaziteClassSchema])), |
| 385 | - "pithful": z.array(z.union([z.null(), z.boolean(), z.number()])), | |
| 386 | - "placuntitis": z.array(z.union([z.number(), z.record(z.string(), z.number())])), | |
| 387 | - "plectopterous": z.array(z.union([z.number(), z.record(z.string(), z.number())])), | |
| 385 | + "pithful": z.array(z.union([z.null(), z.boolean(), z.number().int()])), | |
| 386 | + "placuntitis": z.array(z.union([z.number().int(), z.record(z.string(), z.number().int())])), | |
| 387 | + "plectopterous": z.array(z.union([z.number(), z.record(z.string(), z.number().int())])), | |
| 388 | 388 | "pneumocele": z.array(z.union([z.null(), PneumoceleSchema])), |
| 389 | 389 | "poliorcetic": z.array(z.union([z.boolean(), MonaziteClassSchema])), |
| 390 | - "poormaster": z.array(z.union([z.null(), z.array(z.number()), z.record(z.string(), z.number())])), | |
| 391 | - "potwhisky": z.array(z.union([z.null(), PotwhiskyClassSchema, z.number()])), | |
| 390 | + "poormaster": z.array(z.union([z.null(), z.array(z.number().int()), z.record(z.string(), z.number().int())])), | |
| 391 | + "potwhisky": z.array(z.union([z.null(), PotwhiskyClassSchema, z.number().int()])), | |
| 392 | 392 | "practicalizer": z.array(z.union([z.array(z.null()), MonaziteClassSchema, z.string()])), |
| 393 | 393 | "prefreshman": z.array(z.union([z.array(z.null()), PrefreshmanClassSchema, z.string()])), |
| 394 | 394 | "prehensility": z.array(z.union([z.array(z.null()), z.boolean(), MonaziteClassSchema])), |
| 395 | - "prevoidance": z.array(z.union([z.array(z.number()), MonaziteClassSchema, z.number()])), | |
| 396 | - "probant": z.array(z.record(z.string(), z.union([z.null(), z.number()]))), | |
| 397 | - "protext": z.array(z.union([z.array(z.number()), z.boolean(), MonaziteClassSchema])), | |
| 395 | + "prevoidance": z.array(z.union([z.array(z.number().int()), MonaziteClassSchema, z.number().int()])), | |
| 396 | + "probant": z.array(z.record(z.string(), z.union([z.null(), z.number().int()]))), | |
| 397 | + "protext": z.array(z.union([z.array(z.number().int()), z.boolean(), MonaziteClassSchema])), | |
| 398 | 398 | }); |
| 399 | 399 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/priority/direct-recursive.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -12,7 +12,7 @@ export const TopLevelSchema: z.ZodType<TopLevel> = z.lazy(() => | ||
| 12 | 12 | z.object({ |
| 13 | 13 | "also": TopLevelSchema.optional(), |
| 14 | 14 | "bar": z.boolean(), |
| 15 | - "foo": z.number(), | |
| 15 | + "foo": z.number().int(), | |
| 16 | 16 | "moo": z.number(), |
| 17 | 17 | "quux": z.string(), |
| 18 | 18 | }) |
Test case
1 generated file · +1 −1test/inputs/json/priority/issue2680-scalar-array.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | import * as z from "zod"; |
| 2 | 2 | |
| 3 | -export const TopLevelSchema = z.array(z.number()); | |
| 3 | +export const TopLevelSchema = z.array(z.number().int()); | |
| 4 | 4 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/priority/list.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -7,7 +7,7 @@ export type TopLevel = { | ||
| 7 | 7 | }; |
| 8 | 8 | export const TopLevelSchema: z.ZodType<TopLevel> = z.lazy(() => |
| 9 | 9 | z.object({ |
| 10 | - "data": z.number(), | |
| 10 | + "data": z.number().int(), | |
| 11 | 11 | "next": z.union([z.null(), TopLevelSchema]), |
| 12 | 12 | }) |
| 13 | 13 | ); |
Test case
1 generated file · +1 −1test/inputs/json/priority/name-style.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "anEasyOne": z.number(), | |
| 5 | + "anEasyOne": z.number().int(), | |
| 6 | 6 | "isMNISTLetter": z.boolean(), |
| 7 | 7 | "JSONString": z.string(), |
| 8 | 8 | "PrettyEasyToo": z.boolean(), |
Test case
1 generated file · +2 −2test/inputs/json/priority/nested-objects.json
Mtypescript-zoddefault / TopLevel.ts+2 −2
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "a": z.record(z.string(), z.number()), | |
| 6 | - "b": z.record(z.string(), z.number()), | |
| 5 | + "a": z.record(z.string(), z.number().int()), | |
| 6 | + "b": z.record(z.string(), z.number().int()), | |
| 7 | 7 | }); |
| 8 | 8 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/priority/no-classes.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | import * as z from "zod"; |
| 2 | 2 | |
| 3 | -export const TopLevelSchema = z.number(); | |
| 3 | +export const TopLevelSchema = z.number().int(); | |
| 4 | 4 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/priority/omit-empty.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const ResultSchema = z.object({ |
| 5 | - "age": z.number(), | |
| 5 | + "age": z.number().int(), | |
| 6 | 6 | "name": z.null().optional(), |
| 7 | 7 | }); |
| 8 | 8 | export type Result = z.infer<typeof ResultSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/priority/optional-union.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelElementSchema = z.object({ |
| 5 | - "a": z.union([z.number(), z.string()]).optional(), | |
| 5 | + "a": z.union([z.number().int(), z.string()]).optional(), | |
| 6 | 6 | }); |
| 7 | 7 | export type TopLevelElement = z.infer<typeof TopLevelElementSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/priority/php-mixed-union.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -7,6 +7,6 @@ export const MixedClassSchema = z.object({ | ||
| 7 | 7 | export type MixedClass = z.infer<typeof MixedClassSchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelSchema = z.object({ |
| 10 | - "mixed": z.array(z.union([z.null(), z.boolean(), MixedClassSchema, z.number(), z.string()])), | |
| 10 | + "mixed": z.array(z.union([z.null(), z.boolean(), MixedClassSchema, z.number().int(), z.string()])), | |
| 11 | 11 | }); |
| 12 | 12 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +2 −2test/inputs/json/priority/php-validation.json
Mtypescript-zoddefault / TopLevel.ts+2 −2
| @@ -3,8 +3,8 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | 5 | "boolean": z.boolean(), |
| 6 | - "integer": z.number(), | |
| 7 | - "integers": z.array(z.number()), | |
| 6 | + "integer": z.number().int(), | |
| 7 | + "integers": z.array(z.number().int()), | |
| 8 | 8 | "number": z.number(), |
| 9 | 9 | "string": z.string(), |
| 10 | 10 | }); |
Test case
1 generated file · +26 −26test/inputs/json/priority/recursive.json
Mtypescript-zoddefault / TopLevel.ts+26 −26
| @@ -19,9 +19,9 @@ export type FormatsClass = { | ||
| 19 | 19 | export const FormatsClassSchema: z.ZodType<FormatsClass> = z.lazy(() => |
| 20 | 20 | z.object({ |
| 21 | 21 | "formats": z.array(FormatSchema).optional(), |
| 22 | - "height": z.number(), | |
| 22 | + "height": z.number().int(), | |
| 23 | 23 | "url": z.string(), |
| 24 | - "width": z.number(), | |
| 24 | + "width": z.number().int(), | |
| 25 | 25 | }) |
| 26 | 26 | ); |
| 27 | 27 | |
| @@ -37,7 +37,7 @@ export const CategoryThumbnailSchema = z.object({ | ||
| 37 | 37 | export type CategoryThumbnail = z.infer<typeof CategoryThumbnailSchema>; |
| 38 | 38 | |
| 39 | 39 | export const EonandyearSchema = z.object({ |
| 40 | - "lowestsetbit": z.number(), | |
| 40 | + "lowestsetbit": z.number().int(), | |
| 41 | 41 | }); |
| 42 | 42 | export type Eonandyear = z.infer<typeof EonandyearSchema>; |
| 43 | 43 | |
| @@ -59,23 +59,23 @@ export const LinkElementSchema = z.object({ | ||
| 59 | 59 | export type LinkElement = z.infer<typeof LinkElementSchema>; |
| 60 | 60 | |
| 61 | 61 | export const DateClassSchema = z.object({ |
| 62 | - "day": z.number(), | |
| 62 | + "day": z.number().int(), | |
| 63 | 63 | "eonandyear": EonandyearSchema, |
| 64 | - "hour": z.number(), | |
| 65 | - "millisecond": z.number(), | |
| 66 | - "minute": z.number(), | |
| 67 | - "month": z.number(), | |
| 68 | - "second": z.number(), | |
| 69 | - "timezone": z.number(), | |
| 64 | + "hour": z.number().int(), | |
| 65 | + "millisecond": z.number().int(), | |
| 66 | + "minute": z.number().int(), | |
| 67 | + "month": z.number().int(), | |
| 68 | + "second": z.number().int(), | |
| 69 | + "timezone": z.number().int(), | |
| 70 | 70 | "valid": z.boolean(), |
| 71 | 71 | "xmlschematype": XmlschematypeSchema, |
| 72 | - "year": z.number(), | |
| 72 | + "year": z.number().int(), | |
| 73 | 73 | }); |
| 74 | 74 | export type DateClass = z.infer<typeof DateClassSchema>; |
| 75 | 75 | |
| 76 | 76 | export const UseraverageratingSchema = z.object({ |
| 77 | 77 | "links": z.array(LinkElementSchema), |
| 78 | - "numcomments": z.number(), | |
| 78 | + "numcomments": z.number().int(), | |
| 79 | 79 | "rating": z.string(), |
| 80 | 80 | }); |
| 81 | 81 | export type Useraveragerating = z.infer<typeof UseraverageratingSchema>; |
| @@ -88,11 +88,11 @@ export type Specification = z.infer<typeof SpecificationSchema>; | ||
| 88 | 88 | export const CategorySchema = z.object({ |
| 89 | 89 | "concatenatecategoryname": z.boolean(), |
| 90 | 90 | "hasoffer": z.boolean(), |
| 91 | - "id": z.number(), | |
| 91 | + "id": z.number().int(), | |
| 92 | 92 | "isfinal": z.boolean(), |
| 93 | 93 | "links": z.array(LinkElementSchema), |
| 94 | 94 | "name": z.string(), |
| 95 | - "parentcategoryid": z.number(), | |
| 95 | + "parentcategoryid": z.number().int(), | |
| 96 | 96 | "thumbnail": CategoryThumbnailSchema, |
| 97 | 97 | }); |
| 98 | 98 | export type Category = z.infer<typeof CategorySchema>; |
| @@ -100,9 +100,9 @@ export type Category = z.infer<typeof CategorySchema>; | ||
| 100 | 100 | export const DetailsSchema = z.object({ |
| 101 | 101 | "applicationid": z.string(), |
| 102 | 102 | "applicationversion": z.string(), |
| 103 | - "code": z.number(), | |
| 103 | + "code": z.number().int(), | |
| 104 | 104 | "date": DateClassSchema, |
| 105 | - "elapsedtime": z.number(), | |
| 105 | + "elapsedtime": z.number().int(), | |
| 106 | 106 | "message": z.string(), |
| 107 | 107 | "status": z.string(), |
| 108 | 108 | }); |
| @@ -114,22 +114,22 @@ export const RatingSchema = z.object({ | ||
| 114 | 114 | export type Rating = z.infer<typeof RatingSchema>; |
| 115 | 115 | |
| 116 | 116 | export const ProductProductSchema = z.object({ |
| 117 | - "categoryid": z.number(), | |
| 117 | + "categoryid": z.number().int(), | |
| 118 | 118 | "currency": CurrencySchema, |
| 119 | 119 | "eco": z.boolean(), |
| 120 | 120 | "fulldescription": z.boolean(), |
| 121 | 121 | "hasmetasearch": z.boolean(), |
| 122 | - "id": z.number(), | |
| 122 | + "id": z.number().int(), | |
| 123 | 123 | "links": z.array(LinkElementSchema), |
| 124 | - "numoffers": z.number(), | |
| 124 | + "numoffers": z.number().int(), | |
| 125 | 125 | "pricemax": z.string(), |
| 126 | 126 | "pricemin": z.string(), |
| 127 | 127 | "productname": z.string(), |
| 128 | - "quantity": z.number(), | |
| 128 | + "quantity": z.number().int(), | |
| 129 | 129 | "rating": RatingSchema, |
| 130 | 130 | "specification": SpecificationSchema, |
| 131 | 131 | "thumbnail": FormatsClassSchema, |
| 132 | - "totalsellers": z.number(), | |
| 132 | + "totalsellers": z.number().int(), | |
| 133 | 133 | }); |
| 134 | 134 | export type ProductProduct = z.infer<typeof ProductProductSchema>; |
| 135 | 135 | |
| @@ -142,12 +142,12 @@ export const TopLevelSchema = z.object({ | ||
| 142 | 142 | "category": CategorySchema, |
| 143 | 143 | "details": DetailsSchema, |
| 144 | 144 | "match": z.string(), |
| 145 | - "page": z.number(), | |
| 145 | + "page": z.number().int(), | |
| 146 | 146 | "product": z.array(ProductElementSchema), |
| 147 | 147 | "schk": z.boolean(), |
| 148 | - "totallooseoffers": z.number(), | |
| 149 | - "totalpages": z.number(), | |
| 150 | - "totalresultsavailable": z.number(), | |
| 151 | - "totalresultsreturned": z.number(), | |
| 148 | + "totallooseoffers": z.number().int(), | |
| 149 | + "totalpages": z.number().int(), | |
| 150 | + "totalresultsavailable": z.number().int(), | |
| 151 | + "totalresultsreturned": z.number().int(), | |
| 152 | 152 | }); |
| 153 | 153 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/priority/union-constructor-clash.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -8,6 +8,6 @@ export type BoolInUnion = z.infer<typeof BoolInUnionSchema>; | ||
| 8 | 8 | |
| 9 | 9 | export const TopLevelSchema = z.object({ |
| 10 | 10 | "BoolInUnion": BoolInUnionSchema, |
| 11 | - "union": z.array(z.union([z.boolean(), z.number()])), | |
| 11 | + "union": z.array(z.union([z.boolean(), z.number().int()])), | |
| 12 | 12 | }); |
| 13 | 13 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +3 −3test/inputs/json/priority/unions.json
Mtypescript-zoddefault / TopLevel.ts+3 −3
| @@ -7,8 +7,8 @@ export const ZClassSchema = z.object({ | ||
| 7 | 7 | export type ZClass = z.infer<typeof ZClassSchema>; |
| 8 | 8 | |
| 9 | 9 | export const TopLevelSchema = z.object({ |
| 10 | - "x": z.array(z.union([z.null(), z.number(), z.string()])), | |
| 11 | - "y": z.array(z.union([z.null(), z.number()])), | |
| 12 | - "z": z.array(z.union([z.array(z.number()), ZClassSchema, z.number()])), | |
| 10 | + "x": z.array(z.union([z.null(), z.number().int(), z.string()])), | |
| 11 | + "y": z.array(z.union([z.null(), z.number().int()])), | |
| 12 | + "z": z.array(z.union([z.array(z.number().int()), ZClassSchema, z.number().int()])), | |
| 13 | 13 | }); |
| 14 | 14 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/priority/uuids.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -4,7 +4,7 @@ import * as z from "zod"; | ||
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | 5 | "booleanValue": z.boolean(), |
| 6 | 6 | "doubleValue": z.number(), |
| 7 | - "intValue": z.number(), | |
| 7 | + "intValue": z.number().int(), | |
| 8 | 8 | "stringValue": z.string(), |
| 9 | 9 | "uuidValue": z.string(), |
| 10 | 10 | "uuidValues": z.array(z.string()), |
Test case
1 generated file · +4 −4test/inputs/json/samples/bitcoin-block.json
Mtypescript-zoddefault / TopLevel.ts+4 −4
| @@ -2,10 +2,10 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "block_index": z.number(), | |
| 5 | + "block_index": z.number().int(), | |
| 6 | 6 | "hash": z.string(), |
| 7 | - "height": z.number(), | |
| 8 | - "time": z.number(), | |
| 9 | - "txIndexes": z.array(z.number()), | |
| 7 | + "height": z.number().int(), | |
| 8 | + "time": z.number().int(), | |
| 9 | + "txIndexes": z.array(z.number().int()), | |
| 10 | 10 | }); |
| 11 | 11 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +7 −7test/inputs/json/samples/kitchen-sink.json
Mtypescript-zoddefault / TopLevel.ts+7 −7
| @@ -7,14 +7,14 @@ export const DifferentThingClassSchema = z.object({ | ||
| 7 | 7 | export type DifferentThingClass = z.infer<typeof DifferentThingClassSchema>; |
| 8 | 8 | |
| 9 | 9 | export const PersonElementSchema = z.object({ |
| 10 | - "intOrString": z.union([z.number(), z.string()]), | |
| 10 | + "intOrString": z.union([z.number().int(), z.string()]), | |
| 11 | 11 | "name": z.string(), |
| 12 | 12 | "optionalValue": z.boolean().optional(), |
| 13 | 13 | }); |
| 14 | 14 | export type PersonElement = z.infer<typeof PersonElementSchema>; |
| 15 | 15 | |
| 16 | 16 | export const PurplePersonSchema = z.object({ |
| 17 | - "intOrString": z.number(), | |
| 17 | + "intOrString": z.number().int(), | |
| 18 | 18 | "name": z.string(), |
| 19 | 19 | }); |
| 20 | 20 | export type PurplePerson = z.infer<typeof PurplePersonSchema>; |
| @@ -22,17 +22,17 @@ export type PurplePerson = z.infer<typeof PurplePersonSchema>; | ||
| 22 | 22 | export const TopLevelSchema = z.object({ |
| 23 | 23 | "booleanValue": z.boolean(), |
| 24 | 24 | "dateValue": z.string(), |
| 25 | - "differentThings": z.array(z.union([DifferentThingClassSchema, z.number(), z.string()])), | |
| 25 | + "differentThings": z.array(z.union([DifferentThingClassSchema, z.number().int(), z.string()])), | |
| 26 | 26 | "doubleValue": z.number(), |
| 27 | - "intValue": z.number(), | |
| 28 | - "mapValue": z.record(z.string(), z.union([z.null(), z.number()])), | |
| 27 | + "intValue": z.number().int(), | |
| 28 | + "mapValue": z.record(z.string(), z.union([z.null(), z.number().int()])), | |
| 29 | 29 | "name with spaces": z.null(), |
| 30 | 30 | "nullValue": z.null(), |
| 31 | - "nullableMapValue": z.record(z.string(), z.union([z.null(), z.number()])), | |
| 31 | + "nullableMapValue": z.record(z.string(), z.union([z.null(), z.number().int()])), | |
| 32 | 32 | "people": z.array(PersonElementSchema), |
| 33 | 33 | "person": PurplePersonSchema, |
| 34 | 34 | "stringValue": z.string(), |
| 35 | - "tuples": z.array(z.array(z.union([z.number(), z.string()]))), | |
| 35 | + "tuples": z.array(z.array(z.union([z.number().int(), z.string()]))), | |
| 36 | 36 | "uuidValue": z.string(), |
| 37 | 37 | }); |
| 38 | 38 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/json/samples/null-safe.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -12,7 +12,7 @@ export const ItemSchema = z.object({ | ||
| 12 | 12 | "address": AddressSchema.optional(), |
| 13 | 13 | "created_at": z.coerce.date().optional(), |
| 14 | 14 | "name": z.string(), |
| 15 | - "sex": z.union([z.null(), z.number()]), | |
| 15 | + "sex": z.union([z.null(), z.number().int()]), | |
| 16 | 16 | }); |
| 17 | 17 | export type Item = z.infer<typeof ItemSchema>; |
Test case
1 generated file · +2 −2test/inputs/json/samples/pokedex.json
Mtypescript-zoddefault / TopLevel.ts+2 −2
| @@ -42,10 +42,10 @@ export type Evolution = z.infer<typeof EvolutionSchema>; | ||
| 42 | 42 | export const PokemonSchema = z.object({ |
| 43 | 43 | "avg_spawns": z.number(), |
| 44 | 44 | "candy": z.string(), |
| 45 | - "candy_count": z.number().optional(), | |
| 45 | + "candy_count": z.number().int().optional(), | |
| 46 | 46 | "egg": EggSchema, |
| 47 | 47 | "height": z.string(), |
| 48 | - "id": z.number(), | |
| 48 | + "id": z.number().int(), | |
| 49 | 49 | "img": z.string(), |
| 50 | 50 | "multipliers": z.union([z.null(), z.array(z.number())]), |
| 51 | 51 | "name": z.string(), |
Test case
1 generated file · +11 −11test/inputs/json/samples/reddit.json
Mtypescript-zoddefault / TopLevel.ts+11 −11
| @@ -57,9 +57,9 @@ export const MediaEmbedSchema = z.object({ | ||
| 57 | 57 | export type MediaEmbed = z.infer<typeof MediaEmbedSchema>; |
| 58 | 58 | |
| 59 | 59 | export const SourceSchema = z.object({ |
| 60 | - "height": z.number(), | |
| 60 | + "height": z.number().int(), | |
| 61 | 61 | "url": z.string(), |
| 62 | - "width": z.number(), | |
| 62 | + "width": z.number().int(), | |
| 63 | 63 | }); |
| 64 | 64 | export type Source = z.infer<typeof SourceSchema>; |
| 65 | 65 | |
| @@ -103,13 +103,13 @@ export const ChildDataSchema = z.object({ | ||
| 103 | 103 | "can_mod_post": z.boolean(), |
| 104 | 104 | "clicked": z.boolean(), |
| 105 | 105 | "contest_mode": z.boolean(), |
| 106 | - "created": z.number(), | |
| 107 | - "created_utc": z.number(), | |
| 106 | + "created": z.number().int(), | |
| 107 | + "created_utc": z.number().int(), | |
| 108 | 108 | "distinguished": z.union([z.null(), z.string()]), |
| 109 | 109 | "domain": DomainSchema, |
| 110 | - "downs": z.number(), | |
| 110 | + "downs": z.number().int(), | |
| 111 | 111 | "edited": z.boolean(), |
| 112 | - "gilded": z.number(), | |
| 112 | + "gilded": z.number().int(), | |
| 113 | 113 | "hidden": z.boolean(), |
| 114 | 114 | "hide_score": z.boolean(), |
| 115 | 115 | "id": z.string(), |
| @@ -123,7 +123,7 @@ export const ChildDataSchema = z.object({ | ||
| 123 | 123 | "media_embed": MediaEmbedSchema, |
| 124 | 124 | "mod_reports": z.array(z.any()), |
| 125 | 125 | "name": z.string(), |
| 126 | - "num_comments": z.number(), | |
| 126 | + "num_comments": z.number().int(), | |
| 127 | 127 | "num_reports": z.null(), |
| 128 | 128 | "over_18": z.boolean(), |
| 129 | 129 | "parent_whitelist_status": WhitelistStatusSchema, |
| @@ -134,7 +134,7 @@ export const ChildDataSchema = z.object({ | ||
| 134 | 134 | "removal_reason": z.null(), |
| 135 | 135 | "report_reasons": z.null(), |
| 136 | 136 | "saved": z.boolean(), |
| 137 | - "score": z.number(), | |
| 137 | + "score": z.number().int(), | |
| 138 | 138 | "secure_media": z.null(), |
| 139 | 139 | "secure_media_embed": MediaEmbedSchema, |
| 140 | 140 | "selftext": z.string(), |
| @@ -147,10 +147,10 @@ export const ChildDataSchema = z.object({ | ||
| 147 | 147 | "subreddit_type": SubredditTypeSchema, |
| 148 | 148 | "suggested_sort": z.null(), |
| 149 | 149 | "thumbnail": z.string(), |
| 150 | - "thumbnail_height": z.number(), | |
| 151 | - "thumbnail_width": z.number(), | |
| 150 | + "thumbnail_height": z.number().int(), | |
| 151 | + "thumbnail_width": z.number().int(), | |
| 152 | 152 | "title": z.string(), |
| 153 | - "ups": z.number(), | |
| 153 | + "ups": z.number().int(), | |
| 154 | 154 | "url": z.string(), |
| 155 | 155 | "user_reports": z.array(z.any()), |
| 156 | 156 | "view_count": z.null(), |
Test case
1 generated file · +1 −1test/inputs/json/samples/simple-object.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "date": z.number(), | |
| 5 | + "date": z.number().int(), | |
| 6 | 6 | "title": z.string(), |
| 7 | 7 | "validity": z.boolean(), |
| 8 | 8 | }); |
Test case
1 generated file · +9 −9test/inputs/json/samples/spotify-album.json
Mtypescript-zoddefault / TopLevel.ts+9 −9
| @@ -18,9 +18,9 @@ export const ExternalIdsSchema = z.object({ | ||
| 18 | 18 | export type ExternalIds = z.infer<typeof ExternalIdsSchema>; |
| 19 | 19 | |
| 20 | 20 | export const ImageSchema = z.object({ |
| 21 | - "height": z.number(), | |
| 21 | + "height": z.number().int(), | |
| 22 | 22 | "url": z.string(), |
| 23 | - "width": z.number(), | |
| 23 | + "width": z.number().int(), | |
| 24 | 24 | }); |
| 25 | 25 | export type Image = z.infer<typeof ImageSchema>; |
| 26 | 26 | |
| @@ -37,15 +37,15 @@ export type Artist = z.infer<typeof ArtistSchema>; | ||
| 37 | 37 | export const ItemSchema = z.object({ |
| 38 | 38 | "artists": z.array(ArtistSchema), |
| 39 | 39 | "available_markets": z.array(z.string()), |
| 40 | - "disc_number": z.number(), | |
| 41 | - "duration_ms": z.number(), | |
| 40 | + "disc_number": z.number().int(), | |
| 41 | + "duration_ms": z.number().int(), | |
| 42 | 42 | "explicit": z.boolean(), |
| 43 | 43 | "external_urls": ExternalUrlsSchema, |
| 44 | 44 | "href": z.string(), |
| 45 | 45 | "id": z.string(), |
| 46 | 46 | "name": z.string(), |
| 47 | 47 | "preview_url": z.string(), |
| 48 | - "track_number": z.number(), | |
| 48 | + "track_number": z.number().int(), | |
| 49 | 49 | "type": z.string(), |
| 50 | 50 | "uri": z.string(), |
| 51 | 51 | }); |
| @@ -54,11 +54,11 @@ export type Item = z.infer<typeof ItemSchema>; | ||
| 54 | 54 | export const TracksSchema = z.object({ |
| 55 | 55 | "href": z.string(), |
| 56 | 56 | "items": z.array(ItemSchema), |
| 57 | - "limit": z.number(), | |
| 57 | + "limit": z.number().int(), | |
| 58 | 58 | "next": z.null(), |
| 59 | - "offset": z.number(), | |
| 59 | + "offset": z.number().int(), | |
| 60 | 60 | "previous": z.null(), |
| 61 | - "total": z.number(), | |
| 61 | + "total": z.number().int(), | |
| 62 | 62 | }); |
| 63 | 63 | export type Tracks = z.infer<typeof TracksSchema>; |
| 64 | 64 | |
| @@ -74,7 +74,7 @@ export const TopLevelSchema = z.object({ | ||
| 74 | 74 | "id": z.string(), |
| 75 | 75 | "images": z.array(ImageSchema), |
| 76 | 76 | "name": z.string(), |
| 77 | - "popularity": z.number(), | |
| 77 | + "popularity": z.number().int(), | |
| 78 | 78 | "release_date": z.string(), |
| 79 | 79 | "release_date_precision": z.string(), |
| 80 | 80 | "tracks": TracksSchema, |
Test case
1 generated file · +1 −1test/inputs/json/samples/us-avg-temperatures.json
Mtypescript-zoddefault / TopLevel.ts+1 −1
| @@ -9,7 +9,7 @@ export type Datum = z.infer<typeof DatumSchema>; | ||
| 9 | 9 | |
| 10 | 10 | export const DescriptionSchema = z.object({ |
| 11 | 11 | "base_period": z.string(), |
| 12 | - "missing": z.number(), | |
| 12 | + "missing": z.number().int(), | |
| 13 | 13 | "title": z.string(), |
| 14 | 14 | "units": z.string(), |
| 15 | 15 | }); |
Test case
1 generated file · +5 −5test/inputs/json/samples/us-senators.json
Mtypescript-zoddefault / TopLevel.ts+5 −5
| @@ -79,9 +79,9 @@ export const TitleSchema = z.enum([ | ||
| 79 | 79 | export type Title = z.infer<typeof TitleSchema>; |
| 80 | 80 | |
| 81 | 81 | export const MetaSchema = z.object({ |
| 82 | - "limit": z.number(), | |
| 83 | - "offset": z.number(), | |
| 84 | - "total_count": z.number(), | |
| 82 | + "limit": z.number().int(), | |
| 83 | + "offset": z.number().int(), | |
| 84 | + "total_count": z.number().int(), | |
| 85 | 85 | }); |
| 86 | 86 | export type Meta = z.infer<typeof MetaSchema>; |
| 87 | 87 | |
| @@ -97,7 +97,7 @@ export type Extra = z.infer<typeof ExtraSchema>; | ||
| 97 | 97 | export const PersonSchema = z.object({ |
| 98 | 98 | "bioguideid": z.string(), |
| 99 | 99 | "birthday": z.string(), |
| 100 | - "cspanid": z.number(), | |
| 100 | + "cspanid": z.number().int(), | |
| 101 | 101 | "firstname": z.string(), |
| 102 | 102 | "gender": GenderSchema, |
| 103 | 103 | "gender_label": GenderLabelSchema, |
| @@ -117,7 +117,7 @@ export type Person = z.infer<typeof PersonSchema>; | ||
| 117 | 117 | |
| 118 | 118 | export const ObjectElementSchema = z.object({ |
| 119 | 119 | "caucus": z.union([z.null(), PartySchema]), |
| 120 | - "congress_numbers": z.array(z.number()), | |
| 120 | + "congress_numbers": z.array(z.number().int()), | |
| 121 | 121 | "current": z.boolean(), |
| 122 | 122 | "description": z.string(), |
| 123 | 123 | "district": z.null(), |
Test case
1 generated file · +1 −1test/inputs/schema/cut-enum.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,6 +2,6 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "foo": z.number(), | |
| 5 | + "foo": z.number().int(), | |
| 6 | 6 | }); |
| 7 | 7 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/schema/id-no-address.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,6 +2,6 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "item": z.number(), | |
| 5 | + "item": z.number().int(), | |
| 6 | 6 | }); |
| 7 | 7 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/schema/id-root.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,6 +2,6 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "bar": z.number(), | |
| 5 | + "bar": z.number().int(), | |
| 6 | 6 | }); |
| 7 | 7 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/schema/implicit-all-of.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "foo": z.number(), | |
| 5 | + "foo": z.number().int(), | |
| 6 | 6 | "bar": z.boolean(), |
| 7 | 7 | "quux": z.string(), |
| 8 | 8 | }); |
Test case
1 generated file · +1 −1test/inputs/schema/implicit-one-of.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "foo": z.number(), | |
| 5 | + "foo": z.number().int(), | |
| 6 | 6 | "bar": z.boolean().optional(), |
| 7 | 7 | "quux": z.string().optional(), |
| 8 | 8 | }); |
Test case
1 generated file · +2 −2test/inputs/schema/integer-string.schema
Mschema-typescript-zoddefault / TopLevel.ts+2 −2
| @@ -7,7 +7,7 @@ export const TopLevelSchema = z.object({ | ||
| 7 | 7 | "nullable": z.union([z.null(), z.string()]), |
| 8 | 8 | "one": z.string(), |
| 9 | 9 | "optional": z.string().optional(), |
| 10 | - "unionWithInt": z.union([z.number(), z.string()]), | |
| 11 | - "unionWithIntAndEnum": z.union([z.number(), z.string()]), | |
| 10 | + "unionWithInt": z.union([z.number().int(), z.string()]), | |
| 11 | + "unionWithIntAndEnum": z.union([z.number().int(), z.string()]), | |
| 12 | 12 | }); |
| 13 | 13 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +9 −9test/inputs/schema/integer-type.schema
Mschema-typescript-zoddefault / TopLevel.ts+9 −9
| @@ -2,14 +2,14 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "above_i32_max": z.number(), | |
| 6 | - "below_i32_min": z.number(), | |
| 7 | - "i32_range": z.number(), | |
| 8 | - "large_bounds": z.number(), | |
| 9 | - "only_maximum": z.number(), | |
| 10 | - "only_minimum": z.number(), | |
| 11 | - "small_negative": z.number(), | |
| 12 | - "small_positive": z.number(), | |
| 13 | - "unbounded": z.number(), | |
| 5 | + "above_i32_max": z.number().int(), | |
| 6 | + "below_i32_min": z.number().int(), | |
| 7 | + "i32_range": z.number().int(), | |
| 8 | + "large_bounds": z.number().int(), | |
| 9 | + "only_maximum": z.number().int(), | |
| 10 | + "only_minimum": z.number().int(), | |
| 11 | + "small_negative": z.number().int(), | |
| 12 | + "small_positive": z.number().int(), | |
| 13 | + "unbounded": z.number().int(), | |
| 14 | 14 | }); |
| 15 | 15 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/schema/issue2680-top-level-array.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | import * as z from "zod"; |
| 2 | 2 | |
| 3 | -export const TopLevelSchema = z.array(z.number()); | |
| 3 | +export const TopLevelSchema = z.array(z.number().int()); | |
| 4 | 4 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +2 −2test/inputs/schema/min-max-items.schema
Mschema-typescript-zoddefault / TopLevel.ts+2 −2
| @@ -2,10 +2,10 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "maxOnly": z.array(z.number()).max(3), | |
| 5 | + "maxOnly": z.array(z.number().int()).max(3), | |
| 6 | 6 | "minAndMax": z.array(z.number()).min(1).max(4), |
| 7 | 7 | "minOnly": z.array(z.string()).min(2), |
| 8 | 8 | "plain": z.array(z.string()), |
| 9 | - "unionItems": z.array(z.union([z.number(), z.string()])).min(2), | |
| 9 | + "unionItems": z.array(z.union([z.number().int(), z.string()])).min(2), | |
| 10 | 10 | }); |
| 11 | 11 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +8 −8test/inputs/schema/minmax-integer.schema
Mschema-typescript-zoddefault / TopLevel.ts+8 −8
| @@ -2,13 +2,13 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "free": z.number(), | |
| 6 | - "intersection": z.number(), | |
| 7 | - "max": z.number(), | |
| 8 | - "min": z.number(), | |
| 9 | - "minmax": z.number(), | |
| 10 | - "minMaxIntersection": z.number(), | |
| 11 | - "minMaxUnion": z.number(), | |
| 12 | - "union": z.number(), | |
| 5 | + "free": z.number().int(), | |
| 6 | + "intersection": z.number().int(), | |
| 7 | + "max": z.number().int(), | |
| 8 | + "min": z.number().int(), | |
| 9 | + "minmax": z.number().int(), | |
| 10 | + "minMaxIntersection": z.number().int(), | |
| 11 | + "minMaxUnion": z.number().int(), | |
| 12 | + "union": z.number().int(), | |
| 13 | 13 | }); |
| 14 | 14 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +2 −2test/inputs/schema/non-standard-ref.schema
Mschema-typescript-zoddefault / TopLevel.ts+2 −2
| @@ -2,8 +2,8 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "bar": z.number(), | |
| 6 | - "foo": z.number(), | |
| 5 | + "bar": z.number().int(), | |
| 6 | + "foo": z.number().int(), | |
| 7 | 7 | "quux": z.boolean(), |
| 8 | 8 | }); |
| 9 | 9 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +2 −2test/inputs/schema/optional-const-ref.schema
Mschema-typescript-zoddefault / TopLevel.ts+2 −2
| @@ -9,10 +9,10 @@ export type Coordinate = z.infer<typeof CoordinateSchema>; | ||
| 9 | 9 | |
| 10 | 10 | export const TopLevelSchema = z.object({ |
| 11 | 11 | "coordinates": z.array(CoordinateSchema).optional(), |
| 12 | - "count": z.number().optional(), | |
| 12 | + "count": z.number().int().optional(), | |
| 13 | 13 | "label": z.string().optional(), |
| 14 | 14 | "requiredCoordinates": z.array(CoordinateSchema), |
| 15 | - "requiredCount": z.number(), | |
| 15 | + "requiredCount": z.number().int(), | |
| 16 | 16 | "requiredLabel": z.string(), |
| 17 | 17 | "weight": z.number().optional(), |
| 18 | 18 | }); |
Test case
1 generated file · +2 −2test/inputs/schema/optional-constraints.schema
Mschema-typescript-zoddefault / TopLevel.ts+2 −2
| @@ -3,9 +3,9 @@ import * as z from "zod"; | ||
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | 5 | "optDouble": z.number().optional(), |
| 6 | - "optInt": z.number().optional(), | |
| 6 | + "optInt": z.number().int().optional(), | |
| 7 | 7 | "optPattern": z.string().optional(), |
| 8 | 8 | "optString": z.string().optional(), |
| 9 | - "reqZeroMin": z.number(), | |
| 9 | + "reqZeroMin": z.number().int(), | |
| 10 | 10 | }); |
| 11 | 11 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +2 −2test/inputs/schema/prefix-items.schema
Mschema-typescript-zoddefault / TopLevel.ts+2 −2
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "open": z.array(z.union([z.boolean(), z.number()])), | |
| 6 | - "tuple": z.array(z.union([z.boolean(), z.number()])), | |
| 5 | + "open": z.array(z.union([z.boolean(), z.number().int()])), | |
| 6 | + "tuple": z.array(z.union([z.boolean(), z.number().int()])), | |
| 7 | 7 | }); |
| 8 | 8 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/schema/ref-id-files.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,6 +2,6 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "foo": z.number(), | |
| 5 | + "foo": z.number().int(), | |
| 6 | 6 | }); |
| 7 | 7 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/schema/tuple.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,6 +2,6 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelSchema = z.object({ |
| 5 | - "tuple": z.array(z.union([z.boolean(), z.number()])), | |
| 5 | + "tuple": z.array(z.union([z.boolean(), z.number().int()])), | |
| 6 | 6 | }); |
| 7 | 7 | export type TopLevel = z.infer<typeof TopLevelSchema>; |
Test case
1 generated file · +1 −1test/inputs/schema/union.schema
Mschema-typescript-zoddefault / TopLevel.ts+1 −1
| @@ -2,7 +2,7 @@ import * as z from "zod"; | ||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | export const TopLevelElementSchema = z.object({ |
| 5 | - "one": z.number().optional(), | |
| 5 | + "one": z.number().int().optional(), | |
| 6 | 6 | "two": z.boolean(), |
| 7 | 7 | "three": z.number().optional(), |
| 8 | 8 | }); |
No generated files match these filters.