Test case
1 generated file · +1 −0test/inputs/graphql/github9.graphql
Mgraphql-pikedefault / TopLevel.pmod+1 −0
| @@ -134,6 +134,7 @@ class Reactable { | ||
| 134 | 134 | Reactable Reactable_from_JSON(mixed json) { |
| 135 | 135 | Reactable retval = Reactable(); |
| 136 | 136 | |
| 137 | + if (json["viewerCanReact"] != Standards.JSON.true && json["viewerCanReact"] != Standards.JSON.false) error("Expected bool"); | |
| 137 | 138 | retval.viewer_can_react = json["viewerCanReact"]; |
| 138 | 139 | if (!has_index(json, "reactionGroups")) error("Missing required property"); |
| 139 | 140 | retval.reaction_groups = json["reactionGroups"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/00ec5.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -251,6 +251,7 @@ Parameter Parameter_from_JSON(mixed json) { | ||
| 251 | 251 | retval.format = Type_from_JSON(json["format"]); |
| 252 | 252 | retval.in = json["in"]; |
| 253 | 253 | retval.name = json["name"]; |
| 254 | + if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 255 | retval.required = json["required"]; |
| 255 | 256 | retval.type = Type_from_JSON(json["type"]); |
Test case
1 generated file · +1 −0test/inputs/json/misc/0a358.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 44 | 44 | retval.limit = json["limit"]; |
| 45 | 45 | retval.next = json["next"]; |
| 46 | 46 | retval.offset = json["offset"]; |
| 47 | + if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool"); | |
| 47 | 48 | retval.previous = json["previous"]; |
| 48 | 49 | retval.results = json["results"]; |
Test case
1 generated file · +13 −0test/inputs/json/misc/0a91a.json
Mpikedefault / TopLevel.pmod+13 −0
| @@ -53,6 +53,7 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) { | ||
| 53 | 53 | retval.org = json["org"]; |
| 54 | 54 | retval.payload = json["payload"]; |
| 55 | 55 | retval.repo = json["repo"]; |
| 56 | + if (json["public"] != Standards.JSON.true && json["public"] != Standards.JSON.false) error("Expected bool"); | |
| 56 | 57 | retval.top_level_public = json["public"]; |
| 57 | 58 | retval.type = Type_from_JSON(json["type"]); |
| 58 | 59 | |
| @@ -177,6 +178,7 @@ Commit Commit_from_JSON(mixed json) { | ||
| 177 | 178 | Commit retval = Commit(); |
| 178 | 179 | |
| 179 | 180 | retval.author = json["author"]; |
| 181 | + if (json["distinct"] != Standards.JSON.true && json["distinct"] != Standards.JSON.false) error("Expected bool"); | |
| 180 | 182 | retval.distinct = json["distinct"]; |
| 181 | 183 | retval.message = json["message"]; |
| 182 | 184 | retval.sha = json["sha"]; |
| @@ -322,11 +324,14 @@ PullRequest PullRequest_from_JSON(mixed json) { | ||
| 322 | 324 | retval.id = json["id"]; |
| 323 | 325 | retval.issue_url = json["issue_url"]; |
| 324 | 326 | retval.links = json["_links"]; |
| 327 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 325 | 328 | retval.locked = json["locked"]; |
| 329 | + if (json["maintainer_can_modify"] != Standards.JSON.true && json["maintainer_can_modify"] != Standards.JSON.false) error("Expected bool"); | |
| 326 | 330 | retval.maintainer_can_modify = json["maintainer_can_modify"]; |
| 327 | 331 | retval.merge_commit_sha = json["merge_commit_sha"]; |
| 328 | 332 | retval.mergeable = json["mergeable"]; |
| 329 | 333 | retval.mergeable_state = json["mergeable_state"]; |
| 334 | + if (json["merged"] != Standards.JSON.true && json["merged"] != Standards.JSON.false) error("Expected bool"); | |
| 330 | 335 | retval.merged = json["merged"]; |
| 331 | 336 | retval.merged_at = json["merged_at"]; |
| 332 | 337 | retval.merged_by = json["merged_by"]; |
| @@ -548,6 +553,7 @@ BaseRepo BaseRepo_from_JSON(mixed json) { | ||
| 548 | 553 | retval.description = json["description"]; |
| 549 | 554 | retval.downloads_url = json["downloads_url"]; |
| 550 | 555 | retval.events_url = json["events_url"]; |
| 556 | + if (json["fork"] != Standards.JSON.true && json["fork"] != Standards.JSON.false) error("Expected bool"); | |
| 551 | 557 | retval.fork = json["fork"]; |
| 552 | 558 | retval.forks = json["forks"]; |
| 553 | 559 | retval.forks_count = json["forks_count"]; |
| @@ -557,10 +563,15 @@ BaseRepo BaseRepo_from_JSON(mixed json) { | ||
| 557 | 563 | retval.git_refs_url = json["git_refs_url"]; |
| 558 | 564 | retval.git_tags_url = json["git_tags_url"]; |
| 559 | 565 | retval.git_url = json["git_url"]; |
| 566 | + if (json["has_downloads"] != Standards.JSON.true && json["has_downloads"] != Standards.JSON.false) error("Expected bool"); | |
| 560 | 567 | retval.has_downloads = json["has_downloads"]; |
| 568 | + if (json["has_issues"] != Standards.JSON.true && json["has_issues"] != Standards.JSON.false) error("Expected bool"); | |
| 561 | 569 | retval.has_issues = json["has_issues"]; |
| 570 | + if (json["has_pages"] != Standards.JSON.true && json["has_pages"] != Standards.JSON.false) error("Expected bool"); | |
| 562 | 571 | retval.has_pages = json["has_pages"]; |
| 572 | + if (json["has_projects"] != Standards.JSON.true && json["has_projects"] != Standards.JSON.false) error("Expected bool"); | |
| 563 | 573 | retval.has_projects = json["has_projects"]; |
| 574 | + if (json["has_wiki"] != Standards.JSON.true && json["has_wiki"] != Standards.JSON.false) error("Expected bool"); | |
| 564 | 575 | retval.has_wiki = json["has_wiki"]; |
| 565 | 576 | retval.homepage = json["homepage"]; |
| 566 | 577 | retval.hooks_url = json["hooks_url"]; |
| @@ -584,6 +595,7 @@ BaseRepo BaseRepo_from_JSON(mixed json) { | ||
| 584 | 595 | retval.pulls_url = json["pulls_url"]; |
| 585 | 596 | retval.pushed_at = json["pushed_at"]; |
| 586 | 597 | retval.releases_url = json["releases_url"]; |
| 598 | + if (json["private"] != Standards.JSON.true && json["private"] != Standards.JSON.false) error("Expected bool"); | |
| 587 | 599 | retval.repo_private = json["private"]; |
| 588 | 600 | retval.size = json["size"]; |
| 589 | 601 | retval.ssh_url = json["ssh_url"]; |
| @@ -663,6 +675,7 @@ MergedBy MergedBy_from_JSON(mixed json) { | ||
| 663 | 675 | retval.organizations_url = json["organizations_url"]; |
| 664 | 676 | retval.received_events_url = json["received_events_url"]; |
| 665 | 677 | retval.repos_url = json["repos_url"]; |
| 678 | + if (json["site_admin"] != Standards.JSON.true && json["site_admin"] != Standards.JSON.false) error("Expected bool"); | |
| 666 | 679 | retval.site_admin = json["site_admin"]; |
| 667 | 680 | retval.starred_url = json["starred_url"]; |
| 668 | 681 | retval.subscriptions_url = json["subscriptions_url"]; |
Test case
1 generated file · +3 −0test/inputs/json/misc/0e0c2.json
Mpikedefault / TopLevel.pmod+3 −0
| @@ -199,8 +199,11 @@ class FavMovie { | ||
| 199 | 199 | FavMovie FavMovie_from_JSON(mixed json) { |
| 200 | 200 | FavMovie retval = FavMovie(); |
| 201 | 201 | |
| 202 | + if (json["follow"] != Standards.JSON.true && json["follow"] != Standards.JSON.false) error("Expected bool"); | |
| 202 | 203 | retval.follow = json["follow"]; |
| 204 | + if (json["star"] != Standards.JSON.true && json["star"] != Standards.JSON.false) error("Expected bool"); | |
| 203 | 205 | retval.star = json["star"]; |
| 206 | + if (json["watched"] != Standards.JSON.true && json["watched"] != Standards.JSON.false) error("Expected bool"); | |
| 204 | 207 | retval.watched = json["watched"]; |
| 205 | 208 | |
| 206 | 209 | return retval; |
Test case
1 generated file · +1 −0test/inputs/json/misc/1b409.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -118,6 +118,7 @@ Object Object_from_JSON(mixed json) { | ||
| 118 | 118 | |
| 119 | 119 | retval.caucus = json["caucus"]; |
| 120 | 120 | retval.congress_numbers = json["congress_numbers"]; |
| 121 | + if (json["current"] != Standards.JSON.true && json["current"] != Standards.JSON.false) error("Expected bool"); | |
| 121 | 122 | retval.current = json["current"]; |
| 122 | 123 | retval.description = json["description"]; |
| 123 | 124 | retval.district = json["district"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/2465e.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -278,6 +278,7 @@ Parameter Parameter_from_JSON(mixed json) { | ||
| 278 | 278 | retval.format = json["format"]; |
| 279 | 279 | retval.in = json["in"]; |
| 280 | 280 | retval.name = json["name"]; |
| 281 | + if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool"); | |
| 281 | 282 | retval.required = json["required"]; |
| 282 | 283 | retval.type = json["type"]; |
Test case
1 generated file · +8 −0test/inputs/json/misc/26c9c.json
Mpikedefault / TopLevel.pmod+8 −0
| @@ -161,18 +161,22 @@ View View_from_JSON(mixed json) { | ||
| 161 | 161 | retval.download_count = json["downloadCount"]; |
| 162 | 162 | retval.flags = json["flags"]; |
| 163 | 163 | retval.grants = json["grants"]; |
| 164 | + if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool"); | |
| 164 | 165 | retval.hide_from_catalog = json["hideFromCatalog"]; |
| 166 | + if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool"); | |
| 165 | 167 | retval.hide_from_data_json = json["hideFromDataJson"]; |
| 166 | 168 | retval.id = json["id"]; |
| 167 | 169 | retval.index_updated_at = json["indexUpdatedAt"]; |
| 168 | 170 | retval.locale = json["locale"]; |
| 169 | 171 | retval.metadata = json["metadata"]; |
| 170 | 172 | retval.name = json["name"]; |
| 173 | + if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool"); | |
| 171 | 174 | retval.new_backend = json["newBackend"]; |
| 172 | 175 | retval.number_of_comments = json["numberOfComments"]; |
| 173 | 176 | retval.oid = json["oid"]; |
| 174 | 177 | retval.owner = json["owner"]; |
| 175 | 178 | retval.provenance = json["provenance"]; |
| 179 | + if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool"); | |
| 176 | 180 | retval.publication_append_enabled = json["publicationAppendEnabled"]; |
| 177 | 181 | retval.publication_date = json["publicationDate"]; |
| 178 | 182 | retval.publication_group = json["publicationGroup"]; |
| @@ -352,6 +356,7 @@ Grant Grant_from_JSON(mixed json) { | ||
| 352 | 356 | Grant retval = Grant(); |
| 353 | 357 | |
| 354 | 358 | retval.flags = json["flags"]; |
| 359 | + if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool"); | |
| 355 | 360 | retval.inherited = json["inherited"]; |
| 356 | 361 | retval.type = json["type"]; |
| 357 | 362 | |
| @@ -624,6 +629,7 @@ class Order { | ||
| 624 | 629 | Order Order_from_JSON(mixed json) { |
| 625 | 630 | Order retval = Order(); |
| 626 | 631 | |
| 632 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 627 | 633 | retval.ascending = json["ascending"]; |
| 628 | 634 | retval.column_field_name = json["columnFieldName"]; |
| 629 | 635 | |
| @@ -665,6 +671,7 @@ class Visible { | ||
| 665 | 671 | Visible Visible_from_JSON(mixed json) { |
| 666 | 672 | Visible retval = Visible(); |
| 667 | 673 | |
| 674 | + if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool"); | |
| 668 | 675 | retval.table = json["table"]; |
| 669 | 676 | |
| 670 | 677 | return retval; |
| @@ -748,6 +755,7 @@ class OrderBy { | ||
| 748 | 755 | OrderBy OrderBy_from_JSON(mixed json) { |
| 749 | 756 | OrderBy retval = OrderBy(); |
| 750 | 757 | |
| 758 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 751 | 759 | retval.ascending = json["ascending"]; |
| 752 | 760 | retval.expression = json["expression"]; |
Test case
1 generated file · +19 −0test/inputs/json/misc/27332.json
Mpikedefault / TopLevel.pmod+19 −0
| @@ -230,6 +230,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 230 | 230 | |
| 231 | 231 | retval.approved_at_utc = json["approved_at_utc"]; |
| 232 | 232 | retval.approved_by = json["approved_by"]; |
| 233 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 233 | 234 | retval.archived = json["archived"]; |
| 234 | 235 | retval.author = json["author"]; |
| 235 | 236 | if (!has_index(json, "author_flair_css_class")) error("Missing required property"); |
| @@ -238,10 +239,15 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 238 | 239 | retval.author_flair_text = json["author_flair_text"]; |
| 239 | 240 | retval.banned_at_utc = json["banned_at_utc"]; |
| 240 | 241 | retval.banned_by = json["banned_by"]; |
| 242 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 241 | 243 | retval.brand_safe = json["brand_safe"]; |
| 244 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 242 | 245 | retval.can_gild = json["can_gild"]; |
| 246 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 243 | 247 | retval.can_mod_post = json["can_mod_post"]; |
| 248 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 244 | 249 | retval.clicked = json["clicked"]; |
| 250 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 245 | 251 | retval.contest_mode = json["contest_mode"]; |
| 246 | 252 | retval.created = (float)json["created"]; |
| 247 | 253 | retval.created_utc = (float)json["created_utc"]; |
| @@ -249,18 +255,24 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 249 | 255 | retval.distinguished = json["distinguished"]; |
| 250 | 256 | retval.domain = Domain_from_JSON(json["domain"]); |
| 251 | 257 | retval.downs = json["downs"]; |
| 258 | + if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool"); | |
| 252 | 259 | retval.edited = json["edited"]; |
| 253 | 260 | retval.gilded = json["gilded"]; |
| 261 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 262 | retval.hidden = json["hidden"]; |
| 263 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 255 | 264 | retval.hide_score = json["hide_score"]; |
| 256 | 265 | retval.id = json["id"]; |
| 266 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 257 | 267 | retval.is_self = json["is_self"]; |
| 268 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 258 | 269 | retval.is_video = json["is_video"]; |
| 259 | 270 | retval.likes = json["likes"]; |
| 260 | 271 | if (!has_index(json, "link_flair_css_class")) error("Missing required property"); |
| 261 | 272 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 262 | 273 | if (!has_index(json, "link_flair_text")) error("Missing required property"); |
| 263 | 274 | retval.link_flair_text = json["link_flair_text"]; |
| 275 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 264 | 276 | retval.locked = json["locked"]; |
| 265 | 277 | if (!has_index(json, "media")) error("Missing required property"); |
| 266 | 278 | retval.media = json["media"]; |
| @@ -269,13 +281,16 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 269 | 281 | retval.name = json["name"]; |
| 270 | 282 | retval.num_comments = json["num_comments"]; |
| 271 | 283 | retval.num_reports = json["num_reports"]; |
| 284 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 272 | 285 | retval.over_18 = json["over_18"]; |
| 273 | 286 | retval.permalink = json["permalink"]; |
| 274 | 287 | retval.post_hint = PostHint_from_JSON(json["post_hint"]); |
| 275 | 288 | retval.preview = json["preview"]; |
| 289 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 276 | 290 | retval.quarantine = json["quarantine"]; |
| 277 | 291 | retval.removal_reason = json["removal_reason"]; |
| 278 | 292 | retval.report_reasons = json["report_reasons"]; |
| 293 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 279 | 294 | retval.saved = json["saved"]; |
| 280 | 295 | retval.score = json["score"]; |
| 281 | 296 | if (!has_index(json, "secure_media")) error("Missing required property"); |
| @@ -284,7 +299,9 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 284 | 299 | retval.selftext = json["selftext"]; |
| 285 | 300 | if (!has_index(json, "selftext_html")) error("Missing required property"); |
| 286 | 301 | retval.selftext_html = json["selftext_html"]; |
| 302 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 287 | 303 | retval.spoiler = json["spoiler"]; |
| 304 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 288 | 305 | retval.stickied = json["stickied"]; |
| 289 | 306 | retval.subreddit = Subreddit_from_JSON(json["subreddit"]); |
| 290 | 307 | retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]); |
| @@ -301,6 +318,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 301 | 318 | retval.url = json["url"]; |
| 302 | 319 | retval.user_reports = json["user_reports"]; |
| 303 | 320 | retval.view_count = json["view_count"]; |
| 321 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 304 | 322 | retval.visited = json["visited"]; |
| 305 | 323 | |
| 306 | 324 | return retval; |
| @@ -448,6 +466,7 @@ class Preview { | ||
| 448 | 466 | Preview Preview_from_JSON(mixed json) { |
| 449 | 467 | Preview retval = Preview(); |
| 450 | 468 | |
| 469 | + if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool"); | |
| 451 | 470 | retval.enabled = json["enabled"]; |
| 452 | 471 | retval.images = json["images"]; |
Test case
1 generated file · +18 −0test/inputs/json/misc/29f47.json
Mpikedefault / TopLevel.pmod+18 −0
| @@ -230,16 +230,22 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 230 | 230 | |
| 231 | 231 | retval.approved_at_utc = json["approved_at_utc"]; |
| 232 | 232 | retval.approved_by = json["approved_by"]; |
| 233 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 233 | 234 | retval.archived = json["archived"]; |
| 234 | 235 | retval.author = json["author"]; |
| 235 | 236 | retval.author_flair_css_class = json["author_flair_css_class"]; |
| 236 | 237 | retval.author_flair_text = json["author_flair_text"]; |
| 237 | 238 | retval.banned_at_utc = json["banned_at_utc"]; |
| 238 | 239 | retval.banned_by = json["banned_by"]; |
| 240 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 239 | 241 | retval.brand_safe = json["brand_safe"]; |
| 242 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 240 | 243 | retval.can_gild = json["can_gild"]; |
| 244 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 241 | 245 | retval.can_mod_post = json["can_mod_post"]; |
| 246 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 242 | 247 | retval.clicked = json["clicked"]; |
| 248 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 243 | 249 | retval.contest_mode = json["contest_mode"]; |
| 244 | 250 | retval.created = (float)json["created"]; |
| 245 | 251 | retval.created_utc = (float)json["created_utc"]; |
| @@ -248,14 +254,19 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 248 | 254 | retval.downs = json["downs"]; |
| 249 | 255 | retval.edited = json["edited"]; |
| 250 | 256 | retval.gilded = json["gilded"]; |
| 257 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 251 | 258 | retval.hidden = json["hidden"]; |
| 259 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 252 | 260 | retval.hide_score = json["hide_score"]; |
| 253 | 261 | retval.id = json["id"]; |
| 262 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 263 | retval.is_self = json["is_self"]; |
| 264 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 255 | 265 | retval.is_video = json["is_video"]; |
| 256 | 266 | retval.likes = json["likes"]; |
| 257 | 267 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 258 | 268 | retval.link_flair_text = json["link_flair_text"]; |
| 269 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 259 | 270 | retval.locked = json["locked"]; |
| 260 | 271 | retval.media = json["media"]; |
| 261 | 272 | retval.media_embed = json["media_embed"]; |
| @@ -263,13 +274,16 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 263 | 274 | retval.name = json["name"]; |
| 264 | 275 | retval.num_comments = json["num_comments"]; |
| 265 | 276 | retval.num_reports = json["num_reports"]; |
| 277 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 266 | 278 | retval.over_18 = json["over_18"]; |
| 267 | 279 | retval.permalink = json["permalink"]; |
| 268 | 280 | retval.post_hint = PostHint_from_JSON(json["post_hint"]); |
| 269 | 281 | retval.preview = json["preview"]; |
| 282 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 270 | 283 | retval.quarantine = json["quarantine"]; |
| 271 | 284 | retval.removal_reason = json["removal_reason"]; |
| 272 | 285 | retval.report_reasons = json["report_reasons"]; |
| 286 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 273 | 287 | retval.saved = json["saved"]; |
| 274 | 288 | retval.score = json["score"]; |
| 275 | 289 | retval.secure_media = json["secure_media"]; |
| @@ -277,7 +291,9 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 277 | 291 | retval.selftext = json["selftext"]; |
| 278 | 292 | if (!has_index(json, "selftext_html")) error("Missing required property"); |
| 279 | 293 | retval.selftext_html = json["selftext_html"]; |
| 294 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 280 | 295 | retval.spoiler = json["spoiler"]; |
| 296 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 281 | 297 | retval.stickied = json["stickied"]; |
| 282 | 298 | retval.subreddit = Subreddit_from_JSON(json["subreddit"]); |
| 283 | 299 | retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]); |
| @@ -295,6 +311,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 295 | 311 | retval.url = json["url"]; |
| 296 | 312 | retval.user_reports = json["user_reports"]; |
| 297 | 313 | retval.view_count = json["view_count"]; |
| 314 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 298 | 315 | retval.visited = json["visited"]; |
| 299 | 316 | |
| 300 | 317 | return retval; |
| @@ -365,6 +382,7 @@ class Preview { | ||
| 365 | 382 | Preview Preview_from_JSON(mixed json) { |
| 366 | 383 | Preview retval = Preview(); |
| 367 | 384 | |
| 385 | + if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool"); | |
| 368 | 386 | retval.enabled = json["enabled"]; |
| 369 | 387 | retval.images = json["images"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/2d4e2.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -123,6 +123,7 @@ Object Object_from_JSON(mixed json) { | ||
| 123 | 123 | if (!has_index(json, "caucus")) error("Missing required property"); |
| 124 | 124 | retval.caucus = Party_from_JSON(json["caucus"]); |
| 125 | 125 | retval.congress_numbers = json["congress_numbers"]; |
| 126 | + if (json["current"] != Standards.JSON.true && json["current"] != Standards.JSON.false) error("Expected bool"); | |
| 126 | 127 | retval.current = json["current"]; |
| 127 | 128 | retval.description = json["description"]; |
| 128 | 129 | retval.district = json["district"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/32d5c.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -49,6 +49,7 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) { | ||
| 49 | 49 | |
| 50 | 50 | if (!has_index(json, "BirthDate")) error("Missing required property"); |
| 51 | 51 | retval.birth_date = json["BirthDate"]; |
| 52 | + if (json["BirthDateIsProtected"] != Standards.JSON.true && json["BirthDateIsProtected"] != Standards.JSON.false) error("Expected bool"); | |
| 52 | 53 | retval.birth_date_is_protected = json["BirthDateIsProtected"]; |
| 53 | 54 | retval.gender_type_id = json["GenderTypeID"]; |
| 54 | 55 | retval.notes = json["Notes"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/337ed.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 44 | 44 | retval.limit = json["limit"]; |
| 45 | 45 | retval.next = json["next"]; |
| 46 | 46 | retval.offset = json["offset"]; |
| 47 | + if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool"); | |
| 47 | 48 | retval.previous = json["previous"]; |
| 48 | 49 | retval.results = json["results"]; |
Test case
1 generated file · +6 −0test/inputs/json/misc/421d4.json
Mpikedefault / TopLevel.pmod+6 −0
| @@ -164,7 +164,9 @@ View View_from_JSON(mixed json) { | ||
| 164 | 164 | retval.download_count = json["downloadCount"]; |
| 165 | 165 | retval.flags = json["flags"]; |
| 166 | 166 | retval.grants = json["grants"]; |
| 167 | + if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool"); | |
| 167 | 168 | retval.hide_from_catalog = json["hideFromCatalog"]; |
| 169 | + if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool"); | |
| 168 | 170 | retval.hide_from_data_json = json["hideFromDataJson"]; |
| 169 | 171 | retval.id = json["id"]; |
| 170 | 172 | retval.index_updated_at = json["indexUpdatedAt"]; |
| @@ -173,11 +175,13 @@ View View_from_JSON(mixed json) { | ||
| 173 | 175 | retval.locale = json["locale"]; |
| 174 | 176 | retval.metadata = json["metadata"]; |
| 175 | 177 | retval.name = json["name"]; |
| 178 | + if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool"); | |
| 176 | 179 | retval.new_backend = json["newBackend"]; |
| 177 | 180 | retval.number_of_comments = json["numberOfComments"]; |
| 178 | 181 | retval.oid = json["oid"]; |
| 179 | 182 | retval.owner = json["owner"]; |
| 180 | 183 | retval.provenance = json["provenance"]; |
| 184 | + if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool"); | |
| 181 | 185 | retval.publication_append_enabled = json["publicationAppendEnabled"]; |
| 182 | 186 | retval.publication_date = json["publicationDate"]; |
| 183 | 187 | retval.publication_group = json["publicationGroup"]; |
| @@ -345,6 +349,7 @@ Grant Grant_from_JSON(mixed json) { | ||
| 345 | 349 | Grant retval = Grant(); |
| 346 | 350 | |
| 347 | 351 | retval.flags = json["flags"]; |
| 352 | + if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool"); | |
| 348 | 353 | retval.inherited = json["inherited"]; |
| 349 | 354 | retval.type = json["type"]; |
| 350 | 355 | |
| @@ -438,6 +443,7 @@ class Visible { | ||
| 438 | 443 | Visible Visible_from_JSON(mixed json) { |
| 439 | 444 | Visible retval = Visible(); |
| 440 | 445 | |
| 446 | + if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool"); | |
| 441 | 447 | retval.table = json["table"]; |
| 442 | 448 | |
| 443 | 449 | return retval; |
Test case
1 generated file · +19 −0test/inputs/json/misc/4d6fb.json
Mpikedefault / TopLevel.pmod+19 −0
| @@ -230,32 +230,44 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 230 | 230 | |
| 231 | 231 | retval.approved_at_utc = json["approved_at_utc"]; |
| 232 | 232 | retval.approved_by = json["approved_by"]; |
| 233 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 233 | 234 | retval.archived = json["archived"]; |
| 234 | 235 | retval.author = json["author"]; |
| 235 | 236 | retval.author_flair_css_class = json["author_flair_css_class"]; |
| 236 | 237 | retval.author_flair_text = json["author_flair_text"]; |
| 237 | 238 | retval.banned_at_utc = json["banned_at_utc"]; |
| 238 | 239 | retval.banned_by = json["banned_by"]; |
| 240 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 239 | 241 | retval.brand_safe = json["brand_safe"]; |
| 242 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 240 | 243 | retval.can_gild = json["can_gild"]; |
| 244 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 241 | 245 | retval.can_mod_post = json["can_mod_post"]; |
| 246 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 242 | 247 | retval.clicked = json["clicked"]; |
| 248 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 243 | 249 | retval.contest_mode = json["contest_mode"]; |
| 244 | 250 | retval.created = (float)json["created"]; |
| 245 | 251 | retval.created_utc = (float)json["created_utc"]; |
| 246 | 252 | retval.distinguished = json["distinguished"]; |
| 247 | 253 | retval.domain = json["domain"]; |
| 248 | 254 | retval.downs = json["downs"]; |
| 255 | + if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool"); | |
| 249 | 256 | retval.edited = json["edited"]; |
| 250 | 257 | retval.gilded = json["gilded"]; |
| 258 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 251 | 259 | retval.hidden = json["hidden"]; |
| 260 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 252 | 261 | retval.hide_score = json["hide_score"]; |
| 253 | 262 | retval.id = json["id"]; |
| 263 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 264 | retval.is_self = json["is_self"]; |
| 265 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 255 | 266 | retval.is_video = json["is_video"]; |
| 256 | 267 | retval.likes = json["likes"]; |
| 257 | 268 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 258 | 269 | retval.link_flair_text = json["link_flair_text"]; |
| 270 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 259 | 271 | retval.locked = json["locked"]; |
| 260 | 272 | if (!has_index(json, "media")) error("Missing required property"); |
| 261 | 273 | retval.media = json["media"]; |
| @@ -264,13 +276,16 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 264 | 276 | retval.name = json["name"]; |
| 265 | 277 | retval.num_comments = json["num_comments"]; |
| 266 | 278 | retval.num_reports = json["num_reports"]; |
| 279 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 267 | 280 | retval.over_18 = json["over_18"]; |
| 268 | 281 | retval.permalink = json["permalink"]; |
| 269 | 282 | retval.post_hint = PostHint_from_JSON(json["post_hint"]); |
| 270 | 283 | retval.preview = json["preview"]; |
| 284 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 271 | 285 | retval.quarantine = json["quarantine"]; |
| 272 | 286 | retval.removal_reason = json["removal_reason"]; |
| 273 | 287 | retval.report_reasons = json["report_reasons"]; |
| 288 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 274 | 289 | retval.saved = json["saved"]; |
| 275 | 290 | retval.score = json["score"]; |
| 276 | 291 | if (!has_index(json, "secure_media")) error("Missing required property"); |
| @@ -278,7 +293,9 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 278 | 293 | retval.secure_media_embed = json["secure_media_embed"]; |
| 279 | 294 | retval.selftext = json["selftext"]; |
| 280 | 295 | retval.selftext_html = json["selftext_html"]; |
| 296 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 281 | 297 | retval.spoiler = json["spoiler"]; |
| 298 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 282 | 299 | retval.stickied = json["stickied"]; |
| 283 | 300 | retval.subreddit = Subreddit_from_JSON(json["subreddit"]); |
| 284 | 301 | retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]); |
| @@ -295,6 +312,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 295 | 312 | retval.url = json["url"]; |
| 296 | 313 | retval.user_reports = json["user_reports"]; |
| 297 | 314 | retval.view_count = json["view_count"]; |
| 315 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 298 | 316 | retval.visited = json["visited"]; |
| 299 | 317 | |
| 300 | 318 | return retval; |
| @@ -434,6 +452,7 @@ class Preview { | ||
| 434 | 452 | Preview Preview_from_JSON(mixed json) { |
| 435 | 453 | Preview retval = Preview(); |
| 436 | 454 | |
| 455 | + if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool"); | |
| 437 | 456 | retval.enabled = json["enabled"]; |
| 438 | 457 | retval.images = json["images"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/54d32.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 44 | 44 | retval.limit = json["limit"]; |
| 45 | 45 | retval.next = json["next"]; |
| 46 | 46 | retval.offset = json["offset"]; |
| 47 | + if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool"); | |
| 47 | 48 | retval.previous = json["previous"]; |
| 48 | 49 | retval.results = json["results"]; |
Test case
1 generated file · +8 −0test/inputs/json/misc/5f7fe.json
Mpikedefault / TopLevel.pmod+8 −0
| @@ -161,18 +161,22 @@ View View_from_JSON(mixed json) { | ||
| 161 | 161 | retval.download_count = json["downloadCount"]; |
| 162 | 162 | retval.flags = json["flags"]; |
| 163 | 163 | retval.grants = json["grants"]; |
| 164 | + if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool"); | |
| 164 | 165 | retval.hide_from_catalog = json["hideFromCatalog"]; |
| 166 | + if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool"); | |
| 165 | 167 | retval.hide_from_data_json = json["hideFromDataJson"]; |
| 166 | 168 | retval.id = json["id"]; |
| 167 | 169 | retval.index_updated_at = json["indexUpdatedAt"]; |
| 168 | 170 | retval.locale = json["locale"]; |
| 169 | 171 | retval.metadata = json["metadata"]; |
| 170 | 172 | retval.name = json["name"]; |
| 173 | + if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool"); | |
| 171 | 174 | retval.new_backend = json["newBackend"]; |
| 172 | 175 | retval.number_of_comments = json["numberOfComments"]; |
| 173 | 176 | retval.oid = json["oid"]; |
| 174 | 177 | retval.owner = json["owner"]; |
| 175 | 178 | retval.provenance = json["provenance"]; |
| 179 | + if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool"); | |
| 176 | 180 | retval.publication_append_enabled = json["publicationAppendEnabled"]; |
| 177 | 181 | retval.publication_date = json["publicationDate"]; |
| 178 | 182 | retval.publication_group = json["publicationGroup"]; |
| @@ -350,6 +354,7 @@ Grant Grant_from_JSON(mixed json) { | ||
| 350 | 354 | Grant retval = Grant(); |
| 351 | 355 | |
| 352 | 356 | retval.flags = json["flags"]; |
| 357 | + if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool"); | |
| 353 | 358 | retval.inherited = json["inherited"]; |
| 354 | 359 | retval.type = json["type"]; |
| 355 | 360 | |
| @@ -622,6 +627,7 @@ class Order { | ||
| 622 | 627 | Order Order_from_JSON(mixed json) { |
| 623 | 628 | Order retval = Order(); |
| 624 | 629 | |
| 630 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 625 | 631 | retval.ascending = json["ascending"]; |
| 626 | 632 | retval.column_field_name = json["columnFieldName"]; |
| 627 | 633 | |
| @@ -663,6 +669,7 @@ class Visible { | ||
| 663 | 669 | Visible Visible_from_JSON(mixed json) { |
| 664 | 670 | Visible retval = Visible(); |
| 665 | 671 | |
| 672 | + if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool"); | |
| 666 | 673 | retval.table = json["table"]; |
| 667 | 674 | |
| 668 | 675 | return retval; |
| @@ -746,6 +753,7 @@ class OrderBy { | ||
| 746 | 753 | OrderBy OrderBy_from_JSON(mixed json) { |
| 747 | 754 | OrderBy retval = OrderBy(); |
| 748 | 755 | |
| 756 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 749 | 757 | retval.ascending = json["ascending"]; |
| 750 | 758 | retval.expression = json["expression"]; |
Test case
1 generated file · +8 −0test/inputs/json/misc/617e8.json
Mpikedefault / TopLevel.pmod+8 −0
| @@ -161,18 +161,22 @@ View View_from_JSON(mixed json) { | ||
| 161 | 161 | retval.download_count = json["downloadCount"]; |
| 162 | 162 | retval.flags = json["flags"]; |
| 163 | 163 | retval.grants = json["grants"]; |
| 164 | + if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool"); | |
| 164 | 165 | retval.hide_from_catalog = json["hideFromCatalog"]; |
| 166 | + if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool"); | |
| 165 | 167 | retval.hide_from_data_json = json["hideFromDataJson"]; |
| 166 | 168 | retval.id = json["id"]; |
| 167 | 169 | retval.index_updated_at = json["indexUpdatedAt"]; |
| 168 | 170 | retval.locale = json["locale"]; |
| 169 | 171 | retval.metadata = json["metadata"]; |
| 170 | 172 | retval.name = json["name"]; |
| 173 | + if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool"); | |
| 171 | 174 | retval.new_backend = json["newBackend"]; |
| 172 | 175 | retval.number_of_comments = json["numberOfComments"]; |
| 173 | 176 | retval.oid = json["oid"]; |
| 174 | 177 | retval.owner = json["owner"]; |
| 175 | 178 | retval.provenance = json["provenance"]; |
| 179 | + if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool"); | |
| 176 | 180 | retval.publication_append_enabled = json["publicationAppendEnabled"]; |
| 177 | 181 | retval.publication_date = json["publicationDate"]; |
| 178 | 182 | retval.publication_group = json["publicationGroup"]; |
| @@ -353,6 +357,7 @@ Grant Grant_from_JSON(mixed json) { | ||
| 353 | 357 | Grant retval = Grant(); |
| 354 | 358 | |
| 355 | 359 | retval.flags = json["flags"]; |
| 360 | + if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool"); | |
| 356 | 361 | retval.inherited = json["inherited"]; |
| 357 | 362 | retval.type = json["type"]; |
| 358 | 363 | |
| @@ -619,6 +624,7 @@ class Order { | ||
| 619 | 624 | Order Order_from_JSON(mixed json) { |
| 620 | 625 | Order retval = Order(); |
| 621 | 626 | |
| 627 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 622 | 628 | retval.ascending = json["ascending"]; |
| 623 | 629 | retval.column_field_name = json["columnFieldName"]; |
| 624 | 630 | |
| @@ -660,6 +666,7 @@ class Visible { | ||
| 660 | 666 | Visible Visible_from_JSON(mixed json) { |
| 661 | 667 | Visible retval = Visible(); |
| 662 | 668 | |
| 669 | + if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool"); | |
| 663 | 670 | retval.table = json["table"]; |
| 664 | 671 | |
| 665 | 672 | return retval; |
| @@ -743,6 +750,7 @@ class OrderBy { | ||
| 743 | 750 | OrderBy OrderBy_from_JSON(mixed json) { |
| 744 | 751 | OrderBy retval = OrderBy(); |
| 745 | 752 | |
| 753 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 746 | 754 | retval.ascending = json["ascending"]; |
| 747 | 755 | retval.expression = json["expression"]; |
Test case
1 generated file · +2 −0test/inputs/json/misc/68c30.json
Mpikedefault / TopLevel.pmod+2 −0
| @@ -69,6 +69,7 @@ class Tx { | ||
| 69 | 69 | Tx Tx_from_JSON(mixed json) { |
| 70 | 70 | Tx retval = Tx(); |
| 71 | 71 | |
| 72 | + if (json["double_spend"] != Standards.JSON.true && json["double_spend"] != Standards.JSON.false) error("Expected bool"); | |
| 72 | 73 | retval.double_spend = json["double_spend"]; |
| 73 | 74 | retval.hash = json["hash"]; |
| 74 | 75 | retval.inputs = json["inputs"]; |
| @@ -141,6 +142,7 @@ Out Out_from_JSON(mixed json) { | ||
| 141 | 142 | retval.addr = json["addr"]; |
| 142 | 143 | retval.n = json["n"]; |
| 143 | 144 | retval.script = json["script"]; |
| 145 | + if (json["spent"] != Standards.JSON.true && json["spent"] != Standards.JSON.false) error("Expected bool"); | |
| 144 | 146 | retval.spent = json["spent"]; |
| 145 | 147 | retval.tx_index = json["tx_index"]; |
| 146 | 148 | retval.type = json["type"]; |
Test case
1 generated file · +19 −0test/inputs/json/misc/6de06.json
Mpikedefault / TopLevel.pmod+19 −0
| @@ -230,6 +230,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 230 | 230 | |
| 231 | 231 | retval.approved_at_utc = json["approved_at_utc"]; |
| 232 | 232 | retval.approved_by = json["approved_by"]; |
| 233 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 233 | 234 | retval.archived = json["archived"]; |
| 234 | 235 | retval.author = json["author"]; |
| 235 | 236 | if (!has_index(json, "author_flair_css_class")) error("Missing required property"); |
| @@ -238,28 +239,39 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 238 | 239 | retval.author_flair_text = json["author_flair_text"]; |
| 239 | 240 | retval.banned_at_utc = json["banned_at_utc"]; |
| 240 | 241 | retval.banned_by = json["banned_by"]; |
| 242 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 241 | 243 | retval.brand_safe = json["brand_safe"]; |
| 244 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 242 | 245 | retval.can_gild = json["can_gild"]; |
| 246 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 243 | 247 | retval.can_mod_post = json["can_mod_post"]; |
| 248 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 244 | 249 | retval.clicked = json["clicked"]; |
| 250 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 245 | 251 | retval.contest_mode = json["contest_mode"]; |
| 246 | 252 | retval.created = (float)json["created"]; |
| 247 | 253 | retval.created_utc = (float)json["created_utc"]; |
| 248 | 254 | retval.distinguished = json["distinguished"]; |
| 249 | 255 | retval.domain = json["domain"]; |
| 250 | 256 | retval.downs = json["downs"]; |
| 257 | + if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool"); | |
| 251 | 258 | retval.edited = json["edited"]; |
| 252 | 259 | retval.gilded = json["gilded"]; |
| 260 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 253 | 261 | retval.hidden = json["hidden"]; |
| 262 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 263 | retval.hide_score = json["hide_score"]; |
| 255 | 264 | retval.id = json["id"]; |
| 265 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 256 | 266 | retval.is_self = json["is_self"]; |
| 267 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 257 | 268 | retval.is_video = json["is_video"]; |
| 258 | 269 | retval.likes = json["likes"]; |
| 259 | 270 | if (!has_index(json, "link_flair_css_class")) error("Missing required property"); |
| 260 | 271 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 261 | 272 | if (!has_index(json, "link_flair_text")) error("Missing required property"); |
| 262 | 273 | retval.link_flair_text = json["link_flair_text"]; |
| 274 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 263 | 275 | retval.locked = json["locked"]; |
| 264 | 276 | if (!has_index(json, "media")) error("Missing required property"); |
| 265 | 277 | retval.media = json["media"]; |
| @@ -268,13 +280,16 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 268 | 280 | retval.name = json["name"]; |
| 269 | 281 | retval.num_comments = json["num_comments"]; |
| 270 | 282 | retval.num_reports = json["num_reports"]; |
| 283 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 271 | 284 | retval.over_18 = json["over_18"]; |
| 272 | 285 | retval.permalink = json["permalink"]; |
| 273 | 286 | retval.post_hint = PostHint_from_JSON(json["post_hint"]); |
| 274 | 287 | retval.preview = json["preview"]; |
| 288 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 275 | 289 | retval.quarantine = json["quarantine"]; |
| 276 | 290 | retval.removal_reason = json["removal_reason"]; |
| 277 | 291 | retval.report_reasons = json["report_reasons"]; |
| 292 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 278 | 293 | retval.saved = json["saved"]; |
| 279 | 294 | retval.score = json["score"]; |
| 280 | 295 | if (!has_index(json, "secure_media")) error("Missing required property"); |
| @@ -283,7 +298,9 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 283 | 298 | retval.selftext = json["selftext"]; |
| 284 | 299 | if (!has_index(json, "selftext_html")) error("Missing required property"); |
| 285 | 300 | retval.selftext_html = json["selftext_html"]; |
| 301 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 286 | 302 | retval.spoiler = json["spoiler"]; |
| 303 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 287 | 304 | retval.stickied = json["stickied"]; |
| 288 | 305 | retval.subreddit = json["subreddit"]; |
| 289 | 306 | retval.subreddit_id = json["subreddit_id"]; |
| @@ -301,6 +318,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 301 | 318 | retval.url = json["url"]; |
| 302 | 319 | retval.user_reports = json["user_reports"]; |
| 303 | 320 | retval.view_count = json["view_count"]; |
| 321 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 304 | 322 | retval.visited = json["visited"]; |
| 305 | 323 | |
| 306 | 324 | return retval; |
| @@ -438,6 +456,7 @@ class Preview { | ||
| 438 | 456 | Preview Preview_from_JSON(mixed json) { |
| 439 | 457 | Preview retval = Preview(); |
| 440 | 458 | |
| 459 | + if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool"); | |
| 441 | 460 | retval.enabled = json["enabled"]; |
| 442 | 461 | retval.images = json["images"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/734ad.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 44 | 44 | retval.limit = json["limit"]; |
| 45 | 45 | retval.next = json["next"]; |
| 46 | 46 | retval.offset = json["offset"]; |
| 47 | + if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool"); | |
| 47 | 48 | retval.previous = json["previous"]; |
| 48 | 49 | retval.results = json["results"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/76ae1.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -570,6 +570,7 @@ Parameter Parameter_from_JSON(mixed json) { | ||
| 570 | 570 | retval.format = FormatEnum_from_JSON(json["format"]); |
| 571 | 571 | retval.in = In_from_JSON(json["in"]); |
| 572 | 572 | retval.name = json["name"]; |
| 573 | + if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool"); | |
| 573 | 574 | retval.required = json["required"]; |
| 574 | 575 | retval.type = FormatEnum_from_JSON(json["type"]); |
Test case
1 generated file · +1 −0test/inputs/json/misc/7d397.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -251,6 +251,7 @@ Parameter Parameter_from_JSON(mixed json) { | ||
| 251 | 251 | retval.format = Type_from_JSON(json["format"]); |
| 252 | 252 | retval.in = In_from_JSON(json["in"]); |
| 253 | 253 | retval.name = json["name"]; |
| 254 | + if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 255 | retval.required = json["required"]; |
| 255 | 256 | retval.type = Type_from_JSON(json["type"]); |
Test case
1 generated file · +1 −0test/inputs/json/misc/7eb30.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -84,6 +84,7 @@ Result Result_from_JSON(mixed json) { | ||
| 84 | 84 | |
| 85 | 85 | retval.code = json["code"]; |
| 86 | 86 | retval.english = json["english"]; |
| 87 | + if (json["fav"] != Standards.JSON.true && json["fav"] != Standards.JSON.false) error("Expected bool"); | |
| 87 | 88 | retval.fav = json["fav"]; |
| 88 | 89 | retval.group = json["group"]; |
| 89 | 90 | retval.location = Location_from_JSON(json["location"]); |
Test case
1 generated file · +2 −0test/inputs/json/misc/7f568.json
Mpikedefault / TopLevel.pmod+2 −0
| @@ -75,7 +75,9 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) { | ||
| 75 | 75 | retval.git_push_url = json["git_push_url"]; |
| 76 | 76 | retval.html_url = json["html_url"]; |
| 77 | 77 | retval.id = json["id"]; |
| 78 | + if (json["public"] != Standards.JSON.true && json["public"] != Standards.JSON.false) error("Expected bool"); | |
| 78 | 79 | retval.top_level_public = json["public"]; |
| 80 | + if (json["truncated"] != Standards.JSON.true && json["truncated"] != Standards.JSON.false) error("Expected bool"); | |
| 79 | 81 | retval.truncated = json["truncated"]; |
| 80 | 82 | retval.updated_at = json["updated_at"]; |
| 81 | 83 | retval.url = json["url"]; |
Test case
1 generated file · +2 −0test/inputs/json/misc/80aff.json
Mpikedefault / TopLevel.pmod+2 −0
| @@ -42,8 +42,10 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 42 | 42 | retval.count = json["count"]; |
| 43 | 43 | retval.facets = json["facets"]; |
| 44 | 44 | retval.limit = json["limit"]; |
| 45 | + if (json["next"] != Standards.JSON.true && json["next"] != Standards.JSON.false) error("Expected bool"); | |
| 45 | 46 | retval.next = json["next"]; |
| 46 | 47 | retval.offset = json["offset"]; |
| 48 | + if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool"); | |
| 47 | 49 | retval.previous = json["previous"]; |
| 48 | 50 | retval.results = json["results"]; |
Test case
1 generated file · +19 −0test/inputs/json/misc/8592b.json
Mpikedefault / TopLevel.pmod+19 −0
| @@ -230,6 +230,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 230 | 230 | |
| 231 | 231 | retval.approved_at_utc = json["approved_at_utc"]; |
| 232 | 232 | retval.approved_by = json["approved_by"]; |
| 233 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 233 | 234 | retval.archived = json["archived"]; |
| 234 | 235 | retval.author = json["author"]; |
| 235 | 236 | if (!has_index(json, "author_flair_css_class")) error("Missing required property"); |
| @@ -238,26 +239,37 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 238 | 239 | retval.author_flair_text = json["author_flair_text"]; |
| 239 | 240 | retval.banned_at_utc = json["banned_at_utc"]; |
| 240 | 241 | retval.banned_by = json["banned_by"]; |
| 242 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 241 | 243 | retval.brand_safe = json["brand_safe"]; |
| 244 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 242 | 245 | retval.can_gild = json["can_gild"]; |
| 246 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 243 | 247 | retval.can_mod_post = json["can_mod_post"]; |
| 248 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 244 | 249 | retval.clicked = json["clicked"]; |
| 250 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 245 | 251 | retval.contest_mode = json["contest_mode"]; |
| 246 | 252 | retval.created = (float)json["created"]; |
| 247 | 253 | retval.created_utc = (float)json["created_utc"]; |
| 248 | 254 | retval.distinguished = json["distinguished"]; |
| 249 | 255 | retval.domain = json["domain"]; |
| 250 | 256 | retval.downs = json["downs"]; |
| 257 | + if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool"); | |
| 251 | 258 | retval.edited = json["edited"]; |
| 252 | 259 | retval.gilded = json["gilded"]; |
| 260 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 253 | 261 | retval.hidden = json["hidden"]; |
| 262 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 263 | retval.hide_score = json["hide_score"]; |
| 255 | 264 | retval.id = json["id"]; |
| 265 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 256 | 266 | retval.is_self = json["is_self"]; |
| 267 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 257 | 268 | retval.is_video = json["is_video"]; |
| 258 | 269 | retval.likes = json["likes"]; |
| 259 | 270 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 260 | 271 | retval.link_flair_text = json["link_flair_text"]; |
| 272 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 261 | 273 | retval.locked = json["locked"]; |
| 262 | 274 | retval.media = json["media"]; |
| 263 | 275 | retval.media_embed = json["media_embed"]; |
| @@ -265,13 +277,16 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 265 | 277 | retval.name = json["name"]; |
| 266 | 278 | retval.num_comments = json["num_comments"]; |
| 267 | 279 | retval.num_reports = json["num_reports"]; |
| 280 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 268 | 281 | retval.over_18 = json["over_18"]; |
| 269 | 282 | retval.permalink = json["permalink"]; |
| 270 | 283 | retval.post_hint = PostHint_from_JSON(json["post_hint"]); |
| 271 | 284 | retval.preview = json["preview"]; |
| 285 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 272 | 286 | retval.quarantine = json["quarantine"]; |
| 273 | 287 | retval.removal_reason = json["removal_reason"]; |
| 274 | 288 | retval.report_reasons = json["report_reasons"]; |
| 289 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 275 | 290 | retval.saved = json["saved"]; |
| 276 | 291 | retval.score = json["score"]; |
| 277 | 292 | retval.secure_media = json["secure_media"]; |
| @@ -279,7 +294,9 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 279 | 294 | retval.selftext = json["selftext"]; |
| 280 | 295 | if (!has_index(json, "selftext_html")) error("Missing required property"); |
| 281 | 296 | retval.selftext_html = json["selftext_html"]; |
| 297 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 282 | 298 | retval.spoiler = json["spoiler"]; |
| 299 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 283 | 300 | retval.stickied = json["stickied"]; |
| 284 | 301 | retval.subreddit = Subreddit_from_JSON(json["subreddit"]); |
| 285 | 302 | retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]); |
| @@ -296,6 +313,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 296 | 313 | retval.url = json["url"]; |
| 297 | 314 | retval.user_reports = json["user_reports"]; |
| 298 | 315 | retval.view_count = json["view_count"]; |
| 316 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 299 | 317 | retval.visited = json["visited"]; |
| 300 | 318 | |
| 301 | 319 | return retval; |
| @@ -342,6 +360,7 @@ class Preview { | ||
| 342 | 360 | Preview Preview_from_JSON(mixed json) { |
| 343 | 361 | Preview retval = Preview(); |
| 344 | 362 | |
| 363 | + if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool"); | |
| 345 | 364 | retval.enabled = json["enabled"]; |
| 346 | 365 | retval.images = json["images"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/96f7c.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -42,6 +42,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 42 | 42 | retval.hooks = json["hooks"]; |
| 43 | 43 | retval.importer = json["importer"]; |
| 44 | 44 | retval.pages = json["pages"]; |
| 45 | + if (json["verifiable_password_authentication"] != Standards.JSON.true && json["verifiable_password_authentication"] != Standards.JSON.false) error("Expected bool"); | |
| 45 | 46 | retval.verifiable_password_authentication = json["verifiable_password_authentication"]; |
| 46 | 47 | |
| 47 | 48 | return retval; |
Test case
1 generated file · +1 −0test/inputs/json/misc/9ac3b.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 44 | 44 | retval.limit = json["limit"]; |
| 45 | 45 | retval.next = json["next"]; |
| 46 | 46 | retval.offset = json["offset"]; |
| 47 | + if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool"); | |
| 47 | 48 | retval.previous = json["previous"]; |
| 48 | 49 | retval.results = json["results"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/a0496.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -69,6 +69,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 69 | 69 | retval.from_date = json["from_date"]; |
| 70 | 70 | retval.id = json["id"]; |
| 71 | 71 | retval.name = json["name"]; |
| 72 | + if (json["premium"] != Standards.JSON.true && json["premium"] != Standards.JSON.false) error("Expected bool"); | |
| 72 | 73 | retval.premium = json["premium"]; |
| 73 | 74 | retval.source_code = json["source_code"]; |
| 74 | 75 | retval.source_name = json["source_name"]; |
Test case
1 generated file · +6 −0test/inputs/json/misc/a3d8c.json
Mpikedefault / TopLevel.pmod+6 −0
| @@ -156,7 +156,9 @@ View View_from_JSON(mixed json) { | ||
| 156 | 156 | retval.download_count = json["downloadCount"]; |
| 157 | 157 | retval.flags = json["flags"]; |
| 158 | 158 | retval.grants = json["grants"]; |
| 159 | + if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool"); | |
| 159 | 160 | retval.hide_from_catalog = json["hideFromCatalog"]; |
| 161 | + if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool"); | |
| 160 | 162 | retval.hide_from_data_json = json["hideFromDataJson"]; |
| 161 | 163 | retval.id = json["id"]; |
| 162 | 164 | retval.index_updated_at = json["indexUpdatedAt"]; |
| @@ -165,11 +167,13 @@ View View_from_JSON(mixed json) { | ||
| 165 | 167 | retval.locale = json["locale"]; |
| 166 | 168 | retval.metadata = json["metadata"]; |
| 167 | 169 | retval.name = json["name"]; |
| 170 | + if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool"); | |
| 168 | 171 | retval.new_backend = json["newBackend"]; |
| 169 | 172 | retval.number_of_comments = json["numberOfComments"]; |
| 170 | 173 | retval.oid = json["oid"]; |
| 171 | 174 | retval.owner = json["owner"]; |
| 172 | 175 | retval.provenance = json["provenance"]; |
| 176 | + if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool"); | |
| 173 | 177 | retval.publication_append_enabled = json["publicationAppendEnabled"]; |
| 174 | 178 | retval.publication_date = json["publicationDate"]; |
| 175 | 179 | retval.publication_group = json["publicationGroup"]; |
| @@ -346,6 +350,7 @@ Grant Grant_from_JSON(mixed json) { | ||
| 346 | 350 | Grant retval = Grant(); |
| 347 | 351 | |
| 348 | 352 | retval.flags = json["flags"]; |
| 353 | + if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool"); | |
| 349 | 354 | retval.inherited = json["inherited"]; |
| 350 | 355 | retval.type = json["type"]; |
| 351 | 356 | |
| @@ -439,6 +444,7 @@ class Visible { | ||
| 439 | 444 | Visible Visible_from_JSON(mixed json) { |
| 440 | 445 | Visible retval = Visible(); |
| 441 | 446 | |
| 447 | + if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool"); | |
| 442 | 448 | retval.table = json["table"]; |
| 443 | 449 | |
| 444 | 450 | return retval; |
Test case
1 generated file · +18 −0test/inputs/json/misc/ae7f0.json
Mpikedefault / TopLevel.pmod+18 −0
| @@ -222,34 +222,46 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 222 | 222 | |
| 223 | 223 | retval.approved_at_utc = json["approved_at_utc"]; |
| 224 | 224 | retval.approved_by = json["approved_by"]; |
| 225 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 225 | 226 | retval.archived = json["archived"]; |
| 226 | 227 | retval.author = json["author"]; |
| 227 | 228 | retval.author_flair_css_class = json["author_flair_css_class"]; |
| 228 | 229 | retval.author_flair_text = json["author_flair_text"]; |
| 229 | 230 | retval.banned_at_utc = json["banned_at_utc"]; |
| 230 | 231 | retval.banned_by = json["banned_by"]; |
| 232 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 231 | 233 | retval.brand_safe = json["brand_safe"]; |
| 234 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 232 | 235 | retval.can_gild = json["can_gild"]; |
| 236 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 233 | 237 | retval.can_mod_post = json["can_mod_post"]; |
| 238 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 234 | 239 | retval.clicked = json["clicked"]; |
| 240 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 235 | 241 | retval.contest_mode = json["contest_mode"]; |
| 236 | 242 | retval.created = (float)json["created"]; |
| 237 | 243 | retval.created_utc = (float)json["created_utc"]; |
| 238 | 244 | retval.distinguished = json["distinguished"]; |
| 239 | 245 | retval.domain = Domain_from_JSON(json["domain"]); |
| 240 | 246 | retval.downs = json["downs"]; |
| 247 | + if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool"); | |
| 241 | 248 | retval.edited = json["edited"]; |
| 242 | 249 | retval.gilded = json["gilded"]; |
| 250 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 243 | 251 | retval.hidden = json["hidden"]; |
| 252 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 244 | 253 | retval.hide_score = json["hide_score"]; |
| 245 | 254 | retval.id = json["id"]; |
| 255 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 246 | 256 | retval.is_self = json["is_self"]; |
| 257 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 247 | 258 | retval.is_video = json["is_video"]; |
| 248 | 259 | retval.likes = json["likes"]; |
| 249 | 260 | if (!has_index(json, "link_flair_css_class")) error("Missing required property"); |
| 250 | 261 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 251 | 262 | if (!has_index(json, "link_flair_text")) error("Missing required property"); |
| 252 | 263 | retval.link_flair_text = json["link_flair_text"]; |
| 264 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 253 | 265 | retval.locked = json["locked"]; |
| 254 | 266 | retval.media = json["media"]; |
| 255 | 267 | retval.media_embed = json["media_embed"]; |
| @@ -257,18 +269,23 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 257 | 269 | retval.name = json["name"]; |
| 258 | 270 | retval.num_comments = json["num_comments"]; |
| 259 | 271 | retval.num_reports = json["num_reports"]; |
| 272 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 260 | 273 | retval.over_18 = json["over_18"]; |
| 261 | 274 | retval.permalink = json["permalink"]; |
| 275 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 262 | 276 | retval.quarantine = json["quarantine"]; |
| 263 | 277 | retval.removal_reason = json["removal_reason"]; |
| 264 | 278 | retval.report_reasons = json["report_reasons"]; |
| 279 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 265 | 280 | retval.saved = json["saved"]; |
| 266 | 281 | retval.score = json["score"]; |
| 267 | 282 | retval.secure_media = json["secure_media"]; |
| 268 | 283 | retval.secure_media_embed = json["secure_media_embed"]; |
| 269 | 284 | retval.selftext = json["selftext"]; |
| 270 | 285 | retval.selftext_html = json["selftext_html"]; |
| 286 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 271 | 287 | retval.spoiler = json["spoiler"]; |
| 288 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 272 | 289 | retval.stickied = json["stickied"]; |
| 273 | 290 | retval.subreddit = Subreddit_from_JSON(json["subreddit"]); |
| 274 | 291 | retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]); |
| @@ -281,6 +298,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 281 | 298 | retval.url = json["url"]; |
| 282 | 299 | retval.user_reports = json["user_reports"]; |
| 283 | 300 | retval.view_count = json["view_count"]; |
| 301 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 284 | 302 | retval.visited = json["visited"]; |
| 285 | 303 | |
| 286 | 304 | return retval; |
Test case
1 generated file · +19 −0test/inputs/json/misc/be234.json
Mpikedefault / TopLevel.pmod+19 −0
| @@ -230,6 +230,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 230 | 230 | |
| 231 | 231 | retval.approved_at_utc = json["approved_at_utc"]; |
| 232 | 232 | retval.approved_by = json["approved_by"]; |
| 233 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 233 | 234 | retval.archived = json["archived"]; |
| 234 | 235 | retval.author = json["author"]; |
| 235 | 236 | retval.author_flair_css_class = json["author_flair_css_class"]; |
| @@ -237,10 +238,15 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 237 | 238 | retval.author_flair_text = json["author_flair_text"]; |
| 238 | 239 | retval.banned_at_utc = json["banned_at_utc"]; |
| 239 | 240 | retval.banned_by = json["banned_by"]; |
| 241 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 240 | 242 | retval.brand_safe = json["brand_safe"]; |
| 243 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 241 | 244 | retval.can_gild = json["can_gild"]; |
| 245 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 242 | 246 | retval.can_mod_post = json["can_mod_post"]; |
| 247 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 243 | 248 | retval.clicked = json["clicked"]; |
| 249 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 244 | 250 | retval.contest_mode = json["contest_mode"]; |
| 245 | 251 | retval.created = (float)json["created"]; |
| 246 | 252 | retval.created_utc = (float)json["created_utc"]; |
| @@ -248,16 +254,22 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 248 | 254 | retval.distinguished = json["distinguished"]; |
| 249 | 255 | retval.domain = Domain_from_JSON(json["domain"]); |
| 250 | 256 | retval.downs = json["downs"]; |
| 257 | + if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool"); | |
| 251 | 258 | retval.edited = json["edited"]; |
| 252 | 259 | retval.gilded = json["gilded"]; |
| 260 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 253 | 261 | retval.hidden = json["hidden"]; |
| 262 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 263 | retval.hide_score = json["hide_score"]; |
| 255 | 264 | retval.id = json["id"]; |
| 265 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 256 | 266 | retval.is_self = json["is_self"]; |
| 267 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 257 | 268 | retval.is_video = json["is_video"]; |
| 258 | 269 | retval.likes = json["likes"]; |
| 259 | 270 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 260 | 271 | retval.link_flair_text = json["link_flair_text"]; |
| 272 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 261 | 273 | retval.locked = json["locked"]; |
| 262 | 274 | if (!has_index(json, "media")) error("Missing required property"); |
| 263 | 275 | retval.media = json["media"]; |
| @@ -266,13 +278,16 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 266 | 278 | retval.name = json["name"]; |
| 267 | 279 | retval.num_comments = json["num_comments"]; |
| 268 | 280 | retval.num_reports = json["num_reports"]; |
| 281 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 269 | 282 | retval.over_18 = json["over_18"]; |
| 270 | 283 | retval.permalink = json["permalink"]; |
| 271 | 284 | retval.post_hint = PostHint_from_JSON(json["post_hint"]); |
| 272 | 285 | retval.preview = json["preview"]; |
| 286 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 273 | 287 | retval.quarantine = json["quarantine"]; |
| 274 | 288 | retval.removal_reason = json["removal_reason"]; |
| 275 | 289 | retval.report_reasons = json["report_reasons"]; |
| 290 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 276 | 291 | retval.saved = json["saved"]; |
| 277 | 292 | retval.score = json["score"]; |
| 278 | 293 | if (!has_index(json, "secure_media")) error("Missing required property"); |
| @@ -280,7 +295,9 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 280 | 295 | retval.secure_media_embed = json["secure_media_embed"]; |
| 281 | 296 | retval.selftext = json["selftext"]; |
| 282 | 297 | retval.selftext_html = json["selftext_html"]; |
| 298 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 283 | 299 | retval.spoiler = json["spoiler"]; |
| 300 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 284 | 301 | retval.stickied = json["stickied"]; |
| 285 | 302 | retval.subreddit = Subreddit_from_JSON(json["subreddit"]); |
| 286 | 303 | retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]); |
| @@ -295,6 +312,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 295 | 312 | retval.url = json["url"]; |
| 296 | 313 | retval.user_reports = json["user_reports"]; |
| 297 | 314 | retval.view_count = json["view_count"]; |
| 315 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 298 | 316 | retval.visited = json["visited"]; |
| 299 | 317 | |
| 300 | 318 | return retval; |
| @@ -444,6 +462,7 @@ class Preview { | ||
| 444 | 462 | Preview Preview_from_JSON(mixed json) { |
| 445 | 463 | Preview retval = Preview(); |
| 446 | 464 | |
| 465 | + if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool"); | |
| 447 | 466 | retval.enabled = json["enabled"]; |
| 448 | 467 | retval.images = json["images"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/d23d5.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 44 | 44 | retval.limit = json["limit"]; |
| 45 | 45 | retval.next = json["next"]; |
| 46 | 46 | retval.offset = json["offset"]; |
| 47 | + if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool"); | |
| 47 | 48 | retval.previous = json["previous"]; |
| 48 | 49 | retval.results = json["results"]; |
Test case
1 generated file · +1 −0test/inputs/json/misc/e324e.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -251,6 +251,7 @@ Parameter Parameter_from_JSON(mixed json) { | ||
| 251 | 251 | retval.format = Type_from_JSON(json["format"]); |
| 252 | 252 | retval.in = json["in"]; |
| 253 | 253 | retval.name = json["name"]; |
| 254 | + if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool"); | |
| 254 | 255 | retval.required = json["required"]; |
| 255 | 256 | retval.type = Type_from_JSON(json["type"]); |
Test case
1 generated file · +7 −0test/inputs/json/misc/e8b04.json
Mpikedefault / TopLevel.pmod+7 −0
| @@ -119,7 +119,9 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) { | ||
| 119 | 119 | retval.download_count = json["downloadCount"]; |
| 120 | 120 | retval.flags = json["flags"]; |
| 121 | 121 | retval.grants = json["grants"]; |
| 122 | + if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool"); | |
| 122 | 123 | retval.hide_from_catalog = json["hideFromCatalog"]; |
| 124 | + if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool"); | |
| 123 | 125 | retval.hide_from_data_json = json["hideFromDataJson"]; |
| 124 | 126 | retval.id = json["id"]; |
| 125 | 127 | retval.index_updated_at = json["indexUpdatedAt"]; |
| @@ -128,11 +130,13 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) { | ||
| 128 | 130 | retval.moderation_status = json["moderationStatus"]; |
| 129 | 131 | retval.modifying_view_uid = ModifyingViewUid_from_JSON(json["modifyingViewUid"]); |
| 130 | 132 | retval.name = json["name"]; |
| 133 | + if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool"); | |
| 131 | 134 | retval.new_backend = json["newBackend"]; |
| 132 | 135 | retval.number_of_comments = json["numberOfComments"]; |
| 133 | 136 | retval.oid = json["oid"]; |
| 134 | 137 | retval.owner = json["owner"]; |
| 135 | 138 | retval.provenance = Provenance_from_JSON(json["provenance"]); |
| 139 | + if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool"); | |
| 136 | 140 | retval.publication_append_enabled = json["publicationAppendEnabled"]; |
| 137 | 141 | retval.publication_date = json["publicationDate"]; |
| 138 | 142 | retval.publication_group = json["publicationGroup"]; |
| @@ -196,6 +200,7 @@ Grant Grant_from_JSON(mixed json) { | ||
| 196 | 200 | Grant retval = Grant(); |
| 197 | 201 | |
| 198 | 202 | retval.flags = json["flags"]; |
| 203 | + if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool"); | |
| 199 | 204 | retval.inherited = json["inherited"]; |
| 200 | 205 | retval.type = GrantType_from_JSON(json["type"]); |
| 201 | 206 | |
| @@ -371,6 +376,7 @@ class Order { | ||
| 371 | 376 | Order Order_from_JSON(mixed json) { |
| 372 | 377 | Order retval = Order(); |
| 373 | 378 | |
| 379 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 374 | 380 | retval.ascending = json["ascending"]; |
| 375 | 381 | retval.column_field_name = OrderColumnFieldName_from_JSON(json["columnFieldName"]); |
| 376 | 382 | |
| @@ -834,6 +840,7 @@ class FluffyVisible { | ||
| 834 | 840 | FluffyVisible FluffyVisible_from_JSON(mixed json) { |
| 835 | 841 | FluffyVisible retval = FluffyVisible(); |
| 836 | 842 | |
| 843 | + if (json["href"] != Standards.JSON.true && json["href"] != Standards.JSON.false) error("Expected bool"); | |
| 837 | 844 | retval.href = json["href"]; |
| 838 | 845 | |
| 839 | 846 | return retval; |
Test case
1 generated file · +18 −0test/inputs/json/misc/f22f5.json
Mpikedefault / TopLevel.pmod+18 −0
| @@ -222,34 +222,46 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 222 | 222 | |
| 223 | 223 | retval.approved_at_utc = json["approved_at_utc"]; |
| 224 | 224 | retval.approved_by = json["approved_by"]; |
| 225 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 225 | 226 | retval.archived = json["archived"]; |
| 226 | 227 | retval.author = json["author"]; |
| 227 | 228 | retval.author_flair_css_class = json["author_flair_css_class"]; |
| 228 | 229 | retval.author_flair_text = json["author_flair_text"]; |
| 229 | 230 | retval.banned_at_utc = json["banned_at_utc"]; |
| 230 | 231 | retval.banned_by = json["banned_by"]; |
| 232 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 231 | 233 | retval.brand_safe = json["brand_safe"]; |
| 234 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 232 | 235 | retval.can_gild = json["can_gild"]; |
| 236 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 233 | 237 | retval.can_mod_post = json["can_mod_post"]; |
| 238 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 234 | 239 | retval.clicked = json["clicked"]; |
| 240 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 235 | 241 | retval.contest_mode = json["contest_mode"]; |
| 236 | 242 | retval.created = (float)json["created"]; |
| 237 | 243 | retval.created_utc = (float)json["created_utc"]; |
| 238 | 244 | retval.distinguished = json["distinguished"]; |
| 239 | 245 | retval.domain = json["domain"]; |
| 240 | 246 | retval.downs = json["downs"]; |
| 247 | + if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool"); | |
| 241 | 248 | retval.edited = json["edited"]; |
| 242 | 249 | retval.gilded = json["gilded"]; |
| 250 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 243 | 251 | retval.hidden = json["hidden"]; |
| 252 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 244 | 253 | retval.hide_score = json["hide_score"]; |
| 245 | 254 | retval.id = json["id"]; |
| 255 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 246 | 256 | retval.is_self = json["is_self"]; |
| 257 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 247 | 258 | retval.is_video = json["is_video"]; |
| 248 | 259 | retval.likes = json["likes"]; |
| 249 | 260 | if (!has_index(json, "link_flair_css_class")) error("Missing required property"); |
| 250 | 261 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 251 | 262 | if (!has_index(json, "link_flair_text")) error("Missing required property"); |
| 252 | 263 | retval.link_flair_text = json["link_flair_text"]; |
| 264 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 253 | 265 | retval.locked = json["locked"]; |
| 254 | 266 | retval.media = json["media"]; |
| 255 | 267 | retval.media_embed = json["media_embed"]; |
| @@ -257,18 +269,23 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 257 | 269 | retval.name = json["name"]; |
| 258 | 270 | retval.num_comments = json["num_comments"]; |
| 259 | 271 | retval.num_reports = json["num_reports"]; |
| 272 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 260 | 273 | retval.over_18 = json["over_18"]; |
| 261 | 274 | retval.permalink = json["permalink"]; |
| 275 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 262 | 276 | retval.quarantine = json["quarantine"]; |
| 263 | 277 | retval.removal_reason = json["removal_reason"]; |
| 264 | 278 | retval.report_reasons = json["report_reasons"]; |
| 279 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 265 | 280 | retval.saved = json["saved"]; |
| 266 | 281 | retval.score = json["score"]; |
| 267 | 282 | retval.secure_media = json["secure_media"]; |
| 268 | 283 | retval.secure_media_embed = json["secure_media_embed"]; |
| 269 | 284 | retval.selftext = json["selftext"]; |
| 270 | 285 | retval.selftext_html = json["selftext_html"]; |
| 286 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 271 | 287 | retval.spoiler = json["spoiler"]; |
| 288 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 272 | 289 | retval.stickied = json["stickied"]; |
| 273 | 290 | retval.subreddit = Subreddit_from_JSON(json["subreddit"]); |
| 274 | 291 | retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]); |
| @@ -281,6 +298,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 281 | 298 | retval.url = json["url"]; |
| 282 | 299 | retval.user_reports = json["user_reports"]; |
| 283 | 300 | retval.view_count = json["view_count"]; |
| 301 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 284 | 302 | retval.visited = json["visited"]; |
| 285 | 303 | |
| 286 | 304 | return retval; |
Test case
1 generated file · +6 −0test/inputs/json/misc/f74d5.json
Mpikedefault / TopLevel.pmod+6 −0
| @@ -156,7 +156,9 @@ View View_from_JSON(mixed json) { | ||
| 156 | 156 | retval.download_count = json["downloadCount"]; |
| 157 | 157 | retval.flags = json["flags"]; |
| 158 | 158 | retval.grants = json["grants"]; |
| 159 | + if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool"); | |
| 159 | 160 | retval.hide_from_catalog = json["hideFromCatalog"]; |
| 161 | + if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool"); | |
| 160 | 162 | retval.hide_from_data_json = json["hideFromDataJson"]; |
| 161 | 163 | retval.id = json["id"]; |
| 162 | 164 | retval.index_updated_at = json["indexUpdatedAt"]; |
| @@ -165,11 +167,13 @@ View View_from_JSON(mixed json) { | ||
| 165 | 167 | retval.locale = json["locale"]; |
| 166 | 168 | retval.metadata = json["metadata"]; |
| 167 | 169 | retval.name = json["name"]; |
| 170 | + if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool"); | |
| 168 | 171 | retval.new_backend = json["newBackend"]; |
| 169 | 172 | retval.number_of_comments = json["numberOfComments"]; |
| 170 | 173 | retval.oid = json["oid"]; |
| 171 | 174 | retval.owner = json["owner"]; |
| 172 | 175 | retval.provenance = json["provenance"]; |
| 176 | + if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool"); | |
| 173 | 177 | retval.publication_append_enabled = json["publicationAppendEnabled"]; |
| 174 | 178 | retval.publication_date = json["publicationDate"]; |
| 175 | 179 | retval.publication_group = json["publicationGroup"]; |
| @@ -346,6 +350,7 @@ Grant Grant_from_JSON(mixed json) { | ||
| 346 | 350 | Grant retval = Grant(); |
| 347 | 351 | |
| 348 | 352 | retval.flags = json["flags"]; |
| 353 | + if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool"); | |
| 349 | 354 | retval.inherited = json["inherited"]; |
| 350 | 355 | retval.type = json["type"]; |
| 351 | 356 | |
| @@ -439,6 +444,7 @@ class Visible { | ||
| 439 | 444 | Visible Visible_from_JSON(mixed json) { |
| 440 | 445 | Visible retval = Visible(); |
| 441 | 446 | |
| 447 | + if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool"); | |
| 442 | 448 | retval.table = json["table"]; |
| 443 | 449 | |
| 444 | 450 | return retval; |
Test case
1 generated file · +1 −0test/inputs/json/misc/f82d9.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -298,6 +298,7 @@ Parameter Parameter_from_JSON(mixed json) { | ||
| 298 | 298 | retval.format = Type_from_JSON(json["format"]); |
| 299 | 299 | retval.in = json["in"]; |
| 300 | 300 | retval.name = json["name"]; |
| 301 | + if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool"); | |
| 301 | 302 | retval.required = json["required"]; |
| 302 | 303 | retval.type = Type_from_JSON(json["type"]); |
Test case
1 generated file · +9 −0test/inputs/json/misc/fcca3.json
Mpikedefault / TopLevel.pmod+9 −0
| @@ -158,18 +158,22 @@ View View_from_JSON(mixed json) { | ||
| 158 | 158 | retval.download_count = json["downloadCount"]; |
| 159 | 159 | retval.flags = json["flags"]; |
| 160 | 160 | retval.grants = json["grants"]; |
| 161 | + if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool"); | |
| 161 | 162 | retval.hide_from_catalog = json["hideFromCatalog"]; |
| 163 | + if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool"); | |
| 162 | 164 | retval.hide_from_data_json = json["hideFromDataJson"]; |
| 163 | 165 | retval.id = json["id"]; |
| 164 | 166 | retval.index_updated_at = json["indexUpdatedAt"]; |
| 165 | 167 | retval.locale = json["locale"]; |
| 166 | 168 | retval.metadata = json["metadata"]; |
| 167 | 169 | retval.name = json["name"]; |
| 170 | + if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool"); | |
| 168 | 171 | retval.new_backend = json["newBackend"]; |
| 169 | 172 | retval.number_of_comments = json["numberOfComments"]; |
| 170 | 173 | retval.oid = json["oid"]; |
| 171 | 174 | retval.owner = json["owner"]; |
| 172 | 175 | retval.provenance = json["provenance"]; |
| 176 | + if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool"); | |
| 173 | 177 | retval.publication_append_enabled = json["publicationAppendEnabled"]; |
| 174 | 178 | retval.publication_date = json["publicationDate"]; |
| 175 | 179 | retval.publication_group = json["publicationGroup"]; |
| @@ -359,6 +363,7 @@ Grant Grant_from_JSON(mixed json) { | ||
| 359 | 363 | Grant retval = Grant(); |
| 360 | 364 | |
| 361 | 365 | retval.flags = json["flags"]; |
| 366 | + if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool"); | |
| 362 | 367 | retval.inherited = json["inherited"]; |
| 363 | 368 | retval.type = json["type"]; |
| 364 | 369 | |
| @@ -686,6 +691,7 @@ class FilterConditionMetadata { | ||
| 686 | 691 | FilterConditionMetadata FilterConditionMetadata_from_JSON(mixed json) { |
| 687 | 692 | FilterConditionMetadata retval = FilterConditionMetadata(); |
| 688 | 693 | |
| 694 | + if (json["advanced"] != Standards.JSON.true && json["advanced"] != Standards.JSON.false) error("Expected bool"); | |
| 689 | 695 | retval.advanced = json["advanced"]; |
| 690 | 696 | retval.unified_version = json["unifiedVersion"]; |
| 691 | 697 | |
| @@ -729,6 +735,7 @@ class Order { | ||
| 729 | 735 | Order Order_from_JSON(mixed json) { |
| 730 | 736 | Order retval = Order(); |
| 731 | 737 | |
| 738 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 732 | 739 | retval.ascending = json["ascending"]; |
| 733 | 740 | retval.column_field_name = json["columnFieldName"]; |
| 734 | 741 | |
| @@ -770,6 +777,7 @@ class Visible { | ||
| 770 | 777 | Visible Visible_from_JSON(mixed json) { |
| 771 | 778 | Visible retval = Visible(); |
| 772 | 779 | |
| 780 | + if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool"); | |
| 773 | 781 | retval.table = json["table"]; |
| 774 | 782 | |
| 775 | 783 | return retval; |
| @@ -853,6 +861,7 @@ class OrderBy { | ||
| 853 | 861 | OrderBy OrderBy_from_JSON(mixed json) { |
| 854 | 862 | OrderBy retval = OrderBy(); |
| 855 | 863 | |
| 864 | + if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool"); | |
| 856 | 865 | retval.ascending = json["ascending"]; |
| 857 | 866 | retval.expression = json["expression"]; |
Test case
1 generated file · +3 −0test/inputs/json/priority/blns-object.json
Mpikedefault / TopLevel.pmod+3 −0
| @@ -580,6 +580,7 @@ A A_from_JSON(mixed json) { | ||
| 580 | 580 | retval.cunning = json["<>?:\"{}|_+"]; |
| 581 | 581 | retval.d = json["%d"]; |
| 582 | 582 | retval.dick_van_dyke = json["Dick Van Dyke"]; |
| 583 | + if (json["dontMakeAMap"] != Standards.JSON.true && json["dontMakeAMap"] != Standards.JSON.false) error("Expected bool"); | |
| 583 | 584 | retval.dont_make_a_map = json["dontMakeAMap"]; |
| 584 | 585 | retval.dr_herman_i_libshitz = json["Dr. Herman I. Libshitz"]; |
| 585 | 586 | retval.empty = json[" "]; |
| @@ -1126,6 +1127,7 @@ B B_from_JSON(mixed json) { | ||
| 1126 | 1127 | retval.credit_https_twitter_com_jifa_status_625776454479970304 = json["#\tCredit: https://twitter.com/jifa/status/625776454479970304"]; |
| 1127 | 1128 | retval.cunning = json["社會科學院語學研究所"]; |
| 1128 | 1129 | retval.dev_null_touch_tmp_blns_fail_echo = json["/dev/null; touch /tmp/blns.fail ; echo"]; |
| 1130 | + if (json["dontMakeAMap"] != Standards.JSON.true && json["dontMakeAMap"] != Standards.JSON.false) error("Expected bool"); | |
| 1129 | 1131 | retval.dont_make_a_map = json["dontMakeAMap"]; |
| 1130 | 1132 | retval.empty = json["\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f\u007f"]; |
| 1131 | 1133 | retval.eval_puts_hello_world = json["eval(\"puts 'hello world'\")"]; |
| @@ -1694,6 +1696,7 @@ C C_from_JSON(mixed json) { | ||
| 1694 | 1696 | retval.craig_cockburn_software_specialist = json["Craig Cockburn, Software Specialist"]; |
| 1695 | 1697 | retval.cunning = json["\\\\"]; |
| 1696 | 1698 | retval.dcc_send_startkeylogger_000 = json["DCC SEND STARTKEYLOGGER 0 0 0"]; |
| 1699 | + if (json["dontMakeAMap"] != Standards.JSON.true && json["dontMakeAMap"] != Standards.JSON.false) error("Expected bool"); | |
| 1697 | 1700 | retval.dont_make_a_map = json["dontMakeAMap"]; |
| 1698 | 1701 | retval.emoji = json["#\tEmoji"]; |
| 1699 | 1702 | retval.empty = json["\"\""]; |
Test case
1 generated file · +1 −0test/inputs/json/priority/bug790.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -43,6 +43,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 43 | 43 | |
| 44 | 44 | retval.children_data = json["children_data"]; |
| 45 | 45 | retval.id = json["id"]; |
| 46 | + if (json["is_active"] != Standards.JSON.true && json["is_active"] != Standards.JSON.false) error("Expected bool"); | |
| 46 | 47 | retval.is_active = json["is_active"]; |
| 47 | 48 | retval.level = json["level"]; |
| 48 | 49 | retval.name = json["name"]; |
Test case
1 generated file · +2 −0test/inputs/json/priority/combinations1.json
Mpikedefault / TopLevel.pmod+2 −0
| @@ -371,6 +371,7 @@ CimeliaClass CimeliaClass_from_JSON(mixed json) { | ||
| 371 | 371 | retval.catharticalness = (float)json["catharticalness"]; |
| 372 | 372 | retval.chirotherium = json["Chirotherium"]; |
| 373 | 373 | retval.disdiapason = json["disdiapason"]; |
| 374 | + if (json["homocerc"] != Standards.JSON.true && json["homocerc"] != Standards.JSON.false) error("Expected bool"); | |
| 374 | 375 | retval.homocerc = json["homocerc"]; |
| 375 | 376 | retval.nonbookish = json["nonbookish"]; |
| 376 | 377 | |
| @@ -1298,6 +1299,7 @@ Interacinar Interacinar_from_JSON(mixed json) { | ||
| 1298 | 1299 | Interacinar retval = Interacinar(); |
| 1299 | 1300 | |
| 1300 | 1301 | retval.assapan = (float)json["assapan"]; |
| 1302 | + if (json["benefactorship"] != Standards.JSON.true && json["benefactorship"] != Standards.JSON.false) error("Expected bool"); | |
| 1301 | 1303 | retval.benefactorship = json["benefactorship"]; |
| 1302 | 1304 | retval.triseriatim = json["triseriatim"]; |
| 1303 | 1305 | retval.tubbing = json["tubbing"]; |
Test case
1 generated file · +2 −0test/inputs/json/priority/combinations2.json
Mpikedefault / TopLevel.pmod+2 −0
| @@ -154,6 +154,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 154 | 154 | retval.oskar = json["Oskar"]; |
| 155 | 155 | retval.rebecca = json["Rebecca"]; |
| 156 | 156 | retval.rhomboganoidei = json["Rhomboganoidei"]; |
| 157 | + if (json["Rigsmal"] != Standards.JSON.true && json["Rigsmal"] != Standards.JSON.false) error("Expected bool"); | |
| 157 | 158 | retval.rigsmal = json["Rigsmal"]; |
| 158 | 159 | retval.ruellia = json["Ruellia"]; |
| 159 | 160 | retval.school = json["School"]; |
| @@ -309,6 +310,7 @@ Rebecca Rebecca_from_JSON(mixed json) { | ||
| 309 | 310 | retval.catharticalness = (float)json["catharticalness"]; |
| 310 | 311 | retval.chirotherium = json["Chirotherium"]; |
| 311 | 312 | retval.disdiapason = json["disdiapason"]; |
| 313 | + if (json["homocerc"] != Standards.JSON.true && json["homocerc"] != Standards.JSON.false) error("Expected bool"); | |
| 312 | 314 | retval.homocerc = json["homocerc"]; |
| 313 | 315 | retval.nonbookish = json["nonbookish"]; |
Test case
1 generated file · +2 −0test/inputs/json/priority/combinations3.json
Mpikedefault / TopLevel.pmod+2 −0
| @@ -698,6 +698,7 @@ MonaziteClass MonaziteClass_from_JSON(mixed json) { | ||
| 698 | 698 | retval.catharticalness = (float)json["catharticalness"]; |
| 699 | 699 | retval.chirotherium = json["Chirotherium"]; |
| 700 | 700 | retval.disdiapason = json["disdiapason"]; |
| 701 | + if (json["homocerc"] != Standards.JSON.true && json["homocerc"] != Standards.JSON.false) error("Expected bool"); | |
| 701 | 702 | retval.homocerc = json["homocerc"]; |
| 702 | 703 | retval.nonbookish = json["nonbookish"]; |
| 703 | 704 | |
| @@ -864,6 +865,7 @@ Noncontributing Noncontributing_from_JSON(mixed json) { | ||
| 864 | 865 | retval.estevin = json["estevin"]; |
| 865 | 866 | retval.jolterhead = (float)json["jolterhead"]; |
| 866 | 867 | retval.sauternes = json["sauternes"]; |
| 868 | + if (json["sparsely"] != Standards.JSON.true && json["sparsely"] != Standards.JSON.false) error("Expected bool"); | |
| 867 | 869 | retval.sparsely = json["sparsely"]; |
| 868 | 870 | retval.unrequested = json["unrequested"]; |
Test case
1 generated file · +1 −0test/inputs/json/priority/combinations4.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -389,6 +389,7 @@ QuebrachineClass QuebrachineClass_from_JSON(mixed json) { | ||
| 389 | 389 | retval.catharticalness = (float)json["catharticalness"]; |
| 390 | 390 | retval.chirotherium = json["Chirotherium"]; |
| 391 | 391 | retval.disdiapason = json["disdiapason"]; |
| 392 | + if (json["homocerc"] != Standards.JSON.true && json["homocerc"] != Standards.JSON.false) error("Expected bool"); | |
| 392 | 393 | retval.homocerc = json["homocerc"]; |
| 393 | 394 | retval.nonbookish = json["nonbookish"]; |
Test case
1 generated file · +1 −0test/inputs/json/priority/direct-recursive.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -36,6 +36,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | 38 | retval.also = json["also"]; |
| 39 | + if (json["bar"] != Standards.JSON.true && json["bar"] != Standards.JSON.false) error("Expected bool"); | |
| 39 | 40 | retval.bar = json["bar"]; |
| 40 | 41 | retval.foo = json["foo"]; |
| 41 | 42 | retval.moo = (float)json["moo"]; |
Test case
1 generated file · +4 −0test/inputs/json/priority/name-style.json
Mpikedefault / TopLevel.pmod+4 −0
| @@ -40,11 +40,15 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 40 | 40 | TopLevel retval = TopLevel(); |
| 41 | 41 | |
| 42 | 42 | retval.an_easy_one = json["anEasyOne"]; |
| 43 | + if (json["isMNISTLetter"] != Standards.JSON.true && json["isMNISTLetter"] != Standards.JSON.false) error("Expected bool"); | |
| 43 | 44 | retval.is_mnist_letter = json["isMNISTLetter"]; |
| 44 | 45 | retval.json_string = json["JSONString"]; |
| 46 | + if (json["PrettyEasyToo"] != Standards.JSON.true && json["PrettyEasyToo"] != Standards.JSON.false) error("Expected bool"); | |
| 45 | 47 | retval.pretty_easy_too = json["PrettyEasyToo"]; |
| 46 | 48 | retval.should_know_that_id_is_an_initialism = json["should_know_that_id_is_an_initialism"]; |
| 49 | + if (json[" spaces are separators too "] != Standards.JSON.true && json[" spaces are separators too "] != Standards.JSON.false) error("Expected bool"); | |
| 47 | 50 | retval.spaces_are_separators_too = json[" spaces are separators too "]; |
| 51 | + if (json["ZSR_HH_DEMO3_DELMATNR"] != Standards.JSON.true && json["ZSR_HH_DEMO3_DELMATNR"] != Standards.JSON.false) error("Expected bool"); | |
| 48 | 52 | retval.zsr_hh_demo3_delmatnr = json["ZSR_HH_DEMO3_DELMATNR"]; |
| 49 | 53 | |
| 50 | 54 | return retval; |
Test case
1 generated file · +2 −0test/inputs/json/priority/nst-test-suite.json
Mpikedefault / TopLevel.pmod+2 −0
| @@ -294,11 +294,13 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 294 | 294 | retval.y_string_unicode_u_fffe_nonchar_json = json["y_string_unicode_U+FFFE_nonchar.json"]; |
| 295 | 295 | retval.y_string_utf8_json = json["y_string_utf8.json"]; |
| 296 | 296 | retval.y_string_with_del_character_json = json["y_string_with_del_character.json"]; |
| 297 | + if (json["y_structure_lonely_false.json"] != Standards.JSON.true && json["y_structure_lonely_false.json"] != Standards.JSON.false) error("Expected bool"); | |
| 297 | 298 | retval.y_structure_lonely_false_json = json["y_structure_lonely_false.json"]; |
| 298 | 299 | retval.y_structure_lonely_int_json = json["y_structure_lonely_int.json"]; |
| 299 | 300 | retval.y_structure_lonely_negative_real_json = (float)json["y_structure_lonely_negative_real.json"]; |
| 300 | 301 | retval.y_structure_lonely_null_json = json["y_structure_lonely_null.json"]; |
| 301 | 302 | retval.y_structure_lonely_string_json = json["y_structure_lonely_string.json"]; |
| 303 | + if (json["y_structure_lonely_true.json"] != Standards.JSON.true && json["y_structure_lonely_true.json"] != Standards.JSON.false) error("Expected bool"); | |
| 302 | 304 | retval.y_structure_lonely_true_json = json["y_structure_lonely_true.json"]; |
| 303 | 305 | retval.y_structure_string_empty_json = json["y_structure_string_empty.json"]; |
| 304 | 306 | retval.y_structure_trailing_newline_json = json["y_structure_trailing_newline.json"]; |
Test case
1 generated file · +1 −0test/inputs/json/priority/php-validation.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -35,6 +35,7 @@ class TopLevel { | ||
| 35 | 35 | TopLevel TopLevel_from_JSON(mixed json) { |
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | + if (json["boolean"] != Standards.JSON.true && json["boolean"] != Standards.JSON.false) error("Expected bool"); | |
| 38 | 39 | retval.boolean = json["boolean"]; |
| 39 | 40 | retval.integer = json["integer"]; |
| 40 | 41 | retval.integers = json["integers"]; |
Test case
1 generated file · +8 −0test/inputs/json/priority/recursive.json
Mpikedefault / TopLevel.pmod+8 −0
| @@ -50,6 +50,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 50 | 50 | retval.match = json["match"]; |
| 51 | 51 | retval.page = json["page"]; |
| 52 | 52 | retval.product = json["product"]; |
| 53 | + if (json["schk"] != Standards.JSON.true && json["schk"] != Standards.JSON.false) error("Expected bool"); | |
| 53 | 54 | retval.schk = json["schk"]; |
| 54 | 55 | retval.totallooseoffers = json["totallooseoffers"]; |
| 55 | 56 | retval.totalpages = json["totalpages"]; |
| @@ -88,9 +89,12 @@ class Category { | ||
| 88 | 89 | Category Category_from_JSON(mixed json) { |
| 89 | 90 | Category retval = Category(); |
| 90 | 91 | |
| 92 | + if (json["concatenatecategoryname"] != Standards.JSON.true && json["concatenatecategoryname"] != Standards.JSON.false) error("Expected bool"); | |
| 91 | 93 | retval.concatenatecategoryname = json["concatenatecategoryname"]; |
| 94 | + if (json["hasoffer"] != Standards.JSON.true && json["hasoffer"] != Standards.JSON.false) error("Expected bool"); | |
| 92 | 95 | retval.hasoffer = json["hasoffer"]; |
| 93 | 96 | retval.id = json["id"]; |
| 97 | + if (json["isfinal"] != Standards.JSON.true && json["isfinal"] != Standards.JSON.false) error("Expected bool"); | |
| 94 | 98 | retval.isfinal = json["isfinal"]; |
| 95 | 99 | retval.links = json["links"]; |
| 96 | 100 | retval.name = json["name"]; |
| @@ -244,6 +248,7 @@ Date Date_from_JSON(mixed json) { | ||
| 244 | 248 | retval.month = json["month"]; |
| 245 | 249 | retval.second = json["second"]; |
| 246 | 250 | retval.timezone = json["timezone"]; |
| 251 | + if (json["valid"] != Standards.JSON.true && json["valid"] != Standards.JSON.false) error("Expected bool"); | |
| 247 | 252 | retval.valid = json["valid"]; |
| 248 | 253 | retval.xmlschematype = json["xmlschematype"]; |
| 249 | 254 | retval.year = json["year"]; |
| @@ -364,8 +369,11 @@ ProductProduct ProductProduct_from_JSON(mixed json) { | ||
| 364 | 369 | |
| 365 | 370 | retval.categoryid = json["categoryid"]; |
| 366 | 371 | retval.currency = json["currency"]; |
| 372 | + if (json["eco"] != Standards.JSON.true && json["eco"] != Standards.JSON.false) error("Expected bool"); | |
| 367 | 373 | retval.eco = json["eco"]; |
| 374 | + if (json["fulldescription"] != Standards.JSON.true && json["fulldescription"] != Standards.JSON.false) error("Expected bool"); | |
| 368 | 375 | retval.fulldescription = json["fulldescription"]; |
| 376 | + if (json["hasmetasearch"] != Standards.JSON.true && json["hasmetasearch"] != Standards.JSON.false) error("Expected bool"); | |
| 369 | 377 | retval.hasmetasearch = json["hasmetasearch"]; |
| 370 | 378 | retval.id = json["id"]; |
| 371 | 379 | retval.links = json["links"]; |
Test case
1 generated file · +1 −0test/inputs/json/priority/union-constructor-clash.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -50,6 +50,7 @@ class BoolInUnion { | ||
| 50 | 50 | BoolInUnion BoolInUnion_from_JSON(mixed json) { |
| 51 | 51 | BoolInUnion retval = BoolInUnion(); |
| 52 | 52 | |
| 53 | + if (json["a"] != Standards.JSON.true && json["a"] != Standards.JSON.false) error("Expected bool"); | |
| 53 | 54 | retval.a = json["a"]; |
| 54 | 55 | |
| 55 | 56 | return retval; |
Test case
1 generated file · +1 −0test/inputs/json/priority/unions.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -65,6 +65,7 @@ class ZClass { | ||
| 65 | 65 | ZClass ZClass_from_JSON(mixed json) { |
| 66 | 66 | ZClass retval = ZClass(); |
| 67 | 67 | |
| 68 | + if (json["a"] != Standards.JSON.true && json["a"] != Standards.JSON.false) error("Expected bool"); | |
| 68 | 69 | retval.a = json["a"]; |
| 69 | 70 | |
| 70 | 71 | return retval; |
Test case
1 generated file · +1 −0test/inputs/json/priority/uuids.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -37,6 +37,7 @@ class TopLevel { | ||
| 37 | 37 | TopLevel TopLevel_from_JSON(mixed json) { |
| 38 | 38 | TopLevel retval = TopLevel(); |
| 39 | 39 | |
| 40 | + if (json["booleanValue"] != Standards.JSON.true && json["booleanValue"] != Standards.JSON.false) error("Expected bool"); | |
| 40 | 41 | retval.boolean_value = json["booleanValue"]; |
| 41 | 42 | retval.double_value = (float)json["doubleValue"]; |
| 42 | 43 | retval.int_value = json["intValue"]; |
Test case
1 generated file · +15 −0test/inputs/json/samples/github-events.json
Mpikedefault / TopLevel.pmod+15 −0
| @@ -53,6 +53,7 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) { | ||
| 53 | 53 | retval.org = json["org"]; |
| 54 | 54 | retval.payload = json["payload"]; |
| 55 | 55 | retval.repo = json["repo"]; |
| 56 | + if (json["public"] != Standards.JSON.true && json["public"] != Standards.JSON.false) error("Expected bool"); | |
| 56 | 57 | retval.top_level_public = json["public"]; |
| 57 | 58 | retval.type = json["type"]; |
| 58 | 59 | |
| @@ -259,6 +260,7 @@ User User_from_JSON(mixed json) { | ||
| 259 | 260 | retval.organizations_url = json["organizations_url"]; |
| 260 | 261 | retval.received_events_url = json["received_events_url"]; |
| 261 | 262 | retval.repos_url = json["repos_url"]; |
| 263 | + if (json["site_admin"] != Standards.JSON.true && json["site_admin"] != Standards.JSON.false) error("Expected bool"); | |
| 262 | 264 | retval.site_admin = json["site_admin"]; |
| 263 | 265 | retval.starred_url = json["starred_url"]; |
| 264 | 266 | retval.subscriptions_url = json["subscriptions_url"]; |
| @@ -301,6 +303,7 @@ Commit Commit_from_JSON(mixed json) { | ||
| 301 | 303 | Commit retval = Commit(); |
| 302 | 304 | |
| 303 | 305 | retval.author = json["author"]; |
| 306 | + if (json["distinct"] != Standards.JSON.true && json["distinct"] != Standards.JSON.false) error("Expected bool"); | |
| 304 | 307 | retval.distinct = json["distinct"]; |
| 305 | 308 | retval.message = json["message"]; |
| 306 | 309 | retval.sha = json["sha"]; |
| @@ -402,6 +405,7 @@ Issue Issue_from_JSON(mixed json) { | ||
| 402 | 405 | retval.id = json["id"]; |
| 403 | 406 | retval.labels = json["labels"]; |
| 404 | 407 | retval.labels_url = json["labels_url"]; |
| 408 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 405 | 409 | retval.locked = json["locked"]; |
| 406 | 410 | if (!has_index(json, "milestone")) error("Missing required property"); |
| 407 | 411 | retval.milestone = json["milestone"]; |
| @@ -442,6 +446,7 @@ Label Label_from_JSON(mixed json) { | ||
| 442 | 446 | |
| 443 | 447 | retval.color = json["color"]; |
| 444 | 448 | retval.id = json["id"]; |
| 449 | + if (json["default"] != Standards.JSON.true && json["default"] != Standards.JSON.false) error("Expected bool"); | |
| 445 | 450 | retval.label_default = json["default"]; |
| 446 | 451 | retval.name = json["name"]; |
| 447 | 452 | retval.url = json["url"]; |
| @@ -655,11 +660,14 @@ PayloadPullRequest PayloadPullRequest_from_JSON(mixed json) { | ||
| 655 | 660 | retval.id = json["id"]; |
| 656 | 661 | retval.issue_url = json["issue_url"]; |
| 657 | 662 | retval.links = json["_links"]; |
| 663 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 658 | 664 | retval.locked = json["locked"]; |
| 665 | + if (json["maintainer_can_modify"] != Standards.JSON.true && json["maintainer_can_modify"] != Standards.JSON.false) error("Expected bool"); | |
| 659 | 666 | retval.maintainer_can_modify = json["maintainer_can_modify"]; |
| 660 | 667 | retval.merge_commit_sha = json["merge_commit_sha"]; |
| 661 | 668 | retval.mergeable = json["mergeable"]; |
| 662 | 669 | retval.mergeable_state = json["mergeable_state"]; |
| 670 | + if (json["merged"] != Standards.JSON.true && json["merged"] != Standards.JSON.false) error("Expected bool"); | |
| 663 | 671 | retval.merged = json["merged"]; |
| 664 | 672 | retval.merged_at = json["merged_at"]; |
| 665 | 673 | retval.merged_by = json["merged_by"]; |
| @@ -881,6 +889,7 @@ BaseRepo BaseRepo_from_JSON(mixed json) { | ||
| 881 | 889 | retval.description = json["description"]; |
| 882 | 890 | retval.downloads_url = json["downloads_url"]; |
| 883 | 891 | retval.events_url = json["events_url"]; |
| 892 | + if (json["fork"] != Standards.JSON.true && json["fork"] != Standards.JSON.false) error("Expected bool"); | |
| 884 | 893 | retval.fork = json["fork"]; |
| 885 | 894 | retval.forks = json["forks"]; |
| 886 | 895 | retval.forks_count = json["forks_count"]; |
| @@ -890,10 +899,15 @@ BaseRepo BaseRepo_from_JSON(mixed json) { | ||
| 890 | 899 | retval.git_refs_url = json["git_refs_url"]; |
| 891 | 900 | retval.git_tags_url = json["git_tags_url"]; |
| 892 | 901 | retval.git_url = json["git_url"]; |
| 902 | + if (json["has_downloads"] != Standards.JSON.true && json["has_downloads"] != Standards.JSON.false) error("Expected bool"); | |
| 893 | 903 | retval.has_downloads = json["has_downloads"]; |
| 904 | + if (json["has_issues"] != Standards.JSON.true && json["has_issues"] != Standards.JSON.false) error("Expected bool"); | |
| 894 | 905 | retval.has_issues = json["has_issues"]; |
| 906 | + if (json["has_pages"] != Standards.JSON.true && json["has_pages"] != Standards.JSON.false) error("Expected bool"); | |
| 895 | 907 | retval.has_pages = json["has_pages"]; |
| 908 | + if (json["has_projects"] != Standards.JSON.true && json["has_projects"] != Standards.JSON.false) error("Expected bool"); | |
| 896 | 909 | retval.has_projects = json["has_projects"]; |
| 910 | + if (json["has_wiki"] != Standards.JSON.true && json["has_wiki"] != Standards.JSON.false) error("Expected bool"); | |
| 897 | 911 | retval.has_wiki = json["has_wiki"]; |
| 898 | 912 | retval.homepage = json["homepage"]; |
| 899 | 913 | retval.hooks_url = json["hooks_url"]; |
| @@ -917,6 +931,7 @@ BaseRepo BaseRepo_from_JSON(mixed json) { | ||
| 917 | 931 | retval.pulls_url = json["pulls_url"]; |
| 918 | 932 | retval.pushed_at = json["pushed_at"]; |
| 919 | 933 | retval.releases_url = json["releases_url"]; |
| 934 | + if (json["private"] != Standards.JSON.true && json["private"] != Standards.JSON.false) error("Expected bool"); | |
| 920 | 935 | retval.repo_private = json["private"]; |
| 921 | 936 | retval.size = json["size"]; |
| 922 | 937 | retval.ssh_url = json["ssh_url"]; |
Test case
1 generated file · +1 −0test/inputs/json/samples/kitchen-sink.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -53,6 +53,7 @@ class TopLevel { | ||
| 53 | 53 | TopLevel TopLevel_from_JSON(mixed json) { |
| 54 | 54 | TopLevel retval = TopLevel(); |
| 55 | 55 | |
| 56 | + if (json["booleanValue"] != Standards.JSON.true && json["booleanValue"] != Standards.JSON.false) error("Expected bool"); | |
| 56 | 57 | retval.boolean_value = json["booleanValue"]; |
| 57 | 58 | retval.date_value = json["dateValue"]; |
| 58 | 59 | retval.different_things = json["differentThings"]; |
Test case
1 generated file · +19 −0test/inputs/json/samples/reddit.json
Mpikedefault / TopLevel.pmod+19 −0
| @@ -234,6 +234,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 234 | 234 | |
| 235 | 235 | retval.approved_at_utc = json["approved_at_utc"]; |
| 236 | 236 | retval.approved_by = json["approved_by"]; |
| 237 | + if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool"); | |
| 237 | 238 | retval.archived = json["archived"]; |
| 238 | 239 | retval.author = json["author"]; |
| 239 | 240 | if (!has_index(json, "author_flair_css_class")) error("Missing required property"); |
| @@ -242,10 +243,15 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 242 | 243 | retval.author_flair_text = json["author_flair_text"]; |
| 243 | 244 | retval.banned_at_utc = json["banned_at_utc"]; |
| 244 | 245 | retval.banned_by = json["banned_by"]; |
| 246 | + if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool"); | |
| 245 | 247 | retval.brand_safe = json["brand_safe"]; |
| 248 | + if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool"); | |
| 246 | 249 | retval.can_gild = json["can_gild"]; |
| 250 | + if (json["can_mod_post"] != Standards.JSON.true && json["can_mod_post"] != Standards.JSON.false) error("Expected bool"); | |
| 247 | 251 | retval.can_mod_post = json["can_mod_post"]; |
| 252 | + if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool"); | |
| 248 | 253 | retval.clicked = json["clicked"]; |
| 254 | + if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool"); | |
| 249 | 255 | retval.contest_mode = json["contest_mode"]; |
| 250 | 256 | retval.created = json["created"]; |
| 251 | 257 | retval.created_utc = json["created_utc"]; |
| @@ -253,18 +259,24 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 253 | 259 | retval.distinguished = json["distinguished"]; |
| 254 | 260 | retval.domain = Domain_from_JSON(json["domain"]); |
| 255 | 261 | retval.downs = json["downs"]; |
| 262 | + if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool"); | |
| 256 | 263 | retval.edited = json["edited"]; |
| 257 | 264 | retval.gilded = json["gilded"]; |
| 265 | + if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool"); | |
| 258 | 266 | retval.hidden = json["hidden"]; |
| 267 | + if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool"); | |
| 259 | 268 | retval.hide_score = json["hide_score"]; |
| 260 | 269 | retval.id = json["id"]; |
| 270 | + if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool"); | |
| 261 | 271 | retval.is_self = json["is_self"]; |
| 272 | + if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool"); | |
| 262 | 273 | retval.is_video = json["is_video"]; |
| 263 | 274 | retval.likes = json["likes"]; |
| 264 | 275 | if (!has_index(json, "link_flair_css_class")) error("Missing required property"); |
| 265 | 276 | retval.link_flair_css_class = json["link_flair_css_class"]; |
| 266 | 277 | if (!has_index(json, "link_flair_text")) error("Missing required property"); |
| 267 | 278 | retval.link_flair_text = json["link_flair_text"]; |
| 279 | + if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool"); | |
| 268 | 280 | retval.locked = json["locked"]; |
| 269 | 281 | retval.media = json["media"]; |
| 270 | 282 | retval.media_embed = json["media_embed"]; |
| @@ -272,21 +284,26 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 272 | 284 | retval.name = json["name"]; |
| 273 | 285 | retval.num_comments = json["num_comments"]; |
| 274 | 286 | retval.num_reports = json["num_reports"]; |
| 287 | + if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool"); | |
| 275 | 288 | retval.over_18 = json["over_18"]; |
| 276 | 289 | retval.parent_whitelist_status = WhitelistStatus_from_JSON(json["parent_whitelist_status"]); |
| 277 | 290 | retval.permalink = json["permalink"]; |
| 278 | 291 | retval.post_hint = PostHint_from_JSON(json["post_hint"]); |
| 279 | 292 | retval.preview = json["preview"]; |
| 293 | + if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool"); | |
| 280 | 294 | retval.quarantine = json["quarantine"]; |
| 281 | 295 | retval.removal_reason = json["removal_reason"]; |
| 282 | 296 | retval.report_reasons = json["report_reasons"]; |
| 297 | + if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool"); | |
| 283 | 298 | retval.saved = json["saved"]; |
| 284 | 299 | retval.score = json["score"]; |
| 285 | 300 | retval.secure_media = json["secure_media"]; |
| 286 | 301 | retval.secure_media_embed = json["secure_media_embed"]; |
| 287 | 302 | retval.selftext = json["selftext"]; |
| 288 | 303 | retval.selftext_html = json["selftext_html"]; |
| 304 | + if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool"); | |
| 289 | 305 | retval.spoiler = json["spoiler"]; |
| 306 | + if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool"); | |
| 290 | 307 | retval.stickied = json["stickied"]; |
| 291 | 308 | retval.subreddit = Subreddit_from_JSON(json["subreddit"]); |
| 292 | 309 | retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]); |
| @@ -301,6 +318,7 @@ ChildData ChildData_from_JSON(mixed json) { | ||
| 301 | 318 | retval.url = json["url"]; |
| 302 | 319 | retval.user_reports = json["user_reports"]; |
| 303 | 320 | retval.view_count = json["view_count"]; |
| 321 | + if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool"); | |
| 304 | 322 | retval.visited = json["visited"]; |
| 305 | 323 | retval.whitelist_status = WhitelistStatus_from_JSON(json["whitelist_status"]); |
| 306 | 324 | |
| @@ -368,6 +386,7 @@ class Preview { | ||
| 368 | 386 | Preview Preview_from_JSON(mixed json) { |
| 369 | 387 | Preview retval = Preview(); |
| 370 | 388 | |
| 389 | + if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool"); | |
| 371 | 390 | retval.enabled = json["enabled"]; |
| 372 | 391 | retval.images = json["images"]; |
Test case
1 generated file · +1 −0test/inputs/json/samples/simple-object.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -33,6 +33,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 33 | 33 | |
| 34 | 34 | retval.date = json["date"]; |
| 35 | 35 | retval.title = json["title"]; |
| 36 | + if (json["validity"] != Standards.JSON.true && json["validity"] != Standards.JSON.false) error("Expected bool"); | |
| 36 | 37 | retval.validity = json["validity"]; |
| 37 | 38 | |
| 38 | 39 | return retval; |
Test case
1 generated file · +1 −0test/inputs/json/samples/spotify-album.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -285,6 +285,7 @@ Item Item_from_JSON(mixed json) { | ||
| 285 | 285 | retval.available_markets = json["available_markets"]; |
| 286 | 286 | retval.disc_number = json["disc_number"]; |
| 287 | 287 | retval.duration_ms = json["duration_ms"]; |
| 288 | + if (json["explicit"] != Standards.JSON.true && json["explicit"] != Standards.JSON.false) error("Expected bool"); | |
| 288 | 289 | retval.explicit = json["explicit"]; |
| 289 | 290 | retval.external_urls = json["external_urls"]; |
| 290 | 291 | retval.href = json["href"]; |
Test case
1 generated file · +1 −0test/inputs/json/samples/us-senators.json
Mpikedefault / TopLevel.pmod+1 −0
| @@ -121,6 +121,7 @@ Object Object_from_JSON(mixed json) { | ||
| 121 | 121 | if (!has_index(json, "caucus")) error("Missing required property"); |
| 122 | 122 | retval.caucus = Party_from_JSON(json["caucus"]); |
| 123 | 123 | retval.congress_numbers = json["congress_numbers"]; |
| 124 | + if (json["current"] != Standards.JSON.true && json["current"] != Standards.JSON.false) error("Expected bool"); | |
| 124 | 125 | retval.current = json["current"]; |
| 125 | 126 | retval.description = json["description"]; |
| 126 | 127 | retval.district = json["district"]; |
Test case
1 generated file · +1 −0test/inputs/schema/const-non-string.schema
Mschema-pikedefault / TopLevel.pmod+1 −0
| @@ -36,6 +36,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | 38 | retval.amount = json["amount"]; |
| 39 | + if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool"); | |
| 39 | 40 | retval.enabled = json["enabled"]; |
| 40 | 41 | retval.kind = Kind_from_JSON(json["kind"]); |
| 41 | 42 | retval.ratio = (float)json["ratio"]; |
Test case
1 generated file · +1 −0test/inputs/schema/implicit-all-of.schema
Mschema-pikedefault / TopLevel.pmod+1 −0
| @@ -32,6 +32,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 32 | 32 | TopLevel retval = TopLevel(); |
| 33 | 33 | |
| 34 | 34 | retval.foo = json["foo"]; |
| 35 | + if (json["bar"] != Standards.JSON.true && json["bar"] != Standards.JSON.false) error("Expected bool"); | |
| 35 | 36 | retval.bar = json["bar"]; |
| 36 | 37 | retval.quux = json["quux"]; |
Test case
1 generated file · +1 −0test/inputs/schema/non-standard-ref.schema
Mschema-pikedefault / TopLevel.pmod+1 −0
| @@ -33,6 +33,7 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 33 | 33 | |
| 34 | 34 | retval.bar = json["bar"]; |
| 35 | 35 | retval.foo = json["foo"]; |
| 36 | + if (json["quux"] != Standards.JSON.true && json["quux"] != Standards.JSON.false) error("Expected bool"); | |
| 36 | 37 | retval.quux = json["quux"]; |
| 37 | 38 | |
| 38 | 39 | return retval; |
Test case
1 generated file · +37 −0test/inputs/schema/optional-any.schema
Aschema-pikedefault / TopLevel.pmod+37 −0
| @@ -0,0 +1,37 @@ | ||
| 1 | +// This source has been automatically generated by quicktype. | |
| 2 | +// ( https://github.com/quicktype/quicktype ) | |
| 3 | +// | |
| 4 | +// To use this code, simply import it into your project as a Pike module. | |
| 5 | +// To JSON-encode your object, you can pass it to `Standards.JSON.encode` | |
| 6 | +// or call `encode_json` on it. | |
| 7 | +// | |
| 8 | +// To decode a JSON string, first pass it to `Standards.JSON.decode`, | |
| 9 | +// and then pass the result to `<YourClass>_from_JSON`. | |
| 10 | +// It will return an instance of <YourClass>. | |
| 11 | +// Bear in mind that these functions have unexpected behavior, | |
| 12 | +// and will likely throw an error, if the JSON string does not | |
| 13 | +// match the expected interface, even if the JSON itself is valid. | |
| 14 | + | |
| 15 | +class TopLevel { | |
| 16 | + bool bar; // json: "bar" | |
| 17 | + mixed foo; // json: "foo" | |
| 18 | + | |
| 19 | + string encode_json() { | |
| 20 | + mapping(string:mixed) json = ([ | |
| 21 | + "bar" : bar, | |
| 22 | + "foo" : foo, | |
| 23 | + ]); | |
| 24 | + | |
| 25 | + return Standards.JSON.encode(json); | |
| 26 | + } | |
| 27 | +} | |
| 28 | + | |
| 29 | +TopLevel TopLevel_from_JSON(mixed json) { | |
| 30 | + TopLevel retval = TopLevel(); | |
| 31 | + | |
| 32 | + if (json["bar"] != Standards.JSON.true && json["bar"] != Standards.JSON.false) error("Expected bool"); | |
| 33 | + retval.bar = json["bar"]; | |
| 34 | + retval.foo = json["foo"]; | |
| 35 | + | |
| 36 | + return retval; | |
| 37 | +} |
Test case
1 generated file · +1 −0test/inputs/schema/union.schema
Mschema-pikedefault / TopLevel.pmod+1 −0
| @@ -38,6 +38,7 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) { | ||
| 38 | 38 | TopLevelElement retval = TopLevelElement(); |
| 39 | 39 | |
| 40 | 40 | retval.one = json["one"]; |
| 41 | + if (json["two"] != Standards.JSON.true && json["two"] != Standards.JSON.false) error("Expected bool"); | |
| 41 | 42 | retval.two = json["two"]; |
| 42 | 43 | retval.three = json["three"]; |
No generated files match these filters.