Generated-output differences

quicktype output changed between the PR base and tested PR merge revisions.
← Back to the pull request
65test cases
65files differ
64modified
1new
0deleted
357changed lines
+357 −0insertions / deletions
Base 0caec23032712f67286ebec6c5773e3265c0e70c · PR merge 370891247e74a45b953b37a6fc59808a6b378053 · Head 5db5e714fe0197e54b0ad2f7b6897c4c24b7a31b · raw patch
Test case

test/inputs/graphql/github9.graphql

1 generated file · +1 −0
Mgraphql-pikedefault / TopLevel.pmod+1 −0
@@ -134,6 +134,7 @@ class Reactable {
134134 Reactable Reactable_from_JSON(mixed json) {
135135 Reactable retval = Reactable();
136136
137+ if (json["viewerCanReact"] != Standards.JSON.true && json["viewerCanReact"] != Standards.JSON.false) error("Expected bool");
137138 retval.viewer_can_react = json["viewerCanReact"];
138139 if (!has_index(json, "reactionGroups")) error("Missing required property");
139140 retval.reaction_groups = json["reactionGroups"];
Test case

test/inputs/json/misc/00ec5.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -251,6 +251,7 @@ Parameter Parameter_from_JSON(mixed json) {
251251 retval.format = Type_from_JSON(json["format"]);
252252 retval.in = json["in"];
253253 retval.name = json["name"];
254+ if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool");
254255 retval.required = json["required"];
255256 retval.type = Type_from_JSON(json["type"]);
Test case

test/inputs/json/misc/0a358.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
4444 retval.limit = json["limit"];
4545 retval.next = json["next"];
4646 retval.offset = json["offset"];
47+ if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool");
4748 retval.previous = json["previous"];
4849 retval.results = json["results"];
Test case

test/inputs/json/misc/0a91a.json

1 generated file · +13 −0
Mpikedefault / TopLevel.pmod+13 −0
@@ -53,6 +53,7 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) {
5353 retval.org = json["org"];
5454 retval.payload = json["payload"];
5555 retval.repo = json["repo"];
56+ if (json["public"] != Standards.JSON.true && json["public"] != Standards.JSON.false) error("Expected bool");
5657 retval.top_level_public = json["public"];
5758 retval.type = Type_from_JSON(json["type"]);
5859
@@ -177,6 +178,7 @@ Commit Commit_from_JSON(mixed json) {
177178 Commit retval = Commit();
178179
179180 retval.author = json["author"];
181+ if (json["distinct"] != Standards.JSON.true && json["distinct"] != Standards.JSON.false) error("Expected bool");
180182 retval.distinct = json["distinct"];
181183 retval.message = json["message"];
182184 retval.sha = json["sha"];
@@ -322,11 +324,14 @@ PullRequest PullRequest_from_JSON(mixed json) {
322324 retval.id = json["id"];
323325 retval.issue_url = json["issue_url"];
324326 retval.links = json["_links"];
327+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
325328 retval.locked = json["locked"];
329+ if (json["maintainer_can_modify"] != Standards.JSON.true && json["maintainer_can_modify"] != Standards.JSON.false) error("Expected bool");
326330 retval.maintainer_can_modify = json["maintainer_can_modify"];
327331 retval.merge_commit_sha = json["merge_commit_sha"];
328332 retval.mergeable = json["mergeable"];
329333 retval.mergeable_state = json["mergeable_state"];
334+ if (json["merged"] != Standards.JSON.true && json["merged"] != Standards.JSON.false) error("Expected bool");
330335 retval.merged = json["merged"];
331336 retval.merged_at = json["merged_at"];
332337 retval.merged_by = json["merged_by"];
@@ -548,6 +553,7 @@ BaseRepo BaseRepo_from_JSON(mixed json) {
548553 retval.description = json["description"];
549554 retval.downloads_url = json["downloads_url"];
550555 retval.events_url = json["events_url"];
556+ if (json["fork"] != Standards.JSON.true && json["fork"] != Standards.JSON.false) error("Expected bool");
551557 retval.fork = json["fork"];
552558 retval.forks = json["forks"];
553559 retval.forks_count = json["forks_count"];
@@ -557,10 +563,15 @@ BaseRepo BaseRepo_from_JSON(mixed json) {
557563 retval.git_refs_url = json["git_refs_url"];
558564 retval.git_tags_url = json["git_tags_url"];
559565 retval.git_url = json["git_url"];
566+ if (json["has_downloads"] != Standards.JSON.true && json["has_downloads"] != Standards.JSON.false) error("Expected bool");
560567 retval.has_downloads = json["has_downloads"];
568+ if (json["has_issues"] != Standards.JSON.true && json["has_issues"] != Standards.JSON.false) error("Expected bool");
561569 retval.has_issues = json["has_issues"];
570+ if (json["has_pages"] != Standards.JSON.true && json["has_pages"] != Standards.JSON.false) error("Expected bool");
562571 retval.has_pages = json["has_pages"];
572+ if (json["has_projects"] != Standards.JSON.true && json["has_projects"] != Standards.JSON.false) error("Expected bool");
563573 retval.has_projects = json["has_projects"];
574+ if (json["has_wiki"] != Standards.JSON.true && json["has_wiki"] != Standards.JSON.false) error("Expected bool");
564575 retval.has_wiki = json["has_wiki"];
565576 retval.homepage = json["homepage"];
566577 retval.hooks_url = json["hooks_url"];
@@ -584,6 +595,7 @@ BaseRepo BaseRepo_from_JSON(mixed json) {
584595 retval.pulls_url = json["pulls_url"];
585596 retval.pushed_at = json["pushed_at"];
586597 retval.releases_url = json["releases_url"];
598+ if (json["private"] != Standards.JSON.true && json["private"] != Standards.JSON.false) error("Expected bool");
587599 retval.repo_private = json["private"];
588600 retval.size = json["size"];
589601 retval.ssh_url = json["ssh_url"];
@@ -663,6 +675,7 @@ MergedBy MergedBy_from_JSON(mixed json) {
663675 retval.organizations_url = json["organizations_url"];
664676 retval.received_events_url = json["received_events_url"];
665677 retval.repos_url = json["repos_url"];
678+ if (json["site_admin"] != Standards.JSON.true && json["site_admin"] != Standards.JSON.false) error("Expected bool");
666679 retval.site_admin = json["site_admin"];
667680 retval.starred_url = json["starred_url"];
668681 retval.subscriptions_url = json["subscriptions_url"];
Test case

test/inputs/json/misc/0e0c2.json

1 generated file · +3 −0
Mpikedefault / TopLevel.pmod+3 −0
@@ -199,8 +199,11 @@ class FavMovie {
199199 FavMovie FavMovie_from_JSON(mixed json) {
200200 FavMovie retval = FavMovie();
201201
202+ if (json["follow"] != Standards.JSON.true && json["follow"] != Standards.JSON.false) error("Expected bool");
202203 retval.follow = json["follow"];
204+ if (json["star"] != Standards.JSON.true && json["star"] != Standards.JSON.false) error("Expected bool");
203205 retval.star = json["star"];
206+ if (json["watched"] != Standards.JSON.true && json["watched"] != Standards.JSON.false) error("Expected bool");
204207 retval.watched = json["watched"];
205208
206209 return retval;
Test case

test/inputs/json/misc/1b409.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -118,6 +118,7 @@ Object Object_from_JSON(mixed json) {
118118
119119 retval.caucus = json["caucus"];
120120 retval.congress_numbers = json["congress_numbers"];
121+ if (json["current"] != Standards.JSON.true && json["current"] != Standards.JSON.false) error("Expected bool");
121122 retval.current = json["current"];
122123 retval.description = json["description"];
123124 retval.district = json["district"];
Test case

test/inputs/json/misc/2465e.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -278,6 +278,7 @@ Parameter Parameter_from_JSON(mixed json) {
278278 retval.format = json["format"];
279279 retval.in = json["in"];
280280 retval.name = json["name"];
281+ if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool");
281282 retval.required = json["required"];
282283 retval.type = json["type"];
Test case

test/inputs/json/misc/26c9c.json

1 generated file · +8 −0
Mpikedefault / TopLevel.pmod+8 −0
@@ -161,18 +161,22 @@ View View_from_JSON(mixed json) {
161161 retval.download_count = json["downloadCount"];
162162 retval.flags = json["flags"];
163163 retval.grants = json["grants"];
164+ if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool");
164165 retval.hide_from_catalog = json["hideFromCatalog"];
166+ if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool");
165167 retval.hide_from_data_json = json["hideFromDataJson"];
166168 retval.id = json["id"];
167169 retval.index_updated_at = json["indexUpdatedAt"];
168170 retval.locale = json["locale"];
169171 retval.metadata = json["metadata"];
170172 retval.name = json["name"];
173+ if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool");
171174 retval.new_backend = json["newBackend"];
172175 retval.number_of_comments = json["numberOfComments"];
173176 retval.oid = json["oid"];
174177 retval.owner = json["owner"];
175178 retval.provenance = json["provenance"];
179+ if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool");
176180 retval.publication_append_enabled = json["publicationAppendEnabled"];
177181 retval.publication_date = json["publicationDate"];
178182 retval.publication_group = json["publicationGroup"];
@@ -352,6 +356,7 @@ Grant Grant_from_JSON(mixed json) {
352356 Grant retval = Grant();
353357
354358 retval.flags = json["flags"];
359+ if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool");
355360 retval.inherited = json["inherited"];
356361 retval.type = json["type"];
357362
@@ -624,6 +629,7 @@ class Order {
624629 Order Order_from_JSON(mixed json) {
625630 Order retval = Order();
626631
632+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
627633 retval.ascending = json["ascending"];
628634 retval.column_field_name = json["columnFieldName"];
629635
@@ -665,6 +671,7 @@ class Visible {
665671 Visible Visible_from_JSON(mixed json) {
666672 Visible retval = Visible();
667673
674+ if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool");
668675 retval.table = json["table"];
669676
670677 return retval;
@@ -748,6 +755,7 @@ class OrderBy {
748755 OrderBy OrderBy_from_JSON(mixed json) {
749756 OrderBy retval = OrderBy();
750757
758+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
751759 retval.ascending = json["ascending"];
752760 retval.expression = json["expression"];
Test case

test/inputs/json/misc/27332.json

1 generated file · +19 −0
Mpikedefault / TopLevel.pmod+19 −0
@@ -230,6 +230,7 @@ ChildData ChildData_from_JSON(mixed json) {
230230
231231 retval.approved_at_utc = json["approved_at_utc"];
232232 retval.approved_by = json["approved_by"];
233+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
233234 retval.archived = json["archived"];
234235 retval.author = json["author"];
235236 if (!has_index(json, "author_flair_css_class")) error("Missing required property");
@@ -238,10 +239,15 @@ ChildData ChildData_from_JSON(mixed json) {
238239 retval.author_flair_text = json["author_flair_text"];
239240 retval.banned_at_utc = json["banned_at_utc"];
240241 retval.banned_by = json["banned_by"];
242+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
241243 retval.brand_safe = json["brand_safe"];
244+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
242245 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");
243247 retval.can_mod_post = json["can_mod_post"];
248+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
244249 retval.clicked = json["clicked"];
250+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
245251 retval.contest_mode = json["contest_mode"];
246252 retval.created = (float)json["created"];
247253 retval.created_utc = (float)json["created_utc"];
@@ -249,18 +255,24 @@ ChildData ChildData_from_JSON(mixed json) {
249255 retval.distinguished = json["distinguished"];
250256 retval.domain = Domain_from_JSON(json["domain"]);
251257 retval.downs = json["downs"];
258+ if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool");
252259 retval.edited = json["edited"];
253260 retval.gilded = json["gilded"];
261+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
254262 retval.hidden = json["hidden"];
263+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
255264 retval.hide_score = json["hide_score"];
256265 retval.id = json["id"];
266+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
257267 retval.is_self = json["is_self"];
268+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
258269 retval.is_video = json["is_video"];
259270 retval.likes = json["likes"];
260271 if (!has_index(json, "link_flair_css_class")) error("Missing required property");
261272 retval.link_flair_css_class = json["link_flair_css_class"];
262273 if (!has_index(json, "link_flair_text")) error("Missing required property");
263274 retval.link_flair_text = json["link_flair_text"];
275+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
264276 retval.locked = json["locked"];
265277 if (!has_index(json, "media")) error("Missing required property");
266278 retval.media = json["media"];
@@ -269,13 +281,16 @@ ChildData ChildData_from_JSON(mixed json) {
269281 retval.name = json["name"];
270282 retval.num_comments = json["num_comments"];
271283 retval.num_reports = json["num_reports"];
284+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
272285 retval.over_18 = json["over_18"];
273286 retval.permalink = json["permalink"];
274287 retval.post_hint = PostHint_from_JSON(json["post_hint"]);
275288 retval.preview = json["preview"];
289+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
276290 retval.quarantine = json["quarantine"];
277291 retval.removal_reason = json["removal_reason"];
278292 retval.report_reasons = json["report_reasons"];
293+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
279294 retval.saved = json["saved"];
280295 retval.score = json["score"];
281296 if (!has_index(json, "secure_media")) error("Missing required property");
@@ -284,7 +299,9 @@ ChildData ChildData_from_JSON(mixed json) {
284299 retval.selftext = json["selftext"];
285300 if (!has_index(json, "selftext_html")) error("Missing required property");
286301 retval.selftext_html = json["selftext_html"];
302+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
287303 retval.spoiler = json["spoiler"];
304+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
288305 retval.stickied = json["stickied"];
289306 retval.subreddit = Subreddit_from_JSON(json["subreddit"]);
290307 retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]);
@@ -301,6 +318,7 @@ ChildData ChildData_from_JSON(mixed json) {
301318 retval.url = json["url"];
302319 retval.user_reports = json["user_reports"];
303320 retval.view_count = json["view_count"];
321+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
304322 retval.visited = json["visited"];
305323
306324 return retval;
@@ -448,6 +466,7 @@ class Preview {
448466 Preview Preview_from_JSON(mixed json) {
449467 Preview retval = Preview();
450468
469+ if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool");
451470 retval.enabled = json["enabled"];
452471 retval.images = json["images"];
Test case

test/inputs/json/misc/29f47.json

1 generated file · +18 −0
Mpikedefault / TopLevel.pmod+18 −0
@@ -230,16 +230,22 @@ ChildData ChildData_from_JSON(mixed json) {
230230
231231 retval.approved_at_utc = json["approved_at_utc"];
232232 retval.approved_by = json["approved_by"];
233+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
233234 retval.archived = json["archived"];
234235 retval.author = json["author"];
235236 retval.author_flair_css_class = json["author_flair_css_class"];
236237 retval.author_flair_text = json["author_flair_text"];
237238 retval.banned_at_utc = json["banned_at_utc"];
238239 retval.banned_by = json["banned_by"];
240+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
239241 retval.brand_safe = json["brand_safe"];
242+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
240243 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");
241245 retval.can_mod_post = json["can_mod_post"];
246+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
242247 retval.clicked = json["clicked"];
248+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
243249 retval.contest_mode = json["contest_mode"];
244250 retval.created = (float)json["created"];
245251 retval.created_utc = (float)json["created_utc"];
@@ -249,14 +255,19 @@ ChildData ChildData_from_JSON(mixed json) {
249255 if (arrayp(json["edited"])) error("Unexpected array");
250256 retval.edited = json["edited"];
251257 retval.gilded = json["gilded"];
258+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
252259 retval.hidden = json["hidden"];
260+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
253261 retval.hide_score = json["hide_score"];
254262 retval.id = json["id"];
263+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
255264 retval.is_self = json["is_self"];
265+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
256266 retval.is_video = json["is_video"];
257267 retval.likes = json["likes"];
258268 retval.link_flair_css_class = json["link_flair_css_class"];
259269 retval.link_flair_text = json["link_flair_text"];
270+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
260271 retval.locked = json["locked"];
261272 retval.media = json["media"];
262273 retval.media_embed = json["media_embed"];
@@ -264,13 +275,16 @@ ChildData ChildData_from_JSON(mixed json) {
264275 retval.name = json["name"];
265276 retval.num_comments = json["num_comments"];
266277 retval.num_reports = json["num_reports"];
278+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
267279 retval.over_18 = json["over_18"];
268280 retval.permalink = json["permalink"];
269281 retval.post_hint = PostHint_from_JSON(json["post_hint"]);
270282 retval.preview = json["preview"];
283+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
271284 retval.quarantine = json["quarantine"];
272285 retval.removal_reason = json["removal_reason"];
273286 retval.report_reasons = json["report_reasons"];
287+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
274288 retval.saved = json["saved"];
275289 retval.score = json["score"];
276290 retval.secure_media = json["secure_media"];
@@ -278,7 +292,9 @@ ChildData ChildData_from_JSON(mixed json) {
278292 retval.selftext = json["selftext"];
279293 if (!has_index(json, "selftext_html")) error("Missing required property");
280294 retval.selftext_html = json["selftext_html"];
295+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
281296 retval.spoiler = json["spoiler"];
297+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
282298 retval.stickied = json["stickied"];
283299 retval.subreddit = Subreddit_from_JSON(json["subreddit"]);
284300 retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]);
@@ -296,6 +312,7 @@ ChildData ChildData_from_JSON(mixed json) {
296312 retval.url = json["url"];
297313 retval.user_reports = json["user_reports"];
298314 retval.view_count = json["view_count"];
315+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
299316 retval.visited = json["visited"];
300317
301318 return retval;
@@ -366,6 +383,7 @@ class Preview {
366383 Preview Preview_from_JSON(mixed json) {
367384 Preview retval = Preview();
368385
386+ if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool");
369387 retval.enabled = json["enabled"];
370388 retval.images = json["images"];
Test case

test/inputs/json/misc/2d4e2.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -123,6 +123,7 @@ Object Object_from_JSON(mixed json) {
123123 if (!has_index(json, "caucus")) error("Missing required property");
124124 retval.caucus = Party_from_JSON(json["caucus"]);
125125 retval.congress_numbers = json["congress_numbers"];
126+ if (json["current"] != Standards.JSON.true && json["current"] != Standards.JSON.false) error("Expected bool");
126127 retval.current = json["current"];
127128 retval.description = json["description"];
128129 retval.district = json["district"];
Test case

test/inputs/json/misc/32d5c.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -49,6 +49,7 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) {
4949
5050 if (!has_index(json, "BirthDate")) error("Missing required property");
5151 retval.birth_date = json["BirthDate"];
52+ if (json["BirthDateIsProtected"] != Standards.JSON.true && json["BirthDateIsProtected"] != Standards.JSON.false) error("Expected bool");
5253 retval.birth_date_is_protected = json["BirthDateIsProtected"];
5354 retval.gender_type_id = json["GenderTypeID"];
5455 retval.notes = json["Notes"];
Test case

test/inputs/json/misc/337ed.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
4444 retval.limit = json["limit"];
4545 retval.next = json["next"];
4646 retval.offset = json["offset"];
47+ if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool");
4748 retval.previous = json["previous"];
4849 retval.results = json["results"];
Test case

test/inputs/json/misc/421d4.json

1 generated file · +6 −0
Mpikedefault / TopLevel.pmod+6 −0
@@ -164,7 +164,9 @@ View View_from_JSON(mixed json) {
164164 retval.download_count = json["downloadCount"];
165165 retval.flags = json["flags"];
166166 retval.grants = json["grants"];
167+ if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool");
167168 retval.hide_from_catalog = json["hideFromCatalog"];
169+ if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool");
168170 retval.hide_from_data_json = json["hideFromDataJson"];
169171 retval.id = json["id"];
170172 retval.index_updated_at = json["indexUpdatedAt"];
@@ -173,11 +175,13 @@ View View_from_JSON(mixed json) {
173175 retval.locale = json["locale"];
174176 retval.metadata = json["metadata"];
175177 retval.name = json["name"];
178+ if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool");
176179 retval.new_backend = json["newBackend"];
177180 retval.number_of_comments = json["numberOfComments"];
178181 retval.oid = json["oid"];
179182 retval.owner = json["owner"];
180183 retval.provenance = json["provenance"];
184+ if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool");
181185 retval.publication_append_enabled = json["publicationAppendEnabled"];
182186 retval.publication_date = json["publicationDate"];
183187 retval.publication_group = json["publicationGroup"];
@@ -345,6 +349,7 @@ Grant Grant_from_JSON(mixed json) {
345349 Grant retval = Grant();
346350
347351 retval.flags = json["flags"];
352+ if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool");
348353 retval.inherited = json["inherited"];
349354 retval.type = json["type"];
350355
@@ -438,6 +443,7 @@ class Visible {
438443 Visible Visible_from_JSON(mixed json) {
439444 Visible retval = Visible();
440445
446+ if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool");
441447 retval.table = json["table"];
442448
443449 return retval;
Test case

test/inputs/json/misc/4d6fb.json

1 generated file · +19 −0
Mpikedefault / TopLevel.pmod+19 −0
@@ -230,32 +230,44 @@ ChildData ChildData_from_JSON(mixed json) {
230230
231231 retval.approved_at_utc = json["approved_at_utc"];
232232 retval.approved_by = json["approved_by"];
233+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
233234 retval.archived = json["archived"];
234235 retval.author = json["author"];
235236 retval.author_flair_css_class = json["author_flair_css_class"];
236237 retval.author_flair_text = json["author_flair_text"];
237238 retval.banned_at_utc = json["banned_at_utc"];
238239 retval.banned_by = json["banned_by"];
240+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
239241 retval.brand_safe = json["brand_safe"];
242+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
240243 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");
241245 retval.can_mod_post = json["can_mod_post"];
246+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
242247 retval.clicked = json["clicked"];
248+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
243249 retval.contest_mode = json["contest_mode"];
244250 retval.created = (float)json["created"];
245251 retval.created_utc = (float)json["created_utc"];
246252 retval.distinguished = json["distinguished"];
247253 retval.domain = json["domain"];
248254 retval.downs = json["downs"];
255+ if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool");
249256 retval.edited = json["edited"];
250257 retval.gilded = json["gilded"];
258+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
251259 retval.hidden = json["hidden"];
260+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
252261 retval.hide_score = json["hide_score"];
253262 retval.id = json["id"];
263+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
254264 retval.is_self = json["is_self"];
265+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
255266 retval.is_video = json["is_video"];
256267 retval.likes = json["likes"];
257268 retval.link_flair_css_class = json["link_flair_css_class"];
258269 retval.link_flair_text = json["link_flair_text"];
270+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
259271 retval.locked = json["locked"];
260272 if (!has_index(json, "media")) error("Missing required property");
261273 retval.media = json["media"];
@@ -264,13 +276,16 @@ ChildData ChildData_from_JSON(mixed json) {
264276 retval.name = json["name"];
265277 retval.num_comments = json["num_comments"];
266278 retval.num_reports = json["num_reports"];
279+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
267280 retval.over_18 = json["over_18"];
268281 retval.permalink = json["permalink"];
269282 retval.post_hint = PostHint_from_JSON(json["post_hint"]);
270283 retval.preview = json["preview"];
284+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
271285 retval.quarantine = json["quarantine"];
272286 retval.removal_reason = json["removal_reason"];
273287 retval.report_reasons = json["report_reasons"];
288+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
274289 retval.saved = json["saved"];
275290 retval.score = json["score"];
276291 if (!has_index(json, "secure_media")) error("Missing required property");
@@ -278,7 +293,9 @@ ChildData ChildData_from_JSON(mixed json) {
278293 retval.secure_media_embed = json["secure_media_embed"];
279294 retval.selftext = json["selftext"];
280295 retval.selftext_html = json["selftext_html"];
296+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
281297 retval.spoiler = json["spoiler"];
298+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
282299 retval.stickied = json["stickied"];
283300 retval.subreddit = Subreddit_from_JSON(json["subreddit"]);
284301 retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]);
@@ -295,6 +312,7 @@ ChildData ChildData_from_JSON(mixed json) {
295312 retval.url = json["url"];
296313 retval.user_reports = json["user_reports"];
297314 retval.view_count = json["view_count"];
315+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
298316 retval.visited = json["visited"];
299317
300318 return retval;
@@ -434,6 +452,7 @@ class Preview {
434452 Preview Preview_from_JSON(mixed json) {
435453 Preview retval = Preview();
436454
455+ if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool");
437456 retval.enabled = json["enabled"];
438457 retval.images = json["images"];
Test case

test/inputs/json/misc/54d32.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
4444 retval.limit = json["limit"];
4545 retval.next = json["next"];
4646 retval.offset = json["offset"];
47+ if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool");
4748 retval.previous = json["previous"];
4849 retval.results = json["results"];
Test case

test/inputs/json/misc/5f7fe.json

1 generated file · +8 −0
Mpikedefault / TopLevel.pmod+8 −0
@@ -161,18 +161,22 @@ View View_from_JSON(mixed json) {
161161 retval.download_count = json["downloadCount"];
162162 retval.flags = json["flags"];
163163 retval.grants = json["grants"];
164+ if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool");
164165 retval.hide_from_catalog = json["hideFromCatalog"];
166+ if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool");
165167 retval.hide_from_data_json = json["hideFromDataJson"];
166168 retval.id = json["id"];
167169 retval.index_updated_at = json["indexUpdatedAt"];
168170 retval.locale = json["locale"];
169171 retval.metadata = json["metadata"];
170172 retval.name = json["name"];
173+ if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool");
171174 retval.new_backend = json["newBackend"];
172175 retval.number_of_comments = json["numberOfComments"];
173176 retval.oid = json["oid"];
174177 retval.owner = json["owner"];
175178 retval.provenance = json["provenance"];
179+ if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool");
176180 retval.publication_append_enabled = json["publicationAppendEnabled"];
177181 retval.publication_date = json["publicationDate"];
178182 retval.publication_group = json["publicationGroup"];
@@ -350,6 +354,7 @@ Grant Grant_from_JSON(mixed json) {
350354 Grant retval = Grant();
351355
352356 retval.flags = json["flags"];
357+ if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool");
353358 retval.inherited = json["inherited"];
354359 retval.type = json["type"];
355360
@@ -622,6 +627,7 @@ class Order {
622627 Order Order_from_JSON(mixed json) {
623628 Order retval = Order();
624629
630+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
625631 retval.ascending = json["ascending"];
626632 retval.column_field_name = json["columnFieldName"];
627633
@@ -663,6 +669,7 @@ class Visible {
663669 Visible Visible_from_JSON(mixed json) {
664670 Visible retval = Visible();
665671
672+ if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool");
666673 retval.table = json["table"];
667674
668675 return retval;
@@ -746,6 +753,7 @@ class OrderBy {
746753 OrderBy OrderBy_from_JSON(mixed json) {
747754 OrderBy retval = OrderBy();
748755
756+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
749757 retval.ascending = json["ascending"];
750758 retval.expression = json["expression"];
Test case

test/inputs/json/misc/617e8.json

1 generated file · +8 −0
Mpikedefault / TopLevel.pmod+8 −0
@@ -161,18 +161,22 @@ View View_from_JSON(mixed json) {
161161 retval.download_count = json["downloadCount"];
162162 retval.flags = json["flags"];
163163 retval.grants = json["grants"];
164+ if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool");
164165 retval.hide_from_catalog = json["hideFromCatalog"];
166+ if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool");
165167 retval.hide_from_data_json = json["hideFromDataJson"];
166168 retval.id = json["id"];
167169 retval.index_updated_at = json["indexUpdatedAt"];
168170 retval.locale = json["locale"];
169171 retval.metadata = json["metadata"];
170172 retval.name = json["name"];
173+ if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool");
171174 retval.new_backend = json["newBackend"];
172175 retval.number_of_comments = json["numberOfComments"];
173176 retval.oid = json["oid"];
174177 retval.owner = json["owner"];
175178 retval.provenance = json["provenance"];
179+ if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool");
176180 retval.publication_append_enabled = json["publicationAppendEnabled"];
177181 retval.publication_date = json["publicationDate"];
178182 retval.publication_group = json["publicationGroup"];
@@ -353,6 +357,7 @@ Grant Grant_from_JSON(mixed json) {
353357 Grant retval = Grant();
354358
355359 retval.flags = json["flags"];
360+ if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool");
356361 retval.inherited = json["inherited"];
357362 retval.type = json["type"];
358363
@@ -619,6 +624,7 @@ class Order {
619624 Order Order_from_JSON(mixed json) {
620625 Order retval = Order();
621626
627+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
622628 retval.ascending = json["ascending"];
623629 retval.column_field_name = json["columnFieldName"];
624630
@@ -660,6 +666,7 @@ class Visible {
660666 Visible Visible_from_JSON(mixed json) {
661667 Visible retval = Visible();
662668
669+ if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool");
663670 retval.table = json["table"];
664671
665672 return retval;
@@ -743,6 +750,7 @@ class OrderBy {
743750 OrderBy OrderBy_from_JSON(mixed json) {
744751 OrderBy retval = OrderBy();
745752
753+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
746754 retval.ascending = json["ascending"];
747755 retval.expression = json["expression"];
Test case

test/inputs/json/misc/68c30.json

1 generated file · +2 −0
Mpikedefault / TopLevel.pmod+2 −0
@@ -69,6 +69,7 @@ class Tx {
6969 Tx Tx_from_JSON(mixed json) {
7070 Tx retval = Tx();
7171
72+ if (json["double_spend"] != Standards.JSON.true && json["double_spend"] != Standards.JSON.false) error("Expected bool");
7273 retval.double_spend = json["double_spend"];
7374 retval.hash = json["hash"];
7475 retval.inputs = json["inputs"];
@@ -141,6 +142,7 @@ Out Out_from_JSON(mixed json) {
141142 retval.addr = json["addr"];
142143 retval.n = json["n"];
143144 retval.script = json["script"];
145+ if (json["spent"] != Standards.JSON.true && json["spent"] != Standards.JSON.false) error("Expected bool");
144146 retval.spent = json["spent"];
145147 retval.tx_index = json["tx_index"];
146148 retval.type = json["type"];
Test case

test/inputs/json/misc/6de06.json

1 generated file · +19 −0
Mpikedefault / TopLevel.pmod+19 −0
@@ -230,6 +230,7 @@ ChildData ChildData_from_JSON(mixed json) {
230230
231231 retval.approved_at_utc = json["approved_at_utc"];
232232 retval.approved_by = json["approved_by"];
233+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
233234 retval.archived = json["archived"];
234235 retval.author = json["author"];
235236 if (!has_index(json, "author_flair_css_class")) error("Missing required property");
@@ -238,28 +239,39 @@ ChildData ChildData_from_JSON(mixed json) {
238239 retval.author_flair_text = json["author_flair_text"];
239240 retval.banned_at_utc = json["banned_at_utc"];
240241 retval.banned_by = json["banned_by"];
242+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
241243 retval.brand_safe = json["brand_safe"];
244+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
242245 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");
243247 retval.can_mod_post = json["can_mod_post"];
248+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
244249 retval.clicked = json["clicked"];
250+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
245251 retval.contest_mode = json["contest_mode"];
246252 retval.created = (float)json["created"];
247253 retval.created_utc = (float)json["created_utc"];
248254 retval.distinguished = json["distinguished"];
249255 retval.domain = json["domain"];
250256 retval.downs = json["downs"];
257+ if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool");
251258 retval.edited = json["edited"];
252259 retval.gilded = json["gilded"];
260+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
253261 retval.hidden = json["hidden"];
262+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
254263 retval.hide_score = json["hide_score"];
255264 retval.id = json["id"];
265+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
256266 retval.is_self = json["is_self"];
267+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
257268 retval.is_video = json["is_video"];
258269 retval.likes = json["likes"];
259270 if (!has_index(json, "link_flair_css_class")) error("Missing required property");
260271 retval.link_flair_css_class = json["link_flair_css_class"];
261272 if (!has_index(json, "link_flair_text")) error("Missing required property");
262273 retval.link_flair_text = json["link_flair_text"];
274+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
263275 retval.locked = json["locked"];
264276 if (!has_index(json, "media")) error("Missing required property");
265277 retval.media = json["media"];
@@ -268,13 +280,16 @@ ChildData ChildData_from_JSON(mixed json) {
268280 retval.name = json["name"];
269281 retval.num_comments = json["num_comments"];
270282 retval.num_reports = json["num_reports"];
283+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
271284 retval.over_18 = json["over_18"];
272285 retval.permalink = json["permalink"];
273286 retval.post_hint = PostHint_from_JSON(json["post_hint"]);
274287 retval.preview = json["preview"];
288+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
275289 retval.quarantine = json["quarantine"];
276290 retval.removal_reason = json["removal_reason"];
277291 retval.report_reasons = json["report_reasons"];
292+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
278293 retval.saved = json["saved"];
279294 retval.score = json["score"];
280295 if (!has_index(json, "secure_media")) error("Missing required property");
@@ -283,7 +298,9 @@ ChildData ChildData_from_JSON(mixed json) {
283298 retval.selftext = json["selftext"];
284299 if (!has_index(json, "selftext_html")) error("Missing required property");
285300 retval.selftext_html = json["selftext_html"];
301+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
286302 retval.spoiler = json["spoiler"];
303+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
287304 retval.stickied = json["stickied"];
288305 retval.subreddit = json["subreddit"];
289306 retval.subreddit_id = json["subreddit_id"];
@@ -301,6 +318,7 @@ ChildData ChildData_from_JSON(mixed json) {
301318 retval.url = json["url"];
302319 retval.user_reports = json["user_reports"];
303320 retval.view_count = json["view_count"];
321+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
304322 retval.visited = json["visited"];
305323
306324 return retval;
@@ -438,6 +456,7 @@ class Preview {
438456 Preview Preview_from_JSON(mixed json) {
439457 Preview retval = Preview();
440458
459+ if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool");
441460 retval.enabled = json["enabled"];
442461 retval.images = json["images"];
Test case

test/inputs/json/misc/734ad.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
4444 retval.limit = json["limit"];
4545 retval.next = json["next"];
4646 retval.offset = json["offset"];
47+ if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool");
4748 retval.previous = json["previous"];
4849 retval.results = json["results"];
Test case

test/inputs/json/misc/76ae1.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -570,6 +570,7 @@ Parameter Parameter_from_JSON(mixed json) {
570570 retval.format = FormatEnum_from_JSON(json["format"]);
571571 retval.in = In_from_JSON(json["in"]);
572572 retval.name = json["name"];
573+ if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool");
573574 retval.required = json["required"];
574575 retval.type = FormatEnum_from_JSON(json["type"]);
Test case

test/inputs/json/misc/7d397.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -251,6 +251,7 @@ Parameter Parameter_from_JSON(mixed json) {
251251 retval.format = Type_from_JSON(json["format"]);
252252 retval.in = In_from_JSON(json["in"]);
253253 retval.name = json["name"];
254+ if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool");
254255 retval.required = json["required"];
255256 retval.type = Type_from_JSON(json["type"]);
Test case

test/inputs/json/misc/7eb30.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -84,6 +84,7 @@ Result Result_from_JSON(mixed json) {
8484
8585 retval.code = json["code"];
8686 retval.english = json["english"];
87+ if (json["fav"] != Standards.JSON.true && json["fav"] != Standards.JSON.false) error("Expected bool");
8788 retval.fav = json["fav"];
8889 retval.group = json["group"];
8990 retval.location = Location_from_JSON(json["location"]);
Test case

test/inputs/json/misc/7f568.json

1 generated file · +2 −0
Mpikedefault / TopLevel.pmod+2 −0
@@ -75,7 +75,9 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) {
7575 retval.git_push_url = json["git_push_url"];
7676 retval.html_url = json["html_url"];
7777 retval.id = json["id"];
78+ if (json["public"] != Standards.JSON.true && json["public"] != Standards.JSON.false) error("Expected bool");
7879 retval.top_level_public = json["public"];
80+ if (json["truncated"] != Standards.JSON.true && json["truncated"] != Standards.JSON.false) error("Expected bool");
7981 retval.truncated = json["truncated"];
8082 retval.updated_at = json["updated_at"];
8183 retval.url = json["url"];
Test case

test/inputs/json/misc/80aff.json

1 generated file · +2 −0
Mpikedefault / TopLevel.pmod+2 −0
@@ -42,8 +42,10 @@ TopLevel TopLevel_from_JSON(mixed json) {
4242 retval.count = json["count"];
4343 retval.facets = json["facets"];
4444 retval.limit = json["limit"];
45+ if (json["next"] != Standards.JSON.true && json["next"] != Standards.JSON.false) error("Expected bool");
4546 retval.next = json["next"];
4647 retval.offset = json["offset"];
48+ if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool");
4749 retval.previous = json["previous"];
4850 retval.results = json["results"];
Test case

test/inputs/json/misc/8592b.json

1 generated file · +19 −0
Mpikedefault / TopLevel.pmod+19 −0
@@ -230,6 +230,7 @@ ChildData ChildData_from_JSON(mixed json) {
230230
231231 retval.approved_at_utc = json["approved_at_utc"];
232232 retval.approved_by = json["approved_by"];
233+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
233234 retval.archived = json["archived"];
234235 retval.author = json["author"];
235236 if (!has_index(json, "author_flair_css_class")) error("Missing required property");
@@ -238,26 +239,37 @@ ChildData ChildData_from_JSON(mixed json) {
238239 retval.author_flair_text = json["author_flair_text"];
239240 retval.banned_at_utc = json["banned_at_utc"];
240241 retval.banned_by = json["banned_by"];
242+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
241243 retval.brand_safe = json["brand_safe"];
244+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
242245 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");
243247 retval.can_mod_post = json["can_mod_post"];
248+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
244249 retval.clicked = json["clicked"];
250+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
245251 retval.contest_mode = json["contest_mode"];
246252 retval.created = (float)json["created"];
247253 retval.created_utc = (float)json["created_utc"];
248254 retval.distinguished = json["distinguished"];
249255 retval.domain = json["domain"];
250256 retval.downs = json["downs"];
257+ if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool");
251258 retval.edited = json["edited"];
252259 retval.gilded = json["gilded"];
260+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
253261 retval.hidden = json["hidden"];
262+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
254263 retval.hide_score = json["hide_score"];
255264 retval.id = json["id"];
265+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
256266 retval.is_self = json["is_self"];
267+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
257268 retval.is_video = json["is_video"];
258269 retval.likes = json["likes"];
259270 retval.link_flair_css_class = json["link_flair_css_class"];
260271 retval.link_flair_text = json["link_flair_text"];
272+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
261273 retval.locked = json["locked"];
262274 retval.media = json["media"];
263275 retval.media_embed = json["media_embed"];
@@ -265,13 +277,16 @@ ChildData ChildData_from_JSON(mixed json) {
265277 retval.name = json["name"];
266278 retval.num_comments = json["num_comments"];
267279 retval.num_reports = json["num_reports"];
280+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
268281 retval.over_18 = json["over_18"];
269282 retval.permalink = json["permalink"];
270283 retval.post_hint = PostHint_from_JSON(json["post_hint"]);
271284 retval.preview = json["preview"];
285+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
272286 retval.quarantine = json["quarantine"];
273287 retval.removal_reason = json["removal_reason"];
274288 retval.report_reasons = json["report_reasons"];
289+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
275290 retval.saved = json["saved"];
276291 retval.score = json["score"];
277292 retval.secure_media = json["secure_media"];
@@ -279,7 +294,9 @@ ChildData ChildData_from_JSON(mixed json) {
279294 retval.selftext = json["selftext"];
280295 if (!has_index(json, "selftext_html")) error("Missing required property");
281296 retval.selftext_html = json["selftext_html"];
297+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
282298 retval.spoiler = json["spoiler"];
299+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
283300 retval.stickied = json["stickied"];
284301 retval.subreddit = Subreddit_from_JSON(json["subreddit"]);
285302 retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]);
@@ -296,6 +313,7 @@ ChildData ChildData_from_JSON(mixed json) {
296313 retval.url = json["url"];
297314 retval.user_reports = json["user_reports"];
298315 retval.view_count = json["view_count"];
316+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
299317 retval.visited = json["visited"];
300318
301319 return retval;
@@ -342,6 +360,7 @@ class Preview {
342360 Preview Preview_from_JSON(mixed json) {
343361 Preview retval = Preview();
344362
363+ if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool");
345364 retval.enabled = json["enabled"];
346365 retval.images = json["images"];
Test case

test/inputs/json/misc/96f7c.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -42,6 +42,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
4242 retval.hooks = json["hooks"];
4343 retval.importer = json["importer"];
4444 retval.pages = json["pages"];
45+ if (json["verifiable_password_authentication"] != Standards.JSON.true && json["verifiable_password_authentication"] != Standards.JSON.false) error("Expected bool");
4546 retval.verifiable_password_authentication = json["verifiable_password_authentication"];
4647
4748 return retval;
Test case

test/inputs/json/misc/9ac3b.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
4444 retval.limit = json["limit"];
4545 retval.next = json["next"];
4646 retval.offset = json["offset"];
47+ if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool");
4748 retval.previous = json["previous"];
4849 retval.results = json["results"];
Test case

test/inputs/json/misc/a0496.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -69,6 +69,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
6969 retval.from_date = json["from_date"];
7070 retval.id = json["id"];
7171 retval.name = json["name"];
72+ if (json["premium"] != Standards.JSON.true && json["premium"] != Standards.JSON.false) error("Expected bool");
7273 retval.premium = json["premium"];
7374 retval.source_code = json["source_code"];
7475 retval.source_name = json["source_name"];
Test case

test/inputs/json/misc/a3d8c.json

1 generated file · +6 −0
Mpikedefault / TopLevel.pmod+6 −0
@@ -156,7 +156,9 @@ View View_from_JSON(mixed json) {
156156 retval.download_count = json["downloadCount"];
157157 retval.flags = json["flags"];
158158 retval.grants = json["grants"];
159+ if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool");
159160 retval.hide_from_catalog = json["hideFromCatalog"];
161+ if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool");
160162 retval.hide_from_data_json = json["hideFromDataJson"];
161163 retval.id = json["id"];
162164 retval.index_updated_at = json["indexUpdatedAt"];
@@ -165,11 +167,13 @@ View View_from_JSON(mixed json) {
165167 retval.locale = json["locale"];
166168 retval.metadata = json["metadata"];
167169 retval.name = json["name"];
170+ if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool");
168171 retval.new_backend = json["newBackend"];
169172 retval.number_of_comments = json["numberOfComments"];
170173 retval.oid = json["oid"];
171174 retval.owner = json["owner"];
172175 retval.provenance = json["provenance"];
176+ if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool");
173177 retval.publication_append_enabled = json["publicationAppendEnabled"];
174178 retval.publication_date = json["publicationDate"];
175179 retval.publication_group = json["publicationGroup"];
@@ -346,6 +350,7 @@ Grant Grant_from_JSON(mixed json) {
346350 Grant retval = Grant();
347351
348352 retval.flags = json["flags"];
353+ if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool");
349354 retval.inherited = json["inherited"];
350355 retval.type = json["type"];
351356
@@ -439,6 +444,7 @@ class Visible {
439444 Visible Visible_from_JSON(mixed json) {
440445 Visible retval = Visible();
441446
447+ if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool");
442448 retval.table = json["table"];
443449
444450 return retval;
Test case

test/inputs/json/misc/ae7f0.json

1 generated file · +18 −0
Mpikedefault / TopLevel.pmod+18 −0
@@ -222,34 +222,46 @@ ChildData ChildData_from_JSON(mixed json) {
222222
223223 retval.approved_at_utc = json["approved_at_utc"];
224224 retval.approved_by = json["approved_by"];
225+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
225226 retval.archived = json["archived"];
226227 retval.author = json["author"];
227228 retval.author_flair_css_class = json["author_flair_css_class"];
228229 retval.author_flair_text = json["author_flair_text"];
229230 retval.banned_at_utc = json["banned_at_utc"];
230231 retval.banned_by = json["banned_by"];
232+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
231233 retval.brand_safe = json["brand_safe"];
234+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
232235 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");
233237 retval.can_mod_post = json["can_mod_post"];
238+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
234239 retval.clicked = json["clicked"];
240+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
235241 retval.contest_mode = json["contest_mode"];
236242 retval.created = (float)json["created"];
237243 retval.created_utc = (float)json["created_utc"];
238244 retval.distinguished = json["distinguished"];
239245 retval.domain = Domain_from_JSON(json["domain"]);
240246 retval.downs = json["downs"];
247+ if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool");
241248 retval.edited = json["edited"];
242249 retval.gilded = json["gilded"];
250+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
243251 retval.hidden = json["hidden"];
252+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
244253 retval.hide_score = json["hide_score"];
245254 retval.id = json["id"];
255+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
246256 retval.is_self = json["is_self"];
257+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
247258 retval.is_video = json["is_video"];
248259 retval.likes = json["likes"];
249260 if (!has_index(json, "link_flair_css_class")) error("Missing required property");
250261 retval.link_flair_css_class = json["link_flair_css_class"];
251262 if (!has_index(json, "link_flair_text")) error("Missing required property");
252263 retval.link_flair_text = json["link_flair_text"];
264+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
253265 retval.locked = json["locked"];
254266 retval.media = json["media"];
255267 retval.media_embed = json["media_embed"];
@@ -257,18 +269,23 @@ ChildData ChildData_from_JSON(mixed json) {
257269 retval.name = json["name"];
258270 retval.num_comments = json["num_comments"];
259271 retval.num_reports = json["num_reports"];
272+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
260273 retval.over_18 = json["over_18"];
261274 retval.permalink = json["permalink"];
275+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
262276 retval.quarantine = json["quarantine"];
263277 retval.removal_reason = json["removal_reason"];
264278 retval.report_reasons = json["report_reasons"];
279+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
265280 retval.saved = json["saved"];
266281 retval.score = json["score"];
267282 retval.secure_media = json["secure_media"];
268283 retval.secure_media_embed = json["secure_media_embed"];
269284 retval.selftext = json["selftext"];
270285 retval.selftext_html = json["selftext_html"];
286+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
271287 retval.spoiler = json["spoiler"];
288+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
272289 retval.stickied = json["stickied"];
273290 retval.subreddit = Subreddit_from_JSON(json["subreddit"]);
274291 retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]);
@@ -281,6 +298,7 @@ ChildData ChildData_from_JSON(mixed json) {
281298 retval.url = json["url"];
282299 retval.user_reports = json["user_reports"];
283300 retval.view_count = json["view_count"];
301+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
284302 retval.visited = json["visited"];
285303
286304 return retval;
Test case

test/inputs/json/misc/be234.json

1 generated file · +19 −0
Mpikedefault / TopLevel.pmod+19 −0
@@ -230,6 +230,7 @@ ChildData ChildData_from_JSON(mixed json) {
230230
231231 retval.approved_at_utc = json["approved_at_utc"];
232232 retval.approved_by = json["approved_by"];
233+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
233234 retval.archived = json["archived"];
234235 retval.author = json["author"];
235236 retval.author_flair_css_class = json["author_flair_css_class"];
@@ -237,10 +238,15 @@ ChildData ChildData_from_JSON(mixed json) {
237238 retval.author_flair_text = json["author_flair_text"];
238239 retval.banned_at_utc = json["banned_at_utc"];
239240 retval.banned_by = json["banned_by"];
241+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
240242 retval.brand_safe = json["brand_safe"];
243+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
241244 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");
242246 retval.can_mod_post = json["can_mod_post"];
247+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
243248 retval.clicked = json["clicked"];
249+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
244250 retval.contest_mode = json["contest_mode"];
245251 retval.created = (float)json["created"];
246252 retval.created_utc = (float)json["created_utc"];
@@ -248,16 +254,22 @@ ChildData ChildData_from_JSON(mixed json) {
248254 retval.distinguished = json["distinguished"];
249255 retval.domain = Domain_from_JSON(json["domain"]);
250256 retval.downs = json["downs"];
257+ if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool");
251258 retval.edited = json["edited"];
252259 retval.gilded = json["gilded"];
260+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
253261 retval.hidden = json["hidden"];
262+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
254263 retval.hide_score = json["hide_score"];
255264 retval.id = json["id"];
265+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
256266 retval.is_self = json["is_self"];
267+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
257268 retval.is_video = json["is_video"];
258269 retval.likes = json["likes"];
259270 retval.link_flair_css_class = json["link_flair_css_class"];
260271 retval.link_flair_text = json["link_flair_text"];
272+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
261273 retval.locked = json["locked"];
262274 if (!has_index(json, "media")) error("Missing required property");
263275 retval.media = json["media"];
@@ -266,13 +278,16 @@ ChildData ChildData_from_JSON(mixed json) {
266278 retval.name = json["name"];
267279 retval.num_comments = json["num_comments"];
268280 retval.num_reports = json["num_reports"];
281+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
269282 retval.over_18 = json["over_18"];
270283 retval.permalink = json["permalink"];
271284 retval.post_hint = PostHint_from_JSON(json["post_hint"]);
272285 retval.preview = json["preview"];
286+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
273287 retval.quarantine = json["quarantine"];
274288 retval.removal_reason = json["removal_reason"];
275289 retval.report_reasons = json["report_reasons"];
290+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
276291 retval.saved = json["saved"];
277292 retval.score = json["score"];
278293 if (!has_index(json, "secure_media")) error("Missing required property");
@@ -280,7 +295,9 @@ ChildData ChildData_from_JSON(mixed json) {
280295 retval.secure_media_embed = json["secure_media_embed"];
281296 retval.selftext = json["selftext"];
282297 retval.selftext_html = json["selftext_html"];
298+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
283299 retval.spoiler = json["spoiler"];
300+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
284301 retval.stickied = json["stickied"];
285302 retval.subreddit = Subreddit_from_JSON(json["subreddit"]);
286303 retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]);
@@ -295,6 +312,7 @@ ChildData ChildData_from_JSON(mixed json) {
295312 retval.url = json["url"];
296313 retval.user_reports = json["user_reports"];
297314 retval.view_count = json["view_count"];
315+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
298316 retval.visited = json["visited"];
299317
300318 return retval;
@@ -444,6 +462,7 @@ class Preview {
444462 Preview Preview_from_JSON(mixed json) {
445463 Preview retval = Preview();
446464
465+ if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool");
447466 retval.enabled = json["enabled"];
448467 retval.images = json["images"];
Test case

test/inputs/json/misc/d23d5.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -44,6 +44,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
4444 retval.limit = json["limit"];
4545 retval.next = json["next"];
4646 retval.offset = json["offset"];
47+ if (json["previous"] != Standards.JSON.true && json["previous"] != Standards.JSON.false) error("Expected bool");
4748 retval.previous = json["previous"];
4849 retval.results = json["results"];
Test case

test/inputs/json/misc/e324e.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -251,6 +251,7 @@ Parameter Parameter_from_JSON(mixed json) {
251251 retval.format = Type_from_JSON(json["format"]);
252252 retval.in = json["in"];
253253 retval.name = json["name"];
254+ if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool");
254255 retval.required = json["required"];
255256 retval.type = Type_from_JSON(json["type"]);
Test case

test/inputs/json/misc/e8b04.json

1 generated file · +7 −0
Mpikedefault / TopLevel.pmod+7 −0
@@ -119,7 +119,9 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) {
119119 retval.download_count = json["downloadCount"];
120120 retval.flags = json["flags"];
121121 retval.grants = json["grants"];
122+ if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool");
122123 retval.hide_from_catalog = json["hideFromCatalog"];
124+ if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool");
123125 retval.hide_from_data_json = json["hideFromDataJson"];
124126 retval.id = json["id"];
125127 retval.index_updated_at = json["indexUpdatedAt"];
@@ -128,11 +130,13 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) {
128130 retval.moderation_status = json["moderationStatus"];
129131 retval.modifying_view_uid = ModifyingViewUid_from_JSON(json["modifyingViewUid"]);
130132 retval.name = json["name"];
133+ if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool");
131134 retval.new_backend = json["newBackend"];
132135 retval.number_of_comments = json["numberOfComments"];
133136 retval.oid = json["oid"];
134137 retval.owner = json["owner"];
135138 retval.provenance = Provenance_from_JSON(json["provenance"]);
139+ if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool");
136140 retval.publication_append_enabled = json["publicationAppendEnabled"];
137141 retval.publication_date = json["publicationDate"];
138142 retval.publication_group = json["publicationGroup"];
@@ -196,6 +200,7 @@ Grant Grant_from_JSON(mixed json) {
196200 Grant retval = Grant();
197201
198202 retval.flags = json["flags"];
203+ if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool");
199204 retval.inherited = json["inherited"];
200205 retval.type = GrantType_from_JSON(json["type"]);
201206
@@ -371,6 +376,7 @@ class Order {
371376 Order Order_from_JSON(mixed json) {
372377 Order retval = Order();
373378
379+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
374380 retval.ascending = json["ascending"];
375381 retval.column_field_name = OrderColumnFieldName_from_JSON(json["columnFieldName"]);
376382
@@ -834,6 +840,7 @@ class FluffyVisible {
834840 FluffyVisible FluffyVisible_from_JSON(mixed json) {
835841 FluffyVisible retval = FluffyVisible();
836842
843+ if (json["href"] != Standards.JSON.true && json["href"] != Standards.JSON.false) error("Expected bool");
837844 retval.href = json["href"];
838845
839846 return retval;
Test case

test/inputs/json/misc/f22f5.json

1 generated file · +18 −0
Mpikedefault / TopLevel.pmod+18 −0
@@ -222,34 +222,46 @@ ChildData ChildData_from_JSON(mixed json) {
222222
223223 retval.approved_at_utc = json["approved_at_utc"];
224224 retval.approved_by = json["approved_by"];
225+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
225226 retval.archived = json["archived"];
226227 retval.author = json["author"];
227228 retval.author_flair_css_class = json["author_flair_css_class"];
228229 retval.author_flair_text = json["author_flair_text"];
229230 retval.banned_at_utc = json["banned_at_utc"];
230231 retval.banned_by = json["banned_by"];
232+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
231233 retval.brand_safe = json["brand_safe"];
234+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
232235 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");
233237 retval.can_mod_post = json["can_mod_post"];
238+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
234239 retval.clicked = json["clicked"];
240+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
235241 retval.contest_mode = json["contest_mode"];
236242 retval.created = (float)json["created"];
237243 retval.created_utc = (float)json["created_utc"];
238244 retval.distinguished = json["distinguished"];
239245 retval.domain = json["domain"];
240246 retval.downs = json["downs"];
247+ if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool");
241248 retval.edited = json["edited"];
242249 retval.gilded = json["gilded"];
250+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
243251 retval.hidden = json["hidden"];
252+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
244253 retval.hide_score = json["hide_score"];
245254 retval.id = json["id"];
255+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
246256 retval.is_self = json["is_self"];
257+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
247258 retval.is_video = json["is_video"];
248259 retval.likes = json["likes"];
249260 if (!has_index(json, "link_flair_css_class")) error("Missing required property");
250261 retval.link_flair_css_class = json["link_flair_css_class"];
251262 if (!has_index(json, "link_flair_text")) error("Missing required property");
252263 retval.link_flair_text = json["link_flair_text"];
264+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
253265 retval.locked = json["locked"];
254266 retval.media = json["media"];
255267 retval.media_embed = json["media_embed"];
@@ -257,18 +269,23 @@ ChildData ChildData_from_JSON(mixed json) {
257269 retval.name = json["name"];
258270 retval.num_comments = json["num_comments"];
259271 retval.num_reports = json["num_reports"];
272+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
260273 retval.over_18 = json["over_18"];
261274 retval.permalink = json["permalink"];
275+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
262276 retval.quarantine = json["quarantine"];
263277 retval.removal_reason = json["removal_reason"];
264278 retval.report_reasons = json["report_reasons"];
279+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
265280 retval.saved = json["saved"];
266281 retval.score = json["score"];
267282 retval.secure_media = json["secure_media"];
268283 retval.secure_media_embed = json["secure_media_embed"];
269284 retval.selftext = json["selftext"];
270285 retval.selftext_html = json["selftext_html"];
286+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
271287 retval.spoiler = json["spoiler"];
288+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
272289 retval.stickied = json["stickied"];
273290 retval.subreddit = Subreddit_from_JSON(json["subreddit"]);
274291 retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]);
@@ -281,6 +298,7 @@ ChildData ChildData_from_JSON(mixed json) {
281298 retval.url = json["url"];
282299 retval.user_reports = json["user_reports"];
283300 retval.view_count = json["view_count"];
301+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
284302 retval.visited = json["visited"];
285303
286304 return retval;
Test case

test/inputs/json/misc/f74d5.json

1 generated file · +6 −0
Mpikedefault / TopLevel.pmod+6 −0
@@ -156,7 +156,9 @@ View View_from_JSON(mixed json) {
156156 retval.download_count = json["downloadCount"];
157157 retval.flags = json["flags"];
158158 retval.grants = json["grants"];
159+ if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool");
159160 retval.hide_from_catalog = json["hideFromCatalog"];
161+ if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool");
160162 retval.hide_from_data_json = json["hideFromDataJson"];
161163 retval.id = json["id"];
162164 retval.index_updated_at = json["indexUpdatedAt"];
@@ -165,11 +167,13 @@ View View_from_JSON(mixed json) {
165167 retval.locale = json["locale"];
166168 retval.metadata = json["metadata"];
167169 retval.name = json["name"];
170+ if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool");
168171 retval.new_backend = json["newBackend"];
169172 retval.number_of_comments = json["numberOfComments"];
170173 retval.oid = json["oid"];
171174 retval.owner = json["owner"];
172175 retval.provenance = json["provenance"];
176+ if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool");
173177 retval.publication_append_enabled = json["publicationAppendEnabled"];
174178 retval.publication_date = json["publicationDate"];
175179 retval.publication_group = json["publicationGroup"];
@@ -346,6 +350,7 @@ Grant Grant_from_JSON(mixed json) {
346350 Grant retval = Grant();
347351
348352 retval.flags = json["flags"];
353+ if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool");
349354 retval.inherited = json["inherited"];
350355 retval.type = json["type"];
351356
@@ -439,6 +444,7 @@ class Visible {
439444 Visible Visible_from_JSON(mixed json) {
440445 Visible retval = Visible();
441446
447+ if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool");
442448 retval.table = json["table"];
443449
444450 return retval;
Test case

test/inputs/json/misc/f82d9.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -298,6 +298,7 @@ Parameter Parameter_from_JSON(mixed json) {
298298 retval.format = Type_from_JSON(json["format"]);
299299 retval.in = json["in"];
300300 retval.name = json["name"];
301+ if (json["required"] != Standards.JSON.true && json["required"] != Standards.JSON.false) error("Expected bool");
301302 retval.required = json["required"];
302303 retval.type = Type_from_JSON(json["type"]);
Test case

test/inputs/json/misc/fcca3.json

1 generated file · +9 −0
Mpikedefault / TopLevel.pmod+9 −0
@@ -158,18 +158,22 @@ View View_from_JSON(mixed json) {
158158 retval.download_count = json["downloadCount"];
159159 retval.flags = json["flags"];
160160 retval.grants = json["grants"];
161+ if (json["hideFromCatalog"] != Standards.JSON.true && json["hideFromCatalog"] != Standards.JSON.false) error("Expected bool");
161162 retval.hide_from_catalog = json["hideFromCatalog"];
163+ if (json["hideFromDataJson"] != Standards.JSON.true && json["hideFromDataJson"] != Standards.JSON.false) error("Expected bool");
162164 retval.hide_from_data_json = json["hideFromDataJson"];
163165 retval.id = json["id"];
164166 retval.index_updated_at = json["indexUpdatedAt"];
165167 retval.locale = json["locale"];
166168 retval.metadata = json["metadata"];
167169 retval.name = json["name"];
170+ if (json["newBackend"] != Standards.JSON.true && json["newBackend"] != Standards.JSON.false) error("Expected bool");
168171 retval.new_backend = json["newBackend"];
169172 retval.number_of_comments = json["numberOfComments"];
170173 retval.oid = json["oid"];
171174 retval.owner = json["owner"];
172175 retval.provenance = json["provenance"];
176+ if (json["publicationAppendEnabled"] != Standards.JSON.true && json["publicationAppendEnabled"] != Standards.JSON.false) error("Expected bool");
173177 retval.publication_append_enabled = json["publicationAppendEnabled"];
174178 retval.publication_date = json["publicationDate"];
175179 retval.publication_group = json["publicationGroup"];
@@ -359,6 +363,7 @@ Grant Grant_from_JSON(mixed json) {
359363 Grant retval = Grant();
360364
361365 retval.flags = json["flags"];
366+ if (json["inherited"] != Standards.JSON.true && json["inherited"] != Standards.JSON.false) error("Expected bool");
362367 retval.inherited = json["inherited"];
363368 retval.type = json["type"];
364369
@@ -686,6 +691,7 @@ class FilterConditionMetadata {
686691 FilterConditionMetadata FilterConditionMetadata_from_JSON(mixed json) {
687692 FilterConditionMetadata retval = FilterConditionMetadata();
688693
694+ if (json["advanced"] != Standards.JSON.true && json["advanced"] != Standards.JSON.false) error("Expected bool");
689695 retval.advanced = json["advanced"];
690696 retval.unified_version = json["unifiedVersion"];
691697
@@ -729,6 +735,7 @@ class Order {
729735 Order Order_from_JSON(mixed json) {
730736 Order retval = Order();
731737
738+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
732739 retval.ascending = json["ascending"];
733740 retval.column_field_name = json["columnFieldName"];
734741
@@ -770,6 +777,7 @@ class Visible {
770777 Visible Visible_from_JSON(mixed json) {
771778 Visible retval = Visible();
772779
780+ if (json["table"] != Standards.JSON.true && json["table"] != Standards.JSON.false) error("Expected bool");
773781 retval.table = json["table"];
774782
775783 return retval;
@@ -853,6 +861,7 @@ class OrderBy {
853861 OrderBy OrderBy_from_JSON(mixed json) {
854862 OrderBy retval = OrderBy();
855863
864+ if (json["ascending"] != Standards.JSON.true && json["ascending"] != Standards.JSON.false) error("Expected bool");
856865 retval.ascending = json["ascending"];
857866 retval.expression = json["expression"];
Test case

test/inputs/json/priority/blns-object.json

1 generated file · +3 −0
Mpikedefault / TopLevel.pmod+3 −0
@@ -580,6 +580,7 @@ A A_from_JSON(mixed json) {
580580 retval.cunning = json["<>?:\"{}|_+"];
581581 retval.d = json["%d"];
582582 retval.dick_van_dyke = json["Dick Van Dyke"];
583+ if (json["dontMakeAMap"] != Standards.JSON.true && json["dontMakeAMap"] != Standards.JSON.false) error("Expected bool");
583584 retval.dont_make_a_map = json["dontMakeAMap"];
584585 retval.dr_herman_i_libshitz = json["Dr. Herman I. Libshitz"];
585586 retval.empty = json[" "];
@@ -1126,6 +1127,7 @@ B B_from_JSON(mixed json) {
11261127 retval.credit_https_twitter_com_jifa_status_625776454479970304 = json["#\tCredit: https://twitter.com/jifa/status/625776454479970304"];
11271128 retval.cunning = json["社會科學院語學研究所"];
11281129 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");
11291131 retval.dont_make_a_map = json["dontMakeAMap"];
11301132 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"];
11311133 retval.eval_puts_hello_world = json["eval(\"puts 'hello world'\")"];
@@ -1694,6 +1696,7 @@ C C_from_JSON(mixed json) {
16941696 retval.craig_cockburn_software_specialist = json["Craig Cockburn, Software Specialist"];
16951697 retval.cunning = json["\\\\"];
16961698 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");
16971700 retval.dont_make_a_map = json["dontMakeAMap"];
16981701 retval.emoji = json["#\tEmoji"];
16991702 retval.empty = json["\"\""];
Test case

test/inputs/json/priority/bug790.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -43,6 +43,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
4343
4444 retval.children_data = json["children_data"];
4545 retval.id = json["id"];
46+ if (json["is_active"] != Standards.JSON.true && json["is_active"] != Standards.JSON.false) error("Expected bool");
4647 retval.is_active = json["is_active"];
4748 retval.level = json["level"];
4849 retval.name = json["name"];
Test case

test/inputs/json/priority/combinations1.json

1 generated file · +2 −0
Mpikedefault / TopLevel.pmod+2 −0
@@ -371,6 +371,7 @@ CimeliaClass CimeliaClass_from_JSON(mixed json) {
371371 retval.catharticalness = (float)json["catharticalness"];
372372 retval.chirotherium = json["Chirotherium"];
373373 retval.disdiapason = json["disdiapason"];
374+ if (json["homocerc"] != Standards.JSON.true && json["homocerc"] != Standards.JSON.false) error("Expected bool");
374375 retval.homocerc = json["homocerc"];
375376 retval.nonbookish = json["nonbookish"];
376377
@@ -1298,6 +1299,7 @@ Interacinar Interacinar_from_JSON(mixed json) {
12981299 Interacinar retval = Interacinar();
12991300
13001301 retval.assapan = (float)json["assapan"];
1302+ if (json["benefactorship"] != Standards.JSON.true && json["benefactorship"] != Standards.JSON.false) error("Expected bool");
13011303 retval.benefactorship = json["benefactorship"];
13021304 retval.triseriatim = json["triseriatim"];
13031305 retval.tubbing = json["tubbing"];
Test case

test/inputs/json/priority/combinations2.json

1 generated file · +2 −0
Mpikedefault / TopLevel.pmod+2 −0
@@ -155,6 +155,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
155155 retval.oskar = json["Oskar"];
156156 retval.rebecca = json["Rebecca"];
157157 retval.rhomboganoidei = json["Rhomboganoidei"];
158+ if (json["Rigsmal"] != Standards.JSON.true && json["Rigsmal"] != Standards.JSON.false) error("Expected bool");
158159 retval.rigsmal = json["Rigsmal"];
159160 retval.ruellia = json["Ruellia"];
160161 retval.school = json["School"];
@@ -310,6 +311,7 @@ Rebecca Rebecca_from_JSON(mixed json) {
310311 retval.catharticalness = (float)json["catharticalness"];
311312 retval.chirotherium = json["Chirotherium"];
312313 retval.disdiapason = json["disdiapason"];
314+ if (json["homocerc"] != Standards.JSON.true && json["homocerc"] != Standards.JSON.false) error("Expected bool");
313315 retval.homocerc = json["homocerc"];
314316 retval.nonbookish = json["nonbookish"];
Test case

test/inputs/json/priority/combinations3.json

1 generated file · +2 −0
Mpikedefault / TopLevel.pmod+2 −0
@@ -698,6 +698,7 @@ MonaziteClass MonaziteClass_from_JSON(mixed json) {
698698 retval.catharticalness = (float)json["catharticalness"];
699699 retval.chirotherium = json["Chirotherium"];
700700 retval.disdiapason = json["disdiapason"];
701+ if (json["homocerc"] != Standards.JSON.true && json["homocerc"] != Standards.JSON.false) error("Expected bool");
701702 retval.homocerc = json["homocerc"];
702703 retval.nonbookish = json["nonbookish"];
703704
@@ -864,6 +865,7 @@ Noncontributing Noncontributing_from_JSON(mixed json) {
864865 retval.estevin = json["estevin"];
865866 retval.jolterhead = (float)json["jolterhead"];
866867 retval.sauternes = json["sauternes"];
868+ if (json["sparsely"] != Standards.JSON.true && json["sparsely"] != Standards.JSON.false) error("Expected bool");
867869 retval.sparsely = json["sparsely"];
868870 retval.unrequested = json["unrequested"];
Test case

test/inputs/json/priority/combinations4.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -389,6 +389,7 @@ QuebrachineClass QuebrachineClass_from_JSON(mixed json) {
389389 retval.catharticalness = (float)json["catharticalness"];
390390 retval.chirotherium = json["Chirotherium"];
391391 retval.disdiapason = json["disdiapason"];
392+ if (json["homocerc"] != Standards.JSON.true && json["homocerc"] != Standards.JSON.false) error("Expected bool");
392393 retval.homocerc = json["homocerc"];
393394 retval.nonbookish = json["nonbookish"];
Test case

test/inputs/json/priority/direct-recursive.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -36,6 +36,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
3636 TopLevel retval = TopLevel();
3737
3838 retval.also = json["also"];
39+ if (json["bar"] != Standards.JSON.true && json["bar"] != Standards.JSON.false) error("Expected bool");
3940 retval.bar = json["bar"];
4041 retval.foo = json["foo"];
4142 retval.moo = (float)json["moo"];
Test case

test/inputs/json/priority/name-style.json

1 generated file · +4 −0
Mpikedefault / TopLevel.pmod+4 −0
@@ -40,11 +40,15 @@ TopLevel TopLevel_from_JSON(mixed json) {
4040 TopLevel retval = TopLevel();
4141
4242 retval.an_easy_one = json["anEasyOne"];
43+ if (json["isMNISTLetter"] != Standards.JSON.true && json["isMNISTLetter"] != Standards.JSON.false) error("Expected bool");
4344 retval.is_mnist_letter = json["isMNISTLetter"];
4445 retval.json_string = json["JSONString"];
46+ if (json["PrettyEasyToo"] != Standards.JSON.true && json["PrettyEasyToo"] != Standards.JSON.false) error("Expected bool");
4547 retval.pretty_easy_too = json["PrettyEasyToo"];
4648 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");
4750 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");
4852 retval.zsr_hh_demo3_delmatnr = json["ZSR_HH_DEMO3_DELMATNR"];
4953
5054 return retval;
Test case

test/inputs/json/priority/nst-test-suite.json

1 generated file · +2 −0
Mpikedefault / TopLevel.pmod+2 −0
@@ -294,11 +294,13 @@ TopLevel TopLevel_from_JSON(mixed json) {
294294 retval.y_string_unicode_u_fffe_nonchar_json = json["y_string_unicode_U+FFFE_nonchar.json"];
295295 retval.y_string_utf8_json = json["y_string_utf8.json"];
296296 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");
297298 retval.y_structure_lonely_false_json = json["y_structure_lonely_false.json"];
298299 retval.y_structure_lonely_int_json = json["y_structure_lonely_int.json"];
299300 retval.y_structure_lonely_negative_real_json = (float)json["y_structure_lonely_negative_real.json"];
300301 retval.y_structure_lonely_null_json = json["y_structure_lonely_null.json"];
301302 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");
302304 retval.y_structure_lonely_true_json = json["y_structure_lonely_true.json"];
303305 retval.y_structure_string_empty_json = json["y_structure_string_empty.json"];
304306 retval.y_structure_trailing_newline_json = json["y_structure_trailing_newline.json"];
Test case

test/inputs/json/priority/php-validation.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -35,6 +35,7 @@ class TopLevel {
3535 TopLevel TopLevel_from_JSON(mixed json) {
3636 TopLevel retval = TopLevel();
3737
38+ if (json["boolean"] != Standards.JSON.true && json["boolean"] != Standards.JSON.false) error("Expected bool");
3839 retval.boolean = json["boolean"];
3940 retval.integer = json["integer"];
4041 retval.integers = json["integers"];
Test case

test/inputs/json/priority/recursive.json

1 generated file · +8 −0
Mpikedefault / TopLevel.pmod+8 −0
@@ -50,6 +50,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
5050 retval.match = json["match"];
5151 retval.page = json["page"];
5252 retval.product = json["product"];
53+ if (json["schk"] != Standards.JSON.true && json["schk"] != Standards.JSON.false) error("Expected bool");
5354 retval.schk = json["schk"];
5455 retval.totallooseoffers = json["totallooseoffers"];
5556 retval.totalpages = json["totalpages"];
@@ -88,9 +89,12 @@ class Category {
8889 Category Category_from_JSON(mixed json) {
8990 Category retval = Category();
9091
92+ if (json["concatenatecategoryname"] != Standards.JSON.true && json["concatenatecategoryname"] != Standards.JSON.false) error("Expected bool");
9193 retval.concatenatecategoryname = json["concatenatecategoryname"];
94+ if (json["hasoffer"] != Standards.JSON.true && json["hasoffer"] != Standards.JSON.false) error("Expected bool");
9295 retval.hasoffer = json["hasoffer"];
9396 retval.id = json["id"];
97+ if (json["isfinal"] != Standards.JSON.true && json["isfinal"] != Standards.JSON.false) error("Expected bool");
9498 retval.isfinal = json["isfinal"];
9599 retval.links = json["links"];
96100 retval.name = json["name"];
@@ -244,6 +248,7 @@ Date Date_from_JSON(mixed json) {
244248 retval.month = json["month"];
245249 retval.second = json["second"];
246250 retval.timezone = json["timezone"];
251+ if (json["valid"] != Standards.JSON.true && json["valid"] != Standards.JSON.false) error("Expected bool");
247252 retval.valid = json["valid"];
248253 retval.xmlschematype = json["xmlschematype"];
249254 retval.year = json["year"];
@@ -364,8 +369,11 @@ ProductProduct ProductProduct_from_JSON(mixed json) {
364369
365370 retval.categoryid = json["categoryid"];
366371 retval.currency = json["currency"];
372+ if (json["eco"] != Standards.JSON.true && json["eco"] != Standards.JSON.false) error("Expected bool");
367373 retval.eco = json["eco"];
374+ if (json["fulldescription"] != Standards.JSON.true && json["fulldescription"] != Standards.JSON.false) error("Expected bool");
368375 retval.fulldescription = json["fulldescription"];
376+ if (json["hasmetasearch"] != Standards.JSON.true && json["hasmetasearch"] != Standards.JSON.false) error("Expected bool");
369377 retval.hasmetasearch = json["hasmetasearch"];
370378 retval.id = json["id"];
371379 retval.links = json["links"];
Test case

test/inputs/json/priority/union-constructor-clash.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -50,6 +50,7 @@ class BoolInUnion {
5050 BoolInUnion BoolInUnion_from_JSON(mixed json) {
5151 BoolInUnion retval = BoolInUnion();
5252
53+ if (json["a"] != Standards.JSON.true && json["a"] != Standards.JSON.false) error("Expected bool");
5354 retval.a = json["a"];
5455
5556 return retval;
Test case

test/inputs/json/priority/unions.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -65,6 +65,7 @@ class ZClass {
6565 ZClass ZClass_from_JSON(mixed json) {
6666 ZClass retval = ZClass();
6767
68+ if (json["a"] != Standards.JSON.true && json["a"] != Standards.JSON.false) error("Expected bool");
6869 retval.a = json["a"];
6970
7071 return retval;
Test case

test/inputs/json/priority/uuids.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -37,6 +37,7 @@ class TopLevel {
3737 TopLevel TopLevel_from_JSON(mixed json) {
3838 TopLevel retval = TopLevel();
3939
40+ if (json["booleanValue"] != Standards.JSON.true && json["booleanValue"] != Standards.JSON.false) error("Expected bool");
4041 retval.boolean_value = json["booleanValue"];
4142 retval.double_value = (float)json["doubleValue"];
4243 retval.int_value = json["intValue"];
Test case

test/inputs/json/samples/github-events.json

1 generated file · +15 −0
Mpikedefault / TopLevel.pmod+15 −0
@@ -53,6 +53,7 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) {
5353 retval.org = json["org"];
5454 retval.payload = json["payload"];
5555 retval.repo = json["repo"];
56+ if (json["public"] != Standards.JSON.true && json["public"] != Standards.JSON.false) error("Expected bool");
5657 retval.top_level_public = json["public"];
5758 retval.type = json["type"];
5859
@@ -259,6 +260,7 @@ User User_from_JSON(mixed json) {
259260 retval.organizations_url = json["organizations_url"];
260261 retval.received_events_url = json["received_events_url"];
261262 retval.repos_url = json["repos_url"];
263+ if (json["site_admin"] != Standards.JSON.true && json["site_admin"] != Standards.JSON.false) error("Expected bool");
262264 retval.site_admin = json["site_admin"];
263265 retval.starred_url = json["starred_url"];
264266 retval.subscriptions_url = json["subscriptions_url"];
@@ -301,6 +303,7 @@ Commit Commit_from_JSON(mixed json) {
301303 Commit retval = Commit();
302304
303305 retval.author = json["author"];
306+ if (json["distinct"] != Standards.JSON.true && json["distinct"] != Standards.JSON.false) error("Expected bool");
304307 retval.distinct = json["distinct"];
305308 retval.message = json["message"];
306309 retval.sha = json["sha"];
@@ -402,6 +405,7 @@ Issue Issue_from_JSON(mixed json) {
402405 retval.id = json["id"];
403406 retval.labels = json["labels"];
404407 retval.labels_url = json["labels_url"];
408+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
405409 retval.locked = json["locked"];
406410 if (!has_index(json, "milestone")) error("Missing required property");
407411 retval.milestone = json["milestone"];
@@ -442,6 +446,7 @@ Label Label_from_JSON(mixed json) {
442446
443447 retval.color = json["color"];
444448 retval.id = json["id"];
449+ if (json["default"] != Standards.JSON.true && json["default"] != Standards.JSON.false) error("Expected bool");
445450 retval.label_default = json["default"];
446451 retval.name = json["name"];
447452 retval.url = json["url"];
@@ -655,11 +660,14 @@ PayloadPullRequest PayloadPullRequest_from_JSON(mixed json) {
655660 retval.id = json["id"];
656661 retval.issue_url = json["issue_url"];
657662 retval.links = json["_links"];
663+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
658664 retval.locked = json["locked"];
665+ if (json["maintainer_can_modify"] != Standards.JSON.true && json["maintainer_can_modify"] != Standards.JSON.false) error("Expected bool");
659666 retval.maintainer_can_modify = json["maintainer_can_modify"];
660667 retval.merge_commit_sha = json["merge_commit_sha"];
661668 retval.mergeable = json["mergeable"];
662669 retval.mergeable_state = json["mergeable_state"];
670+ if (json["merged"] != Standards.JSON.true && json["merged"] != Standards.JSON.false) error("Expected bool");
663671 retval.merged = json["merged"];
664672 retval.merged_at = json["merged_at"];
665673 retval.merged_by = json["merged_by"];
@@ -881,6 +889,7 @@ BaseRepo BaseRepo_from_JSON(mixed json) {
881889 retval.description = json["description"];
882890 retval.downloads_url = json["downloads_url"];
883891 retval.events_url = json["events_url"];
892+ if (json["fork"] != Standards.JSON.true && json["fork"] != Standards.JSON.false) error("Expected bool");
884893 retval.fork = json["fork"];
885894 retval.forks = json["forks"];
886895 retval.forks_count = json["forks_count"];
@@ -890,10 +899,15 @@ BaseRepo BaseRepo_from_JSON(mixed json) {
890899 retval.git_refs_url = json["git_refs_url"];
891900 retval.git_tags_url = json["git_tags_url"];
892901 retval.git_url = json["git_url"];
902+ if (json["has_downloads"] != Standards.JSON.true && json["has_downloads"] != Standards.JSON.false) error("Expected bool");
893903 retval.has_downloads = json["has_downloads"];
904+ if (json["has_issues"] != Standards.JSON.true && json["has_issues"] != Standards.JSON.false) error("Expected bool");
894905 retval.has_issues = json["has_issues"];
906+ if (json["has_pages"] != Standards.JSON.true && json["has_pages"] != Standards.JSON.false) error("Expected bool");
895907 retval.has_pages = json["has_pages"];
908+ if (json["has_projects"] != Standards.JSON.true && json["has_projects"] != Standards.JSON.false) error("Expected bool");
896909 retval.has_projects = json["has_projects"];
910+ if (json["has_wiki"] != Standards.JSON.true && json["has_wiki"] != Standards.JSON.false) error("Expected bool");
897911 retval.has_wiki = json["has_wiki"];
898912 retval.homepage = json["homepage"];
899913 retval.hooks_url = json["hooks_url"];
@@ -917,6 +931,7 @@ BaseRepo BaseRepo_from_JSON(mixed json) {
917931 retval.pulls_url = json["pulls_url"];
918932 retval.pushed_at = json["pushed_at"];
919933 retval.releases_url = json["releases_url"];
934+ if (json["private"] != Standards.JSON.true && json["private"] != Standards.JSON.false) error("Expected bool");
920935 retval.repo_private = json["private"];
921936 retval.size = json["size"];
922937 retval.ssh_url = json["ssh_url"];
Test case

test/inputs/json/samples/kitchen-sink.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -53,6 +53,7 @@ class TopLevel {
5353 TopLevel TopLevel_from_JSON(mixed json) {
5454 TopLevel retval = TopLevel();
5555
56+ if (json["booleanValue"] != Standards.JSON.true && json["booleanValue"] != Standards.JSON.false) error("Expected bool");
5657 retval.boolean_value = json["booleanValue"];
5758 retval.date_value = json["dateValue"];
5859 retval.different_things = json["differentThings"];
Test case

test/inputs/json/samples/reddit.json

1 generated file · +19 −0
Mpikedefault / TopLevel.pmod+19 −0
@@ -234,6 +234,7 @@ ChildData ChildData_from_JSON(mixed json) {
234234
235235 retval.approved_at_utc = json["approved_at_utc"];
236236 retval.approved_by = json["approved_by"];
237+ if (json["archived"] != Standards.JSON.true && json["archived"] != Standards.JSON.false) error("Expected bool");
237238 retval.archived = json["archived"];
238239 retval.author = json["author"];
239240 if (!has_index(json, "author_flair_css_class")) error("Missing required property");
@@ -242,10 +243,15 @@ ChildData ChildData_from_JSON(mixed json) {
242243 retval.author_flair_text = json["author_flair_text"];
243244 retval.banned_at_utc = json["banned_at_utc"];
244245 retval.banned_by = json["banned_by"];
246+ if (json["brand_safe"] != Standards.JSON.true && json["brand_safe"] != Standards.JSON.false) error("Expected bool");
245247 retval.brand_safe = json["brand_safe"];
248+ if (json["can_gild"] != Standards.JSON.true && json["can_gild"] != Standards.JSON.false) error("Expected bool");
246249 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");
247251 retval.can_mod_post = json["can_mod_post"];
252+ if (json["clicked"] != Standards.JSON.true && json["clicked"] != Standards.JSON.false) error("Expected bool");
248253 retval.clicked = json["clicked"];
254+ if (json["contest_mode"] != Standards.JSON.true && json["contest_mode"] != Standards.JSON.false) error("Expected bool");
249255 retval.contest_mode = json["contest_mode"];
250256 retval.created = json["created"];
251257 retval.created_utc = json["created_utc"];
@@ -253,18 +259,24 @@ ChildData ChildData_from_JSON(mixed json) {
253259 retval.distinguished = json["distinguished"];
254260 retval.domain = Domain_from_JSON(json["domain"]);
255261 retval.downs = json["downs"];
262+ if (json["edited"] != Standards.JSON.true && json["edited"] != Standards.JSON.false) error("Expected bool");
256263 retval.edited = json["edited"];
257264 retval.gilded = json["gilded"];
265+ if (json["hidden"] != Standards.JSON.true && json["hidden"] != Standards.JSON.false) error("Expected bool");
258266 retval.hidden = json["hidden"];
267+ if (json["hide_score"] != Standards.JSON.true && json["hide_score"] != Standards.JSON.false) error("Expected bool");
259268 retval.hide_score = json["hide_score"];
260269 retval.id = json["id"];
270+ if (json["is_self"] != Standards.JSON.true && json["is_self"] != Standards.JSON.false) error("Expected bool");
261271 retval.is_self = json["is_self"];
272+ if (json["is_video"] != Standards.JSON.true && json["is_video"] != Standards.JSON.false) error("Expected bool");
262273 retval.is_video = json["is_video"];
263274 retval.likes = json["likes"];
264275 if (!has_index(json, "link_flair_css_class")) error("Missing required property");
265276 retval.link_flair_css_class = json["link_flair_css_class"];
266277 if (!has_index(json, "link_flair_text")) error("Missing required property");
267278 retval.link_flair_text = json["link_flair_text"];
279+ if (json["locked"] != Standards.JSON.true && json["locked"] != Standards.JSON.false) error("Expected bool");
268280 retval.locked = json["locked"];
269281 retval.media = json["media"];
270282 retval.media_embed = json["media_embed"];
@@ -272,21 +284,26 @@ ChildData ChildData_from_JSON(mixed json) {
272284 retval.name = json["name"];
273285 retval.num_comments = json["num_comments"];
274286 retval.num_reports = json["num_reports"];
287+ if (json["over_18"] != Standards.JSON.true && json["over_18"] != Standards.JSON.false) error("Expected bool");
275288 retval.over_18 = json["over_18"];
276289 retval.parent_whitelist_status = WhitelistStatus_from_JSON(json["parent_whitelist_status"]);
277290 retval.permalink = json["permalink"];
278291 retval.post_hint = PostHint_from_JSON(json["post_hint"]);
279292 retval.preview = json["preview"];
293+ if (json["quarantine"] != Standards.JSON.true && json["quarantine"] != Standards.JSON.false) error("Expected bool");
280294 retval.quarantine = json["quarantine"];
281295 retval.removal_reason = json["removal_reason"];
282296 retval.report_reasons = json["report_reasons"];
297+ if (json["saved"] != Standards.JSON.true && json["saved"] != Standards.JSON.false) error("Expected bool");
283298 retval.saved = json["saved"];
284299 retval.score = json["score"];
285300 retval.secure_media = json["secure_media"];
286301 retval.secure_media_embed = json["secure_media_embed"];
287302 retval.selftext = json["selftext"];
288303 retval.selftext_html = json["selftext_html"];
304+ if (json["spoiler"] != Standards.JSON.true && json["spoiler"] != Standards.JSON.false) error("Expected bool");
289305 retval.spoiler = json["spoiler"];
306+ if (json["stickied"] != Standards.JSON.true && json["stickied"] != Standards.JSON.false) error("Expected bool");
290307 retval.stickied = json["stickied"];
291308 retval.subreddit = Subreddit_from_JSON(json["subreddit"]);
292309 retval.subreddit_id = SubredditId_from_JSON(json["subreddit_id"]);
@@ -301,6 +318,7 @@ ChildData ChildData_from_JSON(mixed json) {
301318 retval.url = json["url"];
302319 retval.user_reports = json["user_reports"];
303320 retval.view_count = json["view_count"];
321+ if (json["visited"] != Standards.JSON.true && json["visited"] != Standards.JSON.false) error("Expected bool");
304322 retval.visited = json["visited"];
305323 retval.whitelist_status = WhitelistStatus_from_JSON(json["whitelist_status"]);
306324
@@ -368,6 +386,7 @@ class Preview {
368386 Preview Preview_from_JSON(mixed json) {
369387 Preview retval = Preview();
370388
389+ if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool");
371390 retval.enabled = json["enabled"];
372391 retval.images = json["images"];
Test case

test/inputs/json/samples/simple-object.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -33,6 +33,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
3333
3434 retval.date = json["date"];
3535 retval.title = json["title"];
36+ if (json["validity"] != Standards.JSON.true && json["validity"] != Standards.JSON.false) error("Expected bool");
3637 retval.validity = json["validity"];
3738
3839 return retval;
Test case

test/inputs/json/samples/spotify-album.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -285,6 +285,7 @@ Item Item_from_JSON(mixed json) {
285285 retval.available_markets = json["available_markets"];
286286 retval.disc_number = json["disc_number"];
287287 retval.duration_ms = json["duration_ms"];
288+ if (json["explicit"] != Standards.JSON.true && json["explicit"] != Standards.JSON.false) error("Expected bool");
288289 retval.explicit = json["explicit"];
289290 retval.external_urls = json["external_urls"];
290291 retval.href = json["href"];
Test case

test/inputs/json/samples/us-senators.json

1 generated file · +1 −0
Mpikedefault / TopLevel.pmod+1 −0
@@ -121,6 +121,7 @@ Object Object_from_JSON(mixed json) {
121121 if (!has_index(json, "caucus")) error("Missing required property");
122122 retval.caucus = Party_from_JSON(json["caucus"]);
123123 retval.congress_numbers = json["congress_numbers"];
124+ if (json["current"] != Standards.JSON.true && json["current"] != Standards.JSON.false) error("Expected bool");
124125 retval.current = json["current"];
125126 retval.description = json["description"];
126127 retval.district = json["district"];
Test case

test/inputs/schema/const-non-string.schema

1 generated file · +1 −0
Mschema-pikedefault / TopLevel.pmod+1 −0
@@ -36,6 +36,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
3636 TopLevel retval = TopLevel();
3737
3838 retval.amount = json["amount"];
39+ if (json["enabled"] != Standards.JSON.true && json["enabled"] != Standards.JSON.false) error("Expected bool");
3940 retval.enabled = json["enabled"];
4041 retval.kind = Kind_from_JSON(json["kind"]);
4142 retval.ratio = (float)json["ratio"];
Test case

test/inputs/schema/implicit-all-of.schema

1 generated file · +1 −0
Mschema-pikedefault / TopLevel.pmod+1 −0
@@ -32,6 +32,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
3232 TopLevel retval = TopLevel();
3333
3434 retval.foo = json["foo"];
35+ if (json["bar"] != Standards.JSON.true && json["bar"] != Standards.JSON.false) error("Expected bool");
3536 retval.bar = json["bar"];
3637 retval.quux = json["quux"];
Test case

test/inputs/schema/non-standard-ref.schema

1 generated file · +1 −0
Mschema-pikedefault / TopLevel.pmod+1 −0
@@ -33,6 +33,7 @@ TopLevel TopLevel_from_JSON(mixed json) {
3333
3434 retval.bar = json["bar"];
3535 retval.foo = json["foo"];
36+ if (json["quux"] != Standards.JSON.true && json["quux"] != Standards.JSON.false) error("Expected bool");
3637 retval.quux = json["quux"];
3738
3839 return retval;
Test case

test/inputs/schema/optional-any.schema

1 generated file · +37 −0
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

test/inputs/schema/union.schema

1 generated file · +1 −0
Mschema-pikedefault / TopLevel.pmod+1 −0
@@ -38,6 +38,7 @@ TopLevelElement TopLevelElement_from_JSON(mixed json) {
3838 TopLevelElement retval = TopLevelElement();
3939
4040 retval.one = json["one"];
41+ if (json["two"] != Standards.JSON.true && json["two"] != Standards.JSON.false) error("Expected bool");
4142 retval.two = json["two"];
4243 retval.three = json["three"];
No generated files match these filters.