Generated-output differences

quicktype output changed between the PR base and tested PR merge revisions.
← Back to the pull request
51test cases
51files differ
49modified
0new
2deleted
518changed lines
+168 −350insertions / deletions
Base ac808cb07becb575e8de6921f6d87a1bdbf48c6e · PR merge c2a77446f48cfe93bddfde691bed6f7ad297f7e3 · Head f999fb82e8f77c0d8fc0166dfb69e03f4b769576 · raw patch
Test case

test/inputs/graphql/github1.graphql

1 generated file · +1 −1
Mgraphql-elixirdefault / QuickType.ex+1 −1
@@ -23,7 +23,7 @@ defmodule User do
2323 def from_map(m) do
2424 %User{
2525 login: decode_login(m["login"]),
26- real_name: Map.fetch!(m, "realName"),
26+ real_name: decode_real_name(Map.fetch!(m, "realName")),
2727 }
2828 end
Test case

test/inputs/graphql/github4.graphql

1 generated file · +1 −1
Mgraphql-elixirdefault / QuickType.ex+1 −1
@@ -178,7 +178,7 @@ defmodule User do
178178 def from_map(m) do
179179 %User{
180180 login: decode_login(m["login"]),
181- name: Map.fetch!(m, "name"),
181+ name: decode_name(Map.fetch!(m, "name")),
182182 repository: m["repository"] && Repository.from_map(m["repository"]),
183183 }
184184 end
Test case

test/inputs/graphql/github5.graphql

1 generated file · +1 −1
Mgraphql-elixirdefault / QuickType.ex+1 −1
@@ -23,7 +23,7 @@ defmodule User do
2323 def from_map(m) do
2424 %User{
2525 login: decode_login(m["login"]),
26- name: m["name"],
26+ name: m["name"] && decode_name(m["name"]),
2727 }
2828 end
Test case

test/inputs/graphql/github9.graphql

1 generated file · +1 −1
Mgraphql-elixirdefault / QuickType.ex+1 −1
@@ -148,7 +148,7 @@ defmodule AddReactionPayload do
148148
149149 def from_map(m) do
150150 %AddReactionPayload{
151- client_mutation_id: Map.fetch!(m, "clientMutationId"),
151+ client_mutation_id: decode_client_mutation_id(Map.fetch!(m, "clientMutationId")),
152152 reaction: Reaction.from_map(m["reaction"]),
153153 subject: Reactable.from_map(m["subject"]),
154154 }
Test case

test/inputs/json/misc/050b0.json

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -251,7 +251,7 @@ defmodule OtherName do
251251 def from_map(m) do
252252 %OtherName{
253253 name: decode_name(m["name"]),
254- note: Map.fetch!(m, "note"),
254+ note: decode_note(Map.fetch!(m, "note")),
255255 }
256256 end
257257
@@ -477,7 +477,7 @@ defmodule TopLevelElement do
477477 links: Enum.map(m["links"], &Link.from_map/1),
478478 name: decode_name(m["name"]),
479479 other_names: Enum.map(m["other_names"], &OtherName.from_map/1),
480- superseded_by: Map.fetch!(m, "superseded_by"),
480+ superseded_by: decode_superseded_by(Map.fetch!(m, "superseded_by")),
481481 text: Enum.map(m["text"], &Text.from_map/1),
482482 }
483483 end
Test case

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

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -1578,7 +1578,7 @@ defmodule Payload do
15781578 action: m["action"],
15791579 before: m["before"],
15801580 commits: m["commits"] && Enum.map(m["commits"], &Commit.from_map/1),
1581- description: m["description"],
1581+ description: m["description"] && decode_description(m["description"]),
15821582 distinct_size: m["distinct_size"],
15831583 head: m["head"],
15841584 master_branch: m["master_branch"],
Test case

test/inputs/json/misc/10be4.json

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -260,7 +260,7 @@ defmodule OtherName do
260260 def from_map(m) do
261261 %OtherName{
262262 name: decode_name(m["name"]),
263- note: Map.fetch!(m, "note"),
263+ note: decode_note(Map.fetch!(m, "note")),
264264 }
265265 end
266266
@@ -488,7 +488,7 @@ defmodule TopLevelElement do
488488 links: Enum.map(m["links"], &Link.from_map/1),
489489 name: decode_name(m["name"]),
490490 other_names: Enum.map(m["other_names"], &OtherName.from_map/1),
491- superseded_by: Map.fetch!(m, "superseded_by"),
491+ superseded_by: decode_superseded_by(Map.fetch!(m, "superseded_by")),
492492 text: Enum.map(m["text"], &Text.from_map/1),
493493 }
494494 end
Test case

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

1 generated file · +5 −5
Melixirdefault / QuickType.ex+5 −5
@@ -90,7 +90,7 @@ defmodule Extra do
9090 %Extra{
9191 address: decode_address(m["address"]),
9292 contact_form: m["contact_form"],
93- fax: m["fax"],
93+ fax: m["fax"] && decode_fax(m["fax"]),
9494 office: decode_office(m["office"]),
9595 rss_url: m["rss_url"],
9696 }
@@ -419,10 +419,10 @@ defmodule Person do
419419 namemod: Namemod.decode(m["namemod"]),
420420 nickname: decode_nickname(m["nickname"]),
421421 osid: decode_osid(m["osid"]),
422- pvsid: Map.fetch!(m, "pvsid"),
422+ pvsid: decode_pvsid(Map.fetch!(m, "pvsid")),
423423 sortname: decode_sortname(m["sortname"]),
424- twitterid: Map.fetch!(m, "twitterid"),
425- youtubeid: Map.fetch!(m, "youtubeid"),
424+ twitterid: decode_twitterid(Map.fetch!(m, "twitterid")),
425+ youtubeid: decode_youtubeid(Map.fetch!(m, "youtubeid")),
426426 }
427427 end
428428
@@ -716,7 +716,7 @@ defmodule Object do
716716 enddate: decode_enddate(m["enddate"]),
717717 extra: Extra.from_map(m["extra"]),
718718 id: decode_id(m["id"]),
719- leadership_title: Map.fetch!(m, "leadership_title"),
719+ leadership_title: decode_leadership_title(Map.fetch!(m, "leadership_title")),
720720 party: Party.decode(m["party"]),
721721 person: Person.from_map(m["person"]),
722722 phone: decode_phone(m["phone"]),
Test case

test/inputs/json/misc/27332.json

1 generated file · +8 −8
Melixirdefault / QuickType.ex+8 −8
@@ -1033,8 +1033,8 @@ defmodule ChildData do
10331033 approved_by: decode_approved_by(m["approved_by"]),
10341034 archived: decode_archived(m["archived"]),
10351035 author: decode_author(m["author"]),
1036- author_flair_css_class: Map.fetch!(m, "author_flair_css_class"),
1037- author_flair_text: Map.fetch!(m, "author_flair_text"),
1036+ author_flair_css_class: decode_author_flair_css_class(Map.fetch!(m, "author_flair_css_class")),
1037+ author_flair_text: decode_author_flair_text(Map.fetch!(m, "author_flair_text")),
10381038 banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]),
10391039 banned_by: decode_banned_by(m["banned_by"]),
10401040 brand_safe: decode_brand_safe(m["brand_safe"]),
@@ -1044,7 +1044,7 @@ defmodule ChildData do
10441044 contest_mode: decode_contest_mode(m["contest_mode"]),
10451045 created: decode_created(m["created"]),
10461046 created_utc: decode_created_utc(m["created_utc"]),
1047- distinguished: Map.fetch!(m, "distinguished"),
1047+ distinguished: decode_distinguished(Map.fetch!(m, "distinguished")),
10481048 domain: Domain.decode(m["domain"]),
10491049 downs: decode_downs(m["downs"]),
10501050 edited: decode_edited(m["edited"]),
@@ -1055,8 +1055,8 @@ defmodule ChildData do
10551055 is_self: decode_is_self(m["is_self"]),
10561056 is_video: decode_is_video(m["is_video"]),
10571057 likes: decode_likes(m["likes"]),
1058- link_flair_css_class: Map.fetch!(m, "link_flair_css_class"),
1059- link_flair_text: Map.fetch!(m, "link_flair_text"),
1058+ link_flair_css_class: decode_link_flair_css_class(Map.fetch!(m, "link_flair_css_class")),
1059+ link_flair_text: decode_link_flair_text(Map.fetch!(m, "link_flair_text")),
10601060 locked: decode_locked(m["locked"]),
10611061 media: m["media"] && Media.from_map(m["media"]),
10621062 media_embed: MediaEmbed.from_map(m["media_embed"]),
@@ -1076,7 +1076,7 @@ defmodule ChildData do
10761076 secure_media: m["secure_media"] && Media.from_map(m["secure_media"]),
10771077 secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]),
10781078 selftext: decode_selftext(m["selftext"]),
1079- selftext_html: Map.fetch!(m, "selftext_html"),
1079+ selftext_html: decode_selftext_html(Map.fetch!(m, "selftext_html")),
10801080 spoiler: decode_spoiler(m["spoiler"]),
10811081 stickied: decode_stickied(m["stickied"]),
10821082 subreddit: Subreddit.decode(m["subreddit"]),
@@ -1085,8 +1085,8 @@ defmodule ChildData do
10851085 subreddit_type: SubredditType.decode(m["subreddit_type"]),
10861086 suggested_sort: decode_suggested_sort(m["suggested_sort"]),
10871087 thumbnail: decode_thumbnail(m["thumbnail"]),
1088- thumbnail_height: Map.fetch!(m, "thumbnail_height"),
1089- thumbnail_width: Map.fetch!(m, "thumbnail_width"),
1088+ thumbnail_height: decode_thumbnail_height(Map.fetch!(m, "thumbnail_height")),
1089+ thumbnail_width: decode_thumbnail_width(Map.fetch!(m, "thumbnail_width")),
10901090 title: decode_title(m["title"]),
10911091 ups: decode_ups(m["ups"]),
10921092 url: decode_url(m["url"]),
Test case

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

1 generated file · +5 −5
Melixirdefault / QuickType.ex+5 −5
@@ -976,7 +976,7 @@ defmodule ChildData do
976976 distinguished: Distinguished.decode(m["distinguished"]),
977977 domain: Domain.decode(m["domain"]),
978978 downs: decode_downs(m["downs"]),
979- edited: Map.fetch!(m, "edited"),
979+ edited: decode_edited(Map.fetch!(m, "edited")),
980980 gilded: decode_gilded(m["gilded"]),
981981 hidden: decode_hidden(m["hidden"]),
982982 hide_score: decode_hide_score(m["hide_score"]),
@@ -1005,17 +1005,17 @@ defmodule ChildData do
10051005 secure_media: decode_secure_media(m["secure_media"]),
10061006 secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]),
10071007 selftext: decode_selftext(m["selftext"]),
1008- selftext_html: Map.fetch!(m, "selftext_html"),
1008+ selftext_html: decode_selftext_html(Map.fetch!(m, "selftext_html")),
10091009 spoiler: decode_spoiler(m["spoiler"]),
10101010 stickied: decode_stickied(m["stickied"]),
10111011 subreddit: Subreddit.decode(m["subreddit"]),
10121012 subreddit_id: SubredditID.decode(m["subreddit_id"]),
10131013 subreddit_name_prefixed: SubredditNamePrefixed.decode(m["subreddit_name_prefixed"]),
10141014 subreddit_type: SubredditType.decode(m["subreddit_type"]),
1015- suggested_sort: Map.fetch!(m, "suggested_sort"),
1015+ suggested_sort: decode_suggested_sort(Map.fetch!(m, "suggested_sort")),
10161016 thumbnail: decode_thumbnail(m["thumbnail"]),
1017- thumbnail_height: Map.fetch!(m, "thumbnail_height"),
1018- thumbnail_width: Map.fetch!(m, "thumbnail_width"),
1017+ thumbnail_height: decode_thumbnail_height(Map.fetch!(m, "thumbnail_height")),
1018+ thumbnail_width: decode_thumbnail_width(Map.fetch!(m, "thumbnail_width")),
10191019 title: decode_title(m["title"]),
10201020 ups: decode_ups(m["ups"]),
10211021 url: decode_url(m["url"]),
Test case

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

1 generated file · +3 −3
Melixirdefault / QuickType.ex+3 −3
@@ -432,8 +432,8 @@ defmodule Person do
432432 osid: decode_osid(m["osid"]),
433433 pvsid: decode_pvsid(m["pvsid"]),
434434 sortname: decode_sortname(m["sortname"]),
435- twitterid: Map.fetch!(m, "twitterid"),
436- youtubeid: Map.fetch!(m, "youtubeid"),
435+ twitterid: decode_twitterid(Map.fetch!(m, "twitterid")),
436+ youtubeid: decode_youtubeid(Map.fetch!(m, "youtubeid")),
437437 }
438438 end
439439
@@ -894,7 +894,7 @@ defmodule Object do
894894 enddate: decode_enddate(m["enddate"]),
895895 extra: Extra.from_map(m["extra"]),
896896 id: decode_id(m["id"]),
897- leadership_title: Map.fetch!(m, "leadership_title"),
897+ leadership_title: decode_leadership_title(Map.fetch!(m, "leadership_title")),
898898 party: Party.decode(m["party"]),
899899 person: Person.from_map(m["person"]),
900900 phone: decode_phone(m["phone"]),
Test case

test/inputs/json/misc/32431.json

1 generated file · +3 −3
Melixirdefault / QuickType.ex+3 −3
@@ -393,15 +393,15 @@ defmodule Properties do
393393 cdi: decode_cdi(m["cdi"]),
394394 code: decode_code(m["code"]),
395395 detail: decode_detail(m["detail"]),
396- dmin: Map.fetch!(m, "dmin"),
396+ dmin: decode_dmin(Map.fetch!(m, "dmin")),
397397 felt: decode_felt(m["felt"]),
398- gap: Map.fetch!(m, "gap"),
398+ gap: decode_gap(Map.fetch!(m, "gap")),
399399 ids: decode_ids(m["ids"]),
400400 mag: decode_mag(m["mag"]),
401401 mag_type: MagType.decode(m["magType"]),
402402 mmi: decode_mmi(m["mmi"]),
403403 net: decode_net(m["net"]),
404- nst: Map.fetch!(m, "nst"),
404+ nst: decode_nst(Map.fetch!(m, "nst")),
405405 place: decode_place(m["place"]),
406406 rms: decode_rms(m["rms"]),
407407 sig: decode_sig(m["sig"]),
Test case

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

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -64,7 +64,7 @@ defmodule TopLevelElement do
6464
6565 def from_map(m) do
6666 %TopLevelElement{
67- birth_date: Map.fetch!(m, "BirthDate"),
67+ birth_date: decode_birth_date(Map.fetch!(m, "BirthDate")),
6868 birth_date_is_protected: decode_birth_date_is_protected(m["BirthDateIsProtected"]),
6969 gender_type_id: decode_gender_type_id(m["GenderTypeID"]),
7070 notes: decode_notes(m["Notes"]),
Test case

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

1 generated file · +17 −17
Melixirdefault / QuickType.ex+17 −17
@@ -382,35 +382,35 @@ defmodule Result do
382382
383383 def from_map(m) do
384384 %Result{
385- cost_absolute: Map.fetch!(m, "cost_absolute"),
386- cost_max: Map.fetch!(m, "cost_max"),
387- cost_min: Map.fetch!(m, "cost_min"),
385+ cost_absolute: decode_cost_absolute(Map.fetch!(m, "cost_absolute")),
386+ cost_max: decode_cost_max(Map.fetch!(m, "cost_max")),
387+ cost_min: decode_cost_min(Map.fetch!(m, "cost_min")),
388388 created_at: decode_created_at(m["created_at"]),
389389 custom_incomes: Enum.map(m["customIncomes"], &CustomIncome.from_map/1),
390390 direct_rep_costs_max: decode_direct_rep_costs_max(m["direct_rep_costs_max"]),
391391 direct_rep_costs_min: decode_direct_rep_costs_min(m["direct_rep_costs_min"]),
392392 end_date: decode_end_date(m["end_date"]),
393393 eur_sources_grants: decode_eur_sources_grants(m["eur_sources_grants"]),
394- eur_sources_grants_src: Map.fetch!(m, "eur_sources_grants_src"),
394+ eur_sources_grants_src: decode_eur_sources_grants_src(Map.fetch!(m, "eur_sources_grants_src")),
395395 eur_sources_procurement: decode_eur_sources_procurement(m["eur_sources_procurement"]),
396- eur_sources_procurement_src: Map.fetch!(m, "eur_sources_procurement_src"),
396+ eur_sources_procurement_src: decode_eur_sources_procurement_src(Map.fetch!(m, "eur_sources_procurement_src")),
397397 id: decode_id(m["id"]),
398398 new_organisation: decode_new_organisation(m["new_organisation"]),
399- no_clients: Map.fetch!(m, "no_clients"),
400- other_financial_information: Map.fetch!(m, "other_financial_information"),
401- other_sources_contributions: Map.fetch!(m, "other_sources_contributions"),
402- other_sources_donation: Map.fetch!(m, "other_sources_donation"),
403- other_sources_total: Map.fetch!(m, "other_sources_total"),
404- public_financing_infranational: Map.fetch!(m, "public_financing_infranational"),
405- public_financing_national: Map.fetch!(m, "public_financing_national"),
406- public_financing_total: Map.fetch!(m, "public_financing_total"),
399+ no_clients: decode_no_clients(Map.fetch!(m, "no_clients")),
400+ other_financial_information: decode_other_financial_information(Map.fetch!(m, "other_financial_information")),
401+ other_sources_contributions: decode_other_sources_contributions(Map.fetch!(m, "other_sources_contributions")),
402+ other_sources_donation: decode_other_sources_donation(Map.fetch!(m, "other_sources_donation")),
403+ other_sources_total: decode_other_sources_total(Map.fetch!(m, "other_sources_total")),
404+ public_financing_infranational: decode_public_financing_infranational(Map.fetch!(m, "public_financing_infranational")),
405+ public_financing_national: decode_public_financing_national(Map.fetch!(m, "public_financing_national")),
406+ public_financing_total: decode_public_financing_total(Map.fetch!(m, "public_financing_total")),
407407 representative: decode_representative(m["representative"]),
408408 start_date: decode_start_date(m["start_date"]),
409409 status: Status.decode(m["status"]),
410- total_budget: Map.fetch!(m, "total_budget"),
411- turnover_absolute: Map.fetch!(m, "turnover_absolute"),
412- turnover_max: Map.fetch!(m, "turnover_max"),
413- turnover_min: Map.fetch!(m, "turnover_min"),
410+ total_budget: decode_total_budget(Map.fetch!(m, "total_budget")),
411+ turnover_absolute: decode_turnover_absolute(Map.fetch!(m, "turnover_absolute")),
412+ turnover_max: decode_turnover_max(Map.fetch!(m, "turnover_max")),
413+ turnover_min: decode_turnover_min(Map.fetch!(m, "turnover_min")),
414414 type: ResultType.decode(m["type"]),
415415 updated_at: decode_updated_at(m["updated_at"]),
416416 uri: decode_uri(m["uri"]),
Test case

test/inputs/json/misc/34702.json

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -484,7 +484,7 @@ defmodule FeatureProperties do
484484 latitude: decode_latitude(m["latitude"]),
485485 local_govt: decode_local_govt(m["local_govt"]),
486486 longitude: decode_longitude(m["longitude"]),
487- no: Map.fetch!(m, "no"),
487+ no: decode_no(Map.fetch!(m, "no")),
488488 phone: decode_phone(m["phone"]),
489489 postcode: decode_postcode(m["postcode"]),
490490 psa: decode_psa(m["psa"]),
Test case

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

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -1094,8 +1094,8 @@ defmodule ChildData do
10941094 subreddit_type: SubredditType.decode(m["subreddit_type"]),
10951095 suggested_sort: decode_suggested_sort(m["suggested_sort"]),
10961096 thumbnail: decode_thumbnail(m["thumbnail"]),
1097- thumbnail_height: Map.fetch!(m, "thumbnail_height"),
1098- thumbnail_width: Map.fetch!(m, "thumbnail_width"),
1097+ thumbnail_height: decode_thumbnail_height(Map.fetch!(m, "thumbnail_height")),
1098+ thumbnail_width: decode_thumbnail_width(Map.fetch!(m, "thumbnail_width")),
10991099 title: decode_title(m["title"]),
11001100 ups: decode_ups(m["ups"]),
11011101 url: decode_url(m["url"]),
Test case

test/inputs/json/misc/570ec.json

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -160,7 +160,7 @@ defmodule OtherName do
160160 def from_map(m) do
161161 %OtherName{
162162 name: decode_name(m["name"]),
163- note: Map.fetch!(m, "note"),
163+ note: decode_note(Map.fetch!(m, "note")),
164164 }
165165 end
Test case

test/inputs/json/misc/66121.json

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -428,7 +428,7 @@ defmodule TopLevelElement do
428428 links: Enum.map(m["links"], &Link.from_map/1),
429429 name: decode_name(m["name"]),
430430 other_names: decode_other_names(m["other_names"]),
431- superseded_by: Map.fetch!(m, "superseded_by"),
431+ superseded_by: decode_superseded_by(Map.fetch!(m, "superseded_by")),
432432 text: Enum.map(m["text"], &Text.from_map/1),
433433 }
434434 end
Test case

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

1 generated file · +8 −8
Melixirdefault / QuickType.ex+8 −8
@@ -935,8 +935,8 @@ defmodule ChildData do
935935 approved_by: decode_approved_by(m["approved_by"]),
936936 archived: decode_archived(m["archived"]),
937937 author: decode_author(m["author"]),
938- author_flair_css_class: Map.fetch!(m, "author_flair_css_class"),
939- author_flair_text: Map.fetch!(m, "author_flair_text"),
938+ author_flair_css_class: decode_author_flair_css_class(Map.fetch!(m, "author_flair_css_class")),
939+ author_flair_text: decode_author_flair_text(Map.fetch!(m, "author_flair_text")),
940940 banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]),
941941 banned_by: decode_banned_by(m["banned_by"]),
942942 brand_safe: decode_brand_safe(m["brand_safe"]),
@@ -957,8 +957,8 @@ defmodule ChildData do
957957 is_self: decode_is_self(m["is_self"]),
958958 is_video: decode_is_video(m["is_video"]),
959959 likes: decode_likes(m["likes"]),
960- link_flair_css_class: Map.fetch!(m, "link_flair_css_class"),
961- link_flair_text: Map.fetch!(m, "link_flair_text"),
960+ link_flair_css_class: decode_link_flair_css_class(Map.fetch!(m, "link_flair_css_class")),
961+ link_flair_text: decode_link_flair_text(Map.fetch!(m, "link_flair_text")),
962962 locked: decode_locked(m["locked"]),
963963 media: m["media"] && Media.from_map(m["media"]),
964964 media_embed: MediaEmbed.from_map(m["media_embed"]),
@@ -978,17 +978,17 @@ defmodule ChildData do
978978 secure_media: m["secure_media"] && Media.from_map(m["secure_media"]),
979979 secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]),
980980 selftext: decode_selftext(m["selftext"]),
981- selftext_html: Map.fetch!(m, "selftext_html"),
981+ selftext_html: decode_selftext_html(Map.fetch!(m, "selftext_html")),
982982 spoiler: decode_spoiler(m["spoiler"]),
983983 stickied: decode_stickied(m["stickied"]),
984984 subreddit: decode_subreddit(m["subreddit"]),
985985 subreddit_id: decode_subreddit_id(m["subreddit_id"]),
986986 subreddit_name_prefixed: decode_subreddit_name_prefixed(m["subreddit_name_prefixed"]),
987987 subreddit_type: SubredditType.decode(m["subreddit_type"]),
988- suggested_sort: Map.fetch!(m, "suggested_sort"),
988+ suggested_sort: decode_suggested_sort(Map.fetch!(m, "suggested_sort")),
989989 thumbnail: decode_thumbnail(m["thumbnail"]),
990- thumbnail_height: Map.fetch!(m, "thumbnail_height"),
991- thumbnail_width: Map.fetch!(m, "thumbnail_width"),
990+ thumbnail_height: decode_thumbnail_height(Map.fetch!(m, "thumbnail_height")),
991+ thumbnail_width: decode_thumbnail_width(Map.fetch!(m, "thumbnail_width")),
992992 title: decode_title(m["title"]),
993993 ups: decode_ups(m["ups"]),
994994 url: decode_url(m["url"]),
Test case

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

1 generated file · +18 −18
Melixirdefault / QuickType.ex+18 −18
@@ -359,21 +359,21 @@ defmodule Result do
359359
360360 def from_map(m) do
361361 %Result{
362- acronym: Map.fetch!(m, "acronym"),
362+ acronym: decode_acronym(Map.fetch!(m, "acronym")),
363363 activity_consult_committees: decode_activity_consult_committees(m["activity_consult_committees"]),
364364 activity_eu_legislative: decode_activity_eu_legislative(m["activity_eu_legislative"]),
365365 activity_expert_groups: decode_activity_expert_groups(m["activity_expert_groups"]),
366366 activity_high_level_groups: decode_activity_high_level_groups(m["activity_high_level_groups"]),
367367 activity_industry_forums: decode_activity_industry_forums(m["activity_industry_forums"]),
368368 activity_inter_groups: decode_activity_inter_groups(m["activity_inter_groups"]),
369- activity_other: Map.fetch!(m, "activity_other"),
369+ activity_other: decode_activity_other(Map.fetch!(m, "activity_other")),
370370 activity_relevant_comm: decode_activity_relevant_comm(m["activity_relevant_comm"]),
371371 be_office_country: m["be_office_country"],
372- be_office_lat: m["be_office_lat"],
373- be_office_lon: m["be_office_lon"],
372+ be_office_lat: m["be_office_lat"] && decode_be_office_lat(m["be_office_lat"]),
373+ be_office_lon: m["be_office_lon"] && decode_be_office_lon(m["be_office_lon"]),
374374 be_office_phone: m["be_office_phone"],
375- be_office_post_code: m["be_office_post_code"],
376- be_office_postbox: m["be_office_postbox"],
375+ be_office_post_code: m["be_office_post_code"] && decode_be_office_post_code(m["be_office_post_code"]),
376+ be_office_postbox: m["be_office_postbox"] && decode_be_office_postbox(m["be_office_postbox"]),
377377 be_office_street: m["be_office_street"],
378378 be_office_town: m["be_office_town"],
379379 code_of_conduct: decode_code_of_conduct(m["code_of_conduct"]),
@@ -383,11 +383,11 @@ defmodule Result do
383383 goals: decode_goals(m["goals"]),
384384 head: decode_head(m["head"]),
385385 head_office_country: decode_head_office_country(m["head_office_country"]),
386- head_office_lat: Map.fetch!(m, "head_office_lat"),
387- head_office_lon: Map.fetch!(m, "head_office_lon"),
386+ head_office_lat: decode_head_office_lat(Map.fetch!(m, "head_office_lat")),
387+ head_office_lon: decode_head_office_lon(Map.fetch!(m, "head_office_lon")),
388388 head_office_phone: decode_head_office_phone(m["head_office_phone"]),
389- head_office_post_code: Map.fetch!(m, "head_office_post_code"),
390- head_office_postbox: Map.fetch!(m, "head_office_postbox"),
389+ head_office_post_code: decode_head_office_post_code(Map.fetch!(m, "head_office_post_code")),
390+ head_office_postbox: decode_head_office_postbox(Map.fetch!(m, "head_office_postbox")),
391391 head_office_street: decode_head_office_street(m["head_office_street"]),
392392 head_office_town: decode_head_office_town(m["head_office_town"]),
393393 id: decode_id(m["id"]),
@@ -399,16 +399,16 @@ defmodule Result do
399399 main_category: decode_main_category(m["main_category"]),
400400 main_category_title: decode_main_category_title(m["main_category_title"]),
401401 members: decode_members(m["members"]),
402- members_100: Map.fetch!(m, "members_100"),
403- members_25: Map.fetch!(m, "members_25"),
404- members_50: Map.fetch!(m, "members_50"),
405- members_75: Map.fetch!(m, "members_75"),
402+ members_100: decode_members_100(Map.fetch!(m, "members_100")),
403+ members_25: decode_members_25(Map.fetch!(m, "members_25")),
404+ members_50: decode_members_50(Map.fetch!(m, "members_50")),
405+ members_75: decode_members_75(Map.fetch!(m, "members_75")),
406406 members_fte: decode_members_fte(m["members_fte"]),
407407 name: decode_name(m["name"]),
408408 native_name: decode_native_name(m["native_name"]),
409- networking: Map.fetch!(m, "networking"),
410- number_of_natural_persons: Map.fetch!(m, "number_of_natural_persons"),
411- other_code_of_conduct: Map.fetch!(m, "other_code_of_conduct"),
409+ networking: decode_networking(Map.fetch!(m, "networking")),
410+ number_of_natural_persons: decode_number_of_natural_persons(Map.fetch!(m, "number_of_natural_persons")),
411+ other_code_of_conduct: decode_other_code_of_conduct(Map.fetch!(m, "other_code_of_conduct")),
412412 registration_date: decode_registration_date(m["registration_date"]),
413413 status: Status.decode(m["status"]),
414414 structure_members: decode_structure_members(m["structure_members"]),
@@ -416,7 +416,7 @@ defmodule Result do
416416 sub_category_title: decode_sub_category_title(m["sub_category_title"]),
417417 updated_at: decode_updated_at(m["updated_at"]),
418418 uri: decode_uri(m["uri"]),
419- web_site_url: Map.fetch!(m, "web_site_url"),
419+ web_site_url: decode_web_site_url(Map.fetch!(m, "web_site_url")),
420420 }
421421 end
Test case

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

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -271,7 +271,7 @@ defmodule TopLevelElement do
271271 comments_url: decode_comments_url(m["comments_url"]),
272272 commits_url: decode_commits_url(m["commits_url"]),
273273 created_at: decode_created_at(m["created_at"]),
274- description: Map.fetch!(m, "description"),
274+ description: decode_description(Map.fetch!(m, "description")),
275275 files: m["files"]
276276 |> Map.new(fn {key, value} -> {key, FileValue.from_map(value)} end),
277277 forks_url: decode_forks_url(m["forks_url"]),
Test case

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

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -90,7 +90,7 @@ defmodule Result do
9090 id: decode_id(m["id"]),
9191 items: decode_items(m["items"]),
9292 name: decode_name(m["name"]),
93- parent: Map.fetch!(m, "parent"),
93+ parent: decode_parent(Map.fetch!(m, "parent")),
9494 updated_at: decode_updated_at(m["updated_at"]),
9595 uri: decode_uri(m["uri"]),
9696 }
Test case

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

1 generated file · +5 −5
Melixirdefault / QuickType.ex+5 −5
@@ -845,8 +845,8 @@ defmodule ChildData do
845845 approved_by: decode_approved_by(m["approved_by"]),
846846 archived: decode_archived(m["archived"]),
847847 author: decode_author(m["author"]),
848- author_flair_css_class: Map.fetch!(m, "author_flair_css_class"),
849- author_flair_text: Map.fetch!(m, "author_flair_text"),
848+ author_flair_css_class: decode_author_flair_css_class(Map.fetch!(m, "author_flair_css_class")),
849+ author_flair_text: decode_author_flair_text(Map.fetch!(m, "author_flair_text")),
850850 banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]),
851851 banned_by: decode_banned_by(m["banned_by"]),
852852 brand_safe: decode_brand_safe(m["brand_safe"]),
@@ -888,7 +888,7 @@ defmodule ChildData do
888888 secure_media: decode_secure_media(m["secure_media"]),
889889 secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]),
890890 selftext: decode_selftext(m["selftext"]),
891- selftext_html: Map.fetch!(m, "selftext_html"),
891+ selftext_html: decode_selftext_html(Map.fetch!(m, "selftext_html")),
892892 spoiler: decode_spoiler(m["spoiler"]),
893893 stickied: decode_stickied(m["stickied"]),
894894 subreddit: Subreddit.decode(m["subreddit"]),
@@ -897,8 +897,8 @@ defmodule ChildData do
897897 subreddit_type: SubredditType.decode(m["subreddit_type"]),
898898 suggested_sort: SuggestedSort.decode(m["suggested_sort"]),
899899 thumbnail: decode_thumbnail(m["thumbnail"]),
900- thumbnail_height: Map.fetch!(m, "thumbnail_height"),
901- thumbnail_width: Map.fetch!(m, "thumbnail_width"),
900+ thumbnail_height: decode_thumbnail_height(Map.fetch!(m, "thumbnail_height")),
901+ thumbnail_width: decode_thumbnail_width(Map.fetch!(m, "thumbnail_width")),
902902 title: decode_title(m["title"]),
903903 ups: decode_ups(m["ups"]),
904904 url: decode_url(m["url"]),
Test case

test/inputs/json/misc/996bd.json

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -392,7 +392,7 @@ defmodule TopLevelElement do
392392 links: Enum.map(m["links"], &Link.from_map/1),
393393 name: decode_name(m["name"]),
394394 other_names: decode_other_names(m["other_names"]),
395- superseded_by: Map.fetch!(m, "superseded_by"),
395+ superseded_by: decode_superseded_by(Map.fetch!(m, "superseded_by")),
396396 text: Enum.map(m["text"], &Text.from_map/1),
397397 }
398398 end
Test case

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

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -200,7 +200,7 @@ defmodule Result do
200200 id: decode_id(m["id"]),
201201 last_name: decode_last_name(m["last_name"]),
202202 name: decode_name(m["name"]),
203- position: Map.fetch!(m, "position"),
203+ position: decode_position(Map.fetch!(m, "position")),
204204 status: Status.decode(m["status"]),
205205 title: m["title"] && Title.decode(m["title"]),
206206 updated_at: decode_updated_at(m["updated_at"]),
Test case

test/inputs/json/misc/ad8be.json

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -260,7 +260,7 @@ defmodule OtherName do
260260 def from_map(m) do
261261 %OtherName{
262262 name: decode_name(m["name"]),
263- note: Map.fetch!(m, "note"),
263+ note: decode_note(Map.fetch!(m, "note")),
264264 }
265265 end
266266
@@ -488,7 +488,7 @@ defmodule TopLevelElement do
488488 links: Enum.map(m["links"], &Link.from_map/1),
489489 name: decode_name(m["name"]),
490490 other_names: Enum.map(m["other_names"], &OtherName.from_map/1),
491- superseded_by: Map.fetch!(m, "superseded_by"),
491+ superseded_by: decode_superseded_by(Map.fetch!(m, "superseded_by")),
492492 text: Enum.map(m["text"], &Text.from_map/1),
493493 }
494494 end
Test case

test/inputs/json/misc/ae7f0.json

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -664,8 +664,8 @@ defmodule ChildData do
664664 is_self: decode_is_self(m["is_self"]),
665665 is_video: decode_is_video(m["is_video"]),
666666 likes: decode_likes(m["likes"]),
667- link_flair_css_class: Map.fetch!(m, "link_flair_css_class"),
668- link_flair_text: Map.fetch!(m, "link_flair_text"),
667+ link_flair_css_class: decode_link_flair_css_class(Map.fetch!(m, "link_flair_css_class")),
668+ link_flair_text: decode_link_flair_text(Map.fetch!(m, "link_flair_text")),
669669 locked: decode_locked(m["locked"]),
670670 media: decode_media(m["media"]),
671671 media_embed: MediaEmbed.from_map(m["media_embed"]),
Test case

test/inputs/json/misc/af2d1.json

1 generated file · +8 −8
Melixirdefault / QuickType.ex+8 −8
@@ -737,16 +737,16 @@ defmodule FeatureProperties do
737737 add_improv: m["add_improv"] && AddImprov.decode(m["add_improv"]),
738738 area: decode_area(m["area_"]),
739739 asset_numb: decode_asset_numb(m["asset_numb"]),
740- comments: Map.fetch!(m, "comments"),
740+ comments: decode_comments(Map.fetch!(m, "comments")),
741741 condition: decode_condition(m["condition"]),
742- constructi: Map.fetch!(m, "constructi"),
742+ constructi: decode_constructi(Map.fetch!(m, "constructi")),
743743 createdate: decode_createdate(m["createdate"]),
744744 createuser: decode_createuser(m["createuser"]),
745745 disposal_d: decode_disposal_d(m["disposal_d"]),
746746 documents: decode_documents(m["documents"]),
747- drawing_nu: Map.fetch!(m, "drawing_nu"),
748- file_numbe: Map.fetch!(m, "file_numbe"),
749- folder_num: Map.fetch!(m, "folder_num"),
747+ drawing_nu: decode_drawing_nu(Map.fetch!(m, "drawing_nu")),
748+ file_numbe: decode_file_numbe(Map.fetch!(m, "file_numbe")),
749+ folder_num: decode_folder_num(Map.fetch!(m, "folder_num")),
750750 funding_ba: m["funding_ba"] && FundingBa.decode(m["funding_ba"]),
751751 historic_c: decode_historic_c(m["historic_c"]),
752752 inspection: decode_inspection(m["inspection"]),
@@ -757,11 +757,11 @@ defmodule FeatureProperties do
757757 mi_prinx: decode_mi_prinx(m["mi_prinx"]),
758758 mi_symbolo: MiSymbolo.decode(m["mi_symbolo"]),
759759 number_lan: decode_number_lan(m["number_lan"]),
760- owner: Map.fetch!(m, "owner"),
760+ owner: decode_owner(Map.fetch!(m, "owner")),
761761 positional: m["positional"] && LevelAccu.decode(m["positional"]),
762- project_nu: Map.fetch!(m, "project_nu"),
762+ project_nu: decode_project_nu(Map.fetch!(m, "project_nu")),
763763 rec_id: decode_rec_id(m["rec_id"]),
764- record_cre: Map.fetch!(m, "record_cre"),
764+ record_cre: decode_record_cre(Map.fetch!(m, "record_cre")),
765765 shape_area: decode_shape_area(m["shape_area"]),
766766 shape_leng: decode_shape_leng(m["shape_leng"]),
767767 status: Status.decode(m["status"]),
Test case

test/inputs/json/misc/be234.json

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -1120,7 +1120,7 @@ defmodule ChildData do
11201120 archived: decode_archived(m["archived"]),
11211121 author: decode_author(m["author"]),
11221122 author_flair_css_class: decode_author_flair_css_class(m["author_flair_css_class"]),
1123- author_flair_text: Map.fetch!(m, "author_flair_text"),
1123+ author_flair_text: decode_author_flair_text(Map.fetch!(m, "author_flair_text")),
11241124 banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]),
11251125 banned_by: decode_banned_by(m["banned_by"]),
11261126 brand_safe: decode_brand_safe(m["brand_safe"]),
@@ -1130,7 +1130,7 @@ defmodule ChildData do
11301130 contest_mode: decode_contest_mode(m["contest_mode"]),
11311131 created: decode_created(m["created"]),
11321132 created_utc: decode_created_utc(m["created_utc"]),
1133- distinguished: Map.fetch!(m, "distinguished"),
1133+ distinguished: decode_distinguished(Map.fetch!(m, "distinguished")),
11341134 domain: Domain.decode(m["domain"]),
11351135 downs: decode_downs(m["downs"]),
11361136 edited: decode_edited(m["edited"]),
Test case

test/inputs/json/misc/d23d5.json

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -79,7 +79,7 @@ defmodule Result do
7979
8080 def from_map(m) do
8181 %Result{
82- acronym: Map.fetch!(m, "acronym"),
82+ acronym: decode_acronym(Map.fetch!(m, "acronym")),
8383 created_at: decode_created_at(m["created_at"]),
8484 id: decode_id(m["id"]),
8585 name: decode_name(m["name"]),
Test case

test/inputs/json/misc/f22f5.json

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -625,8 +625,8 @@ defmodule ChildData do
625625 is_self: decode_is_self(m["is_self"]),
626626 is_video: decode_is_video(m["is_video"]),
627627 likes: decode_likes(m["likes"]),
628- link_flair_css_class: Map.fetch!(m, "link_flair_css_class"),
629- link_flair_text: Map.fetch!(m, "link_flair_text"),
628+ link_flair_css_class: decode_link_flair_css_class(Map.fetch!(m, "link_flair_css_class")),
629+ link_flair_text: decode_link_flair_text(Map.fetch!(m, "link_flair_text")),
630630 locked: decode_locked(m["locked"]),
631631 media: decode_media(m["media"]),
632632 media_embed: MediaEmbed.from_map(m["media_embed"]),
Test case

test/inputs/json/priority/bug2590.json

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -23,8 +23,8 @@ defmodule Invoice do
2323
2424 def from_map(m) do
2525 %Invoice{
26- created_at: Map.fetch!(m, "createdAt"),
27- due_date: Map.fetch!(m, "dueDate"),
26+ created_at: decode_created_at(Map.fetch!(m, "createdAt")),
27+ due_date: decode_due_date(Map.fetch!(m, "dueDate")),
2828 name: decode_name(m["name"]),
2929 }
3030 end
Test case

test/inputs/json/priority/nbl-stats.json

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -1347,7 +1347,7 @@ defmodule Pl do
13471347 s_free_throws_attempted: decode_s_free_throws_attempted(m["sFreeThrowsAttempted"]),
13481348 s_free_throws_made: decode_s_free_throws_made(m["sFreeThrowsMade"]),
13491349 s_free_throws_percentage: decode_s_free_throws_percentage(m["sFreeThrowsPercentage"]),
1350- s_minutes: Map.fetch!(m, "sMinutes"),
1350+ s_minutes: decode_s_minutes(Map.fetch!(m, "sMinutes")),
13511351 s_plus_minus_points: decode_s_plus_minus_points(m["sPlusMinusPoints"]),
13521352 s_points: decode_s_points(m["sPoints"]),
13531353 s_points_fast_break: decode_s_points_fast_break(m["sPointsFastBreak"]),
Test case

test/inputs/json/priority/optional-union.json

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -14,7 +14,7 @@ defmodule TopLevelElement do
1414
1515 def from_map(m) do
1616 %TopLevelElement{
17- a: m["a"],
17+ a: m["a"] && decode_a(m["a"]),
1818 }
1919 end
Test case

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

1 generated file · +2 −2
Melixirdefault / QuickType.ex+2 −2
@@ -701,7 +701,7 @@ defmodule Milestone do
701701 created_at: decode_created_at(m["created_at"]),
702702 creator: User.from_map(m["creator"]),
703703 description: decode_description(m["description"]),
704- due_on: Map.fetch!(m, "due_on"),
704+ due_on: decode_due_on(Map.fetch!(m, "due_on")),
705705 html_url: decode_html_url(m["html_url"]),
706706 id: decode_id(m["id"]),
707707 labels_url: decode_labels_url(m["labels_url"]),
@@ -955,7 +955,7 @@ defmodule Issue do
955955 assignee: decode_assignee(m["assignee"]),
956956 assignees: decode_assignees(m["assignees"]),
957957 body: decode_body(m["body"]),
958- closed_at: Map.fetch!(m, "closed_at"),
958+ closed_at: decode_closed_at(Map.fetch!(m, "closed_at")),
959959 comments: decode_comments(m["comments"]),
960960 comments_url: decode_comments_url(m["comments_url"]),
961961 created_at: decode_created_at(m["created_at"]),
Test case

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

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -62,7 +62,7 @@ defmodule PersonElement do
6262
6363 def from_map(m) do
6464 %PersonElement{
65- int_or_string: Map.fetch!(m, "intOrString"),
65+ int_or_string: decode_int_or_string(Map.fetch!(m, "intOrString")),
6666 name: decode_name(m["name"]),
6767 optional_value: m["optionalValue"],
6868 }
Test case

test/inputs/json/samples/null-safe.json

1 generated file · +1 −1
Melixirdefault / QuickType.ex+1 −1
@@ -84,7 +84,7 @@ defmodule Item do
8484 address: m["address"] && Address.from_map(m["address"]),
8585 created_at: m["created_at"],
8686 name: decode_name(m["name"]),
87- sex: Map.fetch!(m, "sex"),
87+ sex: decode_sex(Map.fetch!(m, "sex")),
8888 }
8989 end
Test case

test/inputs/json/samples/reddit.json

1 generated file · +5 −5
Melixirdefault / QuickType.ex+5 −5
@@ -968,8 +968,8 @@ defmodule ChildData do
968968 approved_by: decode_approved_by(m["approved_by"]),
969969 archived: decode_archived(m["archived"]),
970970 author: decode_author(m["author"]),
971- author_flair_css_class: Map.fetch!(m, "author_flair_css_class"),
972- author_flair_text: Map.fetch!(m, "author_flair_text"),
971+ author_flair_css_class: decode_author_flair_css_class(Map.fetch!(m, "author_flair_css_class")),
972+ author_flair_text: decode_author_flair_text(Map.fetch!(m, "author_flair_text")),
973973 banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]),
974974 banned_by: decode_banned_by(m["banned_by"]),
975975 brand_safe: decode_brand_safe(m["brand_safe"]),
@@ -979,7 +979,7 @@ defmodule ChildData do
979979 contest_mode: decode_contest_mode(m["contest_mode"]),
980980 created: decode_created(m["created"]),
981981 created_utc: decode_created_utc(m["created_utc"]),
982- distinguished: Map.fetch!(m, "distinguished"),
982+ distinguished: decode_distinguished(Map.fetch!(m, "distinguished")),
983983 domain: Domain.decode(m["domain"]),
984984 downs: decode_downs(m["downs"]),
985985 edited: decode_edited(m["edited"]),
@@ -990,8 +990,8 @@ defmodule ChildData do
990990 is_self: decode_is_self(m["is_self"]),
991991 is_video: decode_is_video(m["is_video"]),
992992 likes: decode_likes(m["likes"]),
993- link_flair_css_class: Map.fetch!(m, "link_flair_css_class"),
994- link_flair_text: Map.fetch!(m, "link_flair_text"),
993+ link_flair_css_class: decode_link_flair_css_class(Map.fetch!(m, "link_flair_css_class")),
994+ link_flair_text: decode_link_flair_text(Map.fetch!(m, "link_flair_text")),
995995 locked: decode_locked(m["locked"]),
996996 media: decode_media(m["media"]),
997997 media_embed: MediaEmbed.from_map(m["media_embed"]),
Test case

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

1 generated file · +3 −3
Melixirdefault / QuickType.ex+3 −3
@@ -424,8 +424,8 @@ defmodule Person do
424424 osid: decode_osid(m["osid"]),
425425 pvsid: decode_pvsid(m["pvsid"]),
426426 sortname: decode_sortname(m["sortname"]),
427- twitterid: Map.fetch!(m, "twitterid"),
428- youtubeid: Map.fetch!(m, "youtubeid"),
427+ twitterid: decode_twitterid(Map.fetch!(m, "twitterid")),
428+ youtubeid: decode_youtubeid(Map.fetch!(m, "youtubeid")),
429429 }
430430 end
431431
@@ -877,7 +877,7 @@ defmodule Object do
877877 district: decode_district(m["district"]),
878878 enddate: decode_enddate(m["enddate"]),
879879 extra: Extra.from_map(m["extra"]),
880- leadership_title: Map.fetch!(m, "leadership_title"),
880+ leadership_title: decode_leadership_title(Map.fetch!(m, "leadership_title")),
881881 party: Party.decode(m["party"]),
882882 person: Person.from_map(m["person"]),
883883 phone: decode_phone(m["phone"]),
Test case

test/inputs/schema/accessors.schema

1 generated file · +1 −1
Mschema-elixirdefault / QuickType.ex+1 −1
@@ -80,7 +80,7 @@ defmodule TopLevel do
8080 barre: decode_barre(m["bar"]),
8181 enumerification: EnumEnum.decode(m["enum"]),
8282 foo: decode_foo(m["foo"]),
83- unionization: Map.fetch!(m, "union"),
83+ unionization: decode_unionization(Map.fetch!(m, "union")),
8484 }
8585 end
Test case

test/inputs/schema/bool-string.schema

1 generated file · +3 −3
Mschema-elixirdefault / QuickType.ex+3 −3
@@ -37,11 +37,11 @@ defmodule TopLevel do
3737 %TopLevel{
3838 arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1),
3939 arr_one: m["arrOne"],
40- nullable: Map.fetch!(m, "nullable"),
40+ nullable: decode_nullable(Map.fetch!(m, "nullable")),
4141 one: decode_one(m["one"]),
4242 optional: m["optional"],
43- union_with_bool: Map.fetch!(m, "unionWithBool"),
44- union_with_bool_and_enum: Map.fetch!(m, "unionWithBoolAndEnum"),
43+ union_with_bool: decode_union_with_bool(Map.fetch!(m, "unionWithBool")),
44+ union_with_bool_and_enum: decode_union_with_bool_and_enum(Map.fetch!(m, "unionWithBoolAndEnum")),
4545 }
4646 end
Test case

test/inputs/schema/class-map-union.schema

1 generated file · +0 −86
Dschema-elixirdefault / QuickType.ex+0 −86
@@ -1,86 +0,0 @@
1-# This file was autogenerated using quicktype https://github.com/quicktype/quicktype
2-#
3-# Add Jason to your mix.exs
4-#
5-# Decode a JSON string: TopLevel.from_json(data)
6-# Encode into a JSON string: TopLevel.to_json(struct)
7-
8-defmodule UnionClass do
9- defstruct [:quux]
10-
11- @type t :: %__MODULE__{
12- quux: integer() | nil
13- }
14-
15- def from_map(m) do
16- %UnionClass{
17- quux: m["quux"],
18- }
19- end
20-
21- def from_json(json) do
22- json
23- |> Jason.decode!()
24- |> from_map()
25- end
26-
27- def to_map(struct) do
28- %{
29- "quux" => struct.quux,
30- }
31- end
32-
33- def to_json(struct) do
34- struct
35- |> to_map()
36- |> Jason.encode!()
37- end
38-end
39-
40-defmodule TopLevel do
41- defstruct [:union]
42-
43- @type t :: %__MODULE__{
44- union: %{String.t() => boolean() | UnionClass.t() | float() | String.t()} | nil
45- }
46-
47- def decode_union_value(%{} = value), do: UnionClass.from_map(value)
48- def decode_union_value(value) when is_boolean(value), do: value
49- def decode_union_value(value) when is_float(value), do: value
50- def decode_union_value(value) when is_integer(value), do: value
51- def decode_union_value(value) when is_binary(value), do: value
52- def decode_union_value(_), do: {:error, "Unexpected type when decoding TopLevel.union"}
53-
54- def encode_union_value(%UnionClass{} = value), do: UnionClass.to_map(value)
55- def encode_union_value(value) when is_boolean(value), do: value
56- def encode_union_value(value) when is_float(value), do: value
57- def encode_union_value(value) when is_integer(value), do: value
58- def encode_union_value(value) when is_binary(value), do: value
59- def encode_union_value(_), do: {:error, "Unexpected type when encoding TopLevel.union"}
60-
61- def from_map(m) do
62- %TopLevel{
63- union: m["union"]
64- |> Map.new(fn {key, value} -> {key, decode_union_value(value)} end),
65- }
66- end
67-
68- def from_json(json) do
69- json
70- |> Jason.decode!()
71- |> from_map()
72- end
73-
74- def to_map(struct) do
75- %{
76- "union" => struct.union
77- |> Map.new(fn {key, value} -> {key, encode_union_value(value)} end),
78- }
79- end
80-
81- def to_json(struct) do
82- struct
83- |> to_map()
84- |> Jason.encode!()
85- end
86-end
Test case

test/inputs/schema/description.schema

1 generated file · +1 −1
Mschema-elixirdefault / QuickType.ex+1 −1
@@ -133,7 +133,7 @@ defmodule TopLevel do
133133 enum: EnumEnum.decode(m["enum"]),
134134 foo: m["foo"],
135135 object_or_string: decode_object_or_string(m["object-or-string"]),
136- union: Map.fetch!(m, "union"),
136+ union: decode_union(Map.fetch!(m, "union")),
137137 }
138138 end
Test case

test/inputs/schema/implicit-class-array-union.schema

1 generated file · +0 −96
Dschema-elixirdefault / QuickType.ex+0 −96
@@ -1,96 +0,0 @@
1-# This file was autogenerated using quicktype https://github.com/quicktype/quicktype
2-#
3-# Add Jason to your mix.exs
4-#
5-# Decode a JSON string: TopLevel.from_json(data)
6-# Encode into a JSON string: TopLevel.to_json(struct)
7-
8-defmodule FooClass do
9- @enforce_keys [:bar]
10- defstruct [:bar]
11-
12- @type t :: %__MODULE__{
13- bar: integer()
14- }
15-
16- def decode_bar(value) when is_integer(value), do: value
17- def decode_bar(_), do: {:error, "Unexpected type when decoding FooClass.bar"}
18-
19- def encode_bar(value) when is_integer(value), do: value
20- def encode_bar(_), do: {:error, "Unexpected type when encoding FooClass.bar"}
21-
22- def from_map(m) do
23- %FooClass{
24- bar: decode_bar(m["bar"]),
25- }
26- end
27-
28- def from_json(json) do
29- json
30- |> Jason.decode!()
31- |> from_map()
32- end
33-
34- def to_map(struct) do
35- %{
36- "bar" => struct.bar,
37- }
38- end
39-
40- def to_json(struct) do
41- struct
42- |> to_map()
43- |> Jason.encode!()
44- end
45-end
46-
47-defmodule TopLevel do
48- @enforce_keys [:foo]
49- defstruct [:foo]
50-
51- @type t :: %__MODULE__{
52- foo: [integer()] | boolean() | FooClass.t() | float() | integer() | nil | String.t()
53- }
54-
55- def decode_foo(%{"bar" => _,} = value), do: FooClass.from_map(value)
56- def decode_foo(value) when is_boolean(value), do: value
57- def decode_foo(value) when is_float(value), do: value
58- def decode_foo(value) when is_integer(value), do: value
59- def decode_foo(value) when is_nil(value), do: value
60- def decode_foo(value) when is_binary(value), do: value
61- def decode_foo(value) when is_list(value), do: value
62- def decode_foo(_), do: {:error, "Unexpected type when decoding TopLevel.foo"}
63-
64- def encode_foo(%FooClass{} = value), do: FooClass.to_map(value)
65- def encode_foo(value) when is_boolean(value), do: value
66- def encode_foo(value) when is_float(value), do: value
67- def encode_foo(value) when is_integer(value), do: value
68- def encode_foo(value) when is_nil(value), do: value
69- def encode_foo(value) when is_binary(value), do: value
70- def encode_foo(value) when is_list(value), do: value
71- def encode_foo(_), do: {:error, "Unexpected type when encoding TopLevel.foo"}
72-
73- def from_map(m) do
74- %TopLevel{
75- foo: decode_foo(m["foo"]),
76- }
77- end
78-
79- def from_json(json) do
80- json
81- |> Jason.decode!()
82- |> from_map()
83- end
84-
85- def to_map(struct) do
86- %{
87- "foo" => encode_foo(struct.foo),
88- }
89- end
90-
91- def to_json(struct) do
92- struct
93- |> to_map()
94- |> Jason.encode!()
95- end
96-end
Test case

test/inputs/schema/integer-string.schema

1 generated file · +3 −3
Mschema-elixirdefault / QuickType.ex+3 −3
@@ -37,11 +37,11 @@ defmodule TopLevel do
3737 %TopLevel{
3838 arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1),
3939 arr_one: m["arrOne"],
40- nullable: Map.fetch!(m, "nullable"),
40+ nullable: decode_nullable(Map.fetch!(m, "nullable")),
4141 one: decode_one(m["one"]),
4242 optional: m["optional"],
43- union_with_int: Map.fetch!(m, "unionWithInt"),
44- union_with_int_and_enum: Map.fetch!(m, "unionWithIntAndEnum"),
43+ union_with_int: decode_union_with_int(Map.fetch!(m, "unionWithInt")),
44+ union_with_int_and_enum: decode_union_with_int_and_enum(Map.fetch!(m, "unionWithIntAndEnum")),
4545 }
4646 end
Test case

test/inputs/schema/minmaxlength.schema

1 generated file · +1 −1
Mschema-elixirdefault / QuickType.ex+1 −1
@@ -65,7 +65,7 @@ defmodule TopLevel do
6565 def from_map(m) do
6666 %TopLevel{
6767 intersection: decode_intersection(m["intersection"]),
68- in_union: Map.fetch!(m, "inUnion"),
68+ in_union: decode_in_union(Map.fetch!(m, "inUnion")),
6969 maxlength: decode_maxlength(m["maxlength"]),
7070 minlength: decode_minlength(m["minlength"]),
7171 min_max_intersection: decode_min_max_intersection(m["minMaxIntersection"]),
Test case

test/inputs/schema/nullable-optional-one-of.schema

1 generated file · +1 −1
Mschema-elixirdefault / QuickType.ex+1 −1
@@ -62,7 +62,7 @@ defmodule TopLevel do
6262
6363 def from_map(m) do
6464 %TopLevel{
65- b: m["b"],
65+ b: m["b"] && decode_b(m["b"]),
6666 kind: Kind.decode(m["kind"]),
6767 }
6868 end
Test case

test/inputs/schema/strict-optional.schema

1 generated file · +1 −1
Mschema-elixirdefault / QuickType.ex+1 −1
@@ -15,7 +15,7 @@ defmodule TopLevel do
1515
1616 def from_map(m) do
1717 %TopLevel{
18- foo: Map.fetch!(m, "foo"),
18+ foo: decode_foo(Map.fetch!(m, "foo")),
1919 }
2020 end
Test case

test/inputs/schema/union-int-double.schema

1 generated file · +1 −1
Mschema-elixirdefault / QuickType.ex+1 −1
@@ -15,7 +15,7 @@ defmodule TopLevel do
1515
1616 def from_map(m) do
1717 %TopLevel{
18- value: Map.fetch!(m, "value"),
18+ value: decode_value(Map.fetch!(m, "value")),
1919 }
2020 end
Test case

test/inputs/schema/uuid.schema

1 generated file · +1 −1
Mschema-elixirdefault / QuickType.ex+1 −1
@@ -42,7 +42,7 @@ defmodule TopLevel do
4242 %TopLevel{
4343 arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1),
4444 arr_one: m["arrOne"],
45- nullable: Map.fetch!(m, "nullable"),
45+ nullable: decode_nullable(Map.fetch!(m, "nullable")),
4646 one: decode_one(m["one"]),
4747 optional: m["optional"],
4848 union_with_enum: decode_union_with_enum(m["unionWithEnum"]),
Test case

test/inputs/schema/vega-lite.schema

1 generated file · +31 −31
Mschema-elixirdefault / QuickType.ex+31 −31
@@ -914,9 +914,9 @@ defmodule AxisConfig do
914914 grid_opacity: m["gridOpacity"],
915915 grid_width: m["gridWidth"],
916916 label_angle: m["labelAngle"],
917- label_bound: m["labelBound"],
917+ label_bound: m["labelBound"] && decode_label_bound(m["labelBound"]),
918918 label_color: m["labelColor"],
919- label_flush: m["labelFlush"],
919+ label_flush: m["labelFlush"] && decode_label_flush(m["labelFlush"]),
920920 label_font: m["labelFont"],
921921 label_font_size: m["labelFontSize"],
922922 label_limit: m["labelLimit"],
@@ -937,7 +937,7 @@ defmodule AxisConfig do
937937 title_color: m["titleColor"],
938938 title_font: m["titleFont"],
939939 title_font_size: m["titleFontSize"],
940- title_font_weight: m["titleFontWeight"],
940+ title_font_weight: m["titleFontWeight"] && decode_title_font_weight(m["titleFontWeight"]),
941941 title_limit: m["titleLimit"],
942942 title_max_length: m["titleMaxLength"],
943943 title_padding: m["titlePadding"],
@@ -1123,9 +1123,9 @@ defmodule VGAxisConfig do
11231123 grid_opacity: m["gridOpacity"],
11241124 grid_width: m["gridWidth"],
11251125 label_angle: m["labelAngle"],
1126- label_bound: m["labelBound"],
1126+ label_bound: m["labelBound"] && decode_label_bound(m["labelBound"]),
11271127 label_color: m["labelColor"],
1128- label_flush: m["labelFlush"],
1128+ label_flush: m["labelFlush"] && decode_label_flush(m["labelFlush"]),
11291129 label_font: m["labelFont"],
11301130 label_font_size: m["labelFontSize"],
11311131 label_limit: m["labelLimit"],
@@ -1145,7 +1145,7 @@ defmodule VGAxisConfig do
11451145 title_color: m["titleColor"],
11461146 title_font: m["titleFont"],
11471147 title_font_size: m["titleFontSize"],
1148- title_font_weight: m["titleFontWeight"],
1148+ title_font_weight: m["titleFontWeight"] && decode_title_font_weight(m["titleFontWeight"]),
11491149 title_limit: m["titleLimit"],
11501150 title_max_length: m["titleMaxLength"],
11511151 title_padding: m["titlePadding"],
@@ -1672,7 +1672,7 @@ defmodule LegendConfig do
16721672 title_color: m["titleColor"],
16731673 title_font: m["titleFont"],
16741674 title_font_size: m["titleFontSize"],
1675- title_font_weight: m["titleFontWeight"],
1675+ title_font_weight: m["titleFontWeight"] && decode_title_font_weight(m["titleFontWeight"]),
16761676 title_limit: m["titleLimit"],
16771677 title_padding: m["titlePadding"],
16781678 }
@@ -2047,7 +2047,7 @@ defmodule ScaleConfig do
20472047 min_size: m["minSize"],
20482048 min_stroke_width: m["minStrokeWidth"],
20492049 point_padding: m["pointPadding"],
2050- range_step: m["rangeStep"],
2050+ range_step: m["rangeStep"] && decode_range_step(m["rangeStep"]),
20512051 round: m["round"],
20522052 text_x_range_step: m["textXRangeStep"],
20532053 use_unaggregated_domain: m["useUnaggregatedDomain"],
@@ -2405,8 +2405,8 @@ defmodule IntervalSelectionConfig do
24052405 mark: m["mark"] && BrushConfig.from_map(m["mark"]),
24062406 on: m["on"],
24072407 resolve: m["resolve"] && SelectionResolution.decode(m["resolve"]),
2408- translate: m["translate"],
2409- zoom: m["zoom"],
2408+ translate: m["translate"] && decode_translate(m["translate"]),
2409+ zoom: m["zoom"] && decode_zoom(m["zoom"]),
24102410 }
24112411 end
24122412
@@ -2474,7 +2474,7 @@ defmodule MultiSelectionConfig do
24742474 nearest: m["nearest"],
24752475 on: m["on"],
24762476 resolve: m["resolve"] && SelectionResolution.decode(m["resolve"]),
2477- toggle: m["toggle"],
2477+ toggle: m["toggle"] && decode_toggle(m["toggle"]),
24782478 }
24792479 end
24802480
@@ -4191,11 +4191,11 @@ defmodule DateTimeClass do
41914191 def from_map(m) do
41924192 %DateTimeClass{
41934193 date: m["date"],
4194- day: m["day"],
4194+ day: m["day"] && decode_day(m["day"]),
41954195 hours: m["hours"],
41964196 milliseconds: m["milliseconds"],
41974197 minutes: m["minutes"],
4198- month: m["month"],
4198+ month: m["month"] && decode_month(m["month"]),
41994199 quarter: m["quarter"],
42004200 seconds: m["seconds"],
42014201 utc: m["utc"],
@@ -4512,7 +4512,7 @@ defmodule ConditionalValueDef do
45124512 def from_map(m) do
45134513 %ConditionalValueDef{
45144514 test: decode_test(m["test"]),
4515- value: Map.fetch!(m, "value"),
4515+ value: decode_value(Map.fetch!(m, "value")),
45164516 selection: decode_selection(m["selection"]),
45174517 }
45184518 end
@@ -4724,7 +4724,7 @@ defmodule Legend do
47244724 orient: m["orient"] && LegendOrient.decode(m["orient"]),
47254725 padding: m["padding"],
47264726 tick_count: m["tickCount"],
4727- title: m["title"],
4727+ title: m["title"] && decode_title(m["title"]),
47284728 type: m["type"] && LegendType.decode(m["type"]),
47294729 values: m["values"] && Enum.map(m["values"], &decode_values_element/1),
47304730 zindex: m["zindex"],
@@ -5274,7 +5274,7 @@ defmodule Scale do
52745274 padding_inner: m["paddingInner"],
52755275 padding_outer: m["paddingOuter"],
52765276 range: decode_range(m["range"]),
5277- range_step: m["rangeStep"],
5277+ range_step: m["rangeStep"] && decode_range_step(m["rangeStep"]),
52785278 round: m["round"],
52795279 scheme: decode_scheme(m["scheme"]),
52805280 type: m["type"] && ScaleType.decode(m["type"]),
@@ -5559,7 +5559,7 @@ defmodule ConditionalPredicateMarkPropFieldDefClass do
55595559 def from_map(m) do
55605560 %ConditionalPredicateMarkPropFieldDefClass{
55615561 test: decode_test(m["test"]),
5562- value: m["value"],
5562+ value: m["value"] && decode_value(m["value"]),
55635563 selection: decode_selection(m["selection"]),
55645564 aggregate: m["aggregate"] && AggregateOp.decode(m["aggregate"]),
55655565 bin: decode_bin(m["bin"]),
@@ -5722,7 +5722,7 @@ defmodule MarkPropDefWithCondition do
57225722 sort: decode_sort(m["sort"]),
57235723 time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]),
57245724 type: m["type"] && Type.decode(m["type"]),
5725- value: m["value"],
5725+ value: m["value"] && decode_value(m["value"]),
57265726 }
57275727 end
57285728
@@ -5776,7 +5776,7 @@ defmodule Header do
57765776 %Header{
57775777 format: m["format"],
57785778 label_angle: m["labelAngle"],
5779- title: m["title"],
5779+ title: m["title"] && decode_title(m["title"]),
57805780 }
57815781 end
57825782
@@ -6026,7 +6026,7 @@ defmodule ConditionalPredicateFieldDefClass do
60266026 def from_map(m) do
60276027 %ConditionalPredicateFieldDefClass{
60286028 test: decode_test(m["test"]),
6029- value: m["value"],
6029+ value: m["value"] && decode_value(m["value"]),
60306030 selection: decode_selection(m["selection"]),
60316031 aggregate: m["aggregate"] && AggregateOp.decode(m["aggregate"]),
60326032 bin: decode_bin(m["bin"]),
@@ -6137,7 +6137,7 @@ defmodule DefWithCondition do
61376137 field: decode_field(m["field"]),
61386138 time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]),
61396139 type: m["type"] && Type.decode(m["type"]),
6140- value: m["value"],
6140+ value: m["value"] && decode_value(m["value"]),
61416141 }
61426142 end
61436143
@@ -6312,7 +6312,7 @@ defmodule ConditionalPredicateTextFieldDefClass do
63126312 def from_map(m) do
63136313 %ConditionalPredicateTextFieldDefClass{
63146314 test: decode_test(m["test"]),
6315- value: m["value"],
6315+ value: m["value"] && decode_value(m["value"]),
63166316 selection: decode_selection(m["selection"]),
63176317 aggregate: m["aggregate"] && AggregateOp.decode(m["aggregate"]),
63186318 bin: decode_bin(m["bin"]),
@@ -6430,7 +6430,7 @@ defmodule TextDefWithCondition do
64306430 format: m["format"],
64316431 time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]),
64326432 type: m["type"] && Type.decode(m["type"]),
6433- value: m["value"],
6433+ value: m["value"] && decode_value(m["value"]),
64346434 }
64356435 end
64366436
@@ -6539,8 +6539,8 @@ defmodule Axis do
65396539 format: m["format"],
65406540 grid: m["grid"],
65416541 label_angle: m["labelAngle"],
6542- label_bound: m["labelBound"],
6543- label_flush: m["labelFlush"],
6542+ label_bound: m["labelBound"] && decode_label_bound(m["labelBound"]),
6543+ label_flush: m["labelFlush"] && decode_label_flush(m["labelFlush"]),
65446544 label_overlap: decode_label_overlap(m["labelOverlap"]),
65456545 label_padding: m["labelPadding"],
65466546 labels: m["labels"],
@@ -6552,7 +6552,7 @@ defmodule Axis do
65526552 tick_count: m["tickCount"],
65536553 ticks: m["ticks"],
65546554 tick_size: m["tickSize"],
6555- title: m["title"],
6555+ title: m["title"] && decode_title(m["title"]),
65566556 title_max_length: m["titleMaxLength"],
65576557 title_padding: m["titlePadding"],
65586558 values: m["values"] && Enum.map(m["values"], &decode_values_element/1),
@@ -6675,7 +6675,7 @@ defmodule XClass do
66756675 stack: m["stack"] && StackOffset.decode(m["stack"]),
66766676 time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]),
66776677 type: m["type"] && Type.decode(m["type"]),
6678- value: m["value"],
6678+ value: m["value"] && decode_value(m["value"]),
66796679 }
66806680 end
66816681
@@ -6762,7 +6762,7 @@ defmodule X2Class do
67626762 field: decode_field(m["field"]),
67636763 time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]),
67646764 type: m["type"] && Type.decode(m["type"]),
6765- value: m["value"],
6765+ value: m["value"] && decode_value(m["value"]),
67666766 }
67676767 end
67686768
@@ -7720,10 +7720,10 @@ defmodule SelectionDef do
77207720 on: m["on"],
77217721 resolve: m["resolve"] && SelectionResolution.decode(m["resolve"]),
77227722 type: SelectionDefType.decode(m["type"]),
7723- toggle: m["toggle"],
7723+ toggle: m["toggle"] && decode_toggle(m["toggle"]),
77247724 mark: m["mark"] && BrushConfig.from_map(m["mark"]),
7725- translate: m["translate"],
7726- zoom: m["zoom"],
7725+ translate: m["translate"] && decode_translate(m["translate"]),
7726+ zoom: m["zoom"] && decode_zoom(m["zoom"]),
77277727 }
77287728 end
No generated files match these filters.