Test case
1 generated file · +1 −1test/inputs/graphql/github1.graphql
Mgraphql-elixirdefault / QuickType.ex+1 −1
| @@ -23,7 +23,7 @@ defmodule User do | ||
| 23 | 23 | def from_map(m) do |
| 24 | 24 | %User{ |
| 25 | 25 | login: decode_login(m["login"]), |
| 26 | - real_name: Map.fetch!(m, "realName"), | |
| 26 | + real_name: decode_real_name(Map.fetch!(m, "realName")), | |
| 27 | 27 | } |
| 28 | 28 | end |
Test case
1 generated file · +1 −1test/inputs/graphql/github4.graphql
Mgraphql-elixirdefault / QuickType.ex+1 −1
| @@ -178,7 +178,7 @@ defmodule User do | ||
| 178 | 178 | def from_map(m) do |
| 179 | 179 | %User{ |
| 180 | 180 | login: decode_login(m["login"]), |
| 181 | - name: Map.fetch!(m, "name"), | |
| 181 | + name: decode_name(Map.fetch!(m, "name")), | |
| 182 | 182 | repository: m["repository"] && Repository.from_map(m["repository"]), |
| 183 | 183 | } |
| 184 | 184 | end |
Test case
1 generated file · +1 −1test/inputs/graphql/github5.graphql
Mgraphql-elixirdefault / QuickType.ex+1 −1
| @@ -23,7 +23,7 @@ defmodule User do | ||
| 23 | 23 | def from_map(m) do |
| 24 | 24 | %User{ |
| 25 | 25 | login: decode_login(m["login"]), |
| 26 | - name: m["name"], | |
| 26 | + name: m["name"] && decode_name(m["name"]), | |
| 27 | 27 | } |
| 28 | 28 | end |
Test case
1 generated file · +1 −1test/inputs/graphql/github9.graphql
Mgraphql-elixirdefault / QuickType.ex+1 −1
| @@ -148,7 +148,7 @@ defmodule AddReactionPayload do | ||
| 148 | 148 | |
| 149 | 149 | def from_map(m) do |
| 150 | 150 | %AddReactionPayload{ |
| 151 | - client_mutation_id: Map.fetch!(m, "clientMutationId"), | |
| 151 | + client_mutation_id: decode_client_mutation_id(Map.fetch!(m, "clientMutationId")), | |
| 152 | 152 | reaction: Reaction.from_map(m["reaction"]), |
| 153 | 153 | subject: Reactable.from_map(m["subject"]), |
| 154 | 154 | } |
Test case
1 generated file · +2 −2test/inputs/json/misc/050b0.json
Melixirdefault / QuickType.ex+2 −2
| @@ -251,7 +251,7 @@ defmodule OtherName do | ||
| 251 | 251 | def from_map(m) do |
| 252 | 252 | %OtherName{ |
| 253 | 253 | name: decode_name(m["name"]), |
| 254 | - note: Map.fetch!(m, "note"), | |
| 254 | + note: decode_note(Map.fetch!(m, "note")), | |
| 255 | 255 | } |
| 256 | 256 | end |
| 257 | 257 | |
| @@ -477,7 +477,7 @@ defmodule TopLevelElement do | ||
| 477 | 477 | links: Enum.map(m["links"], &Link.from_map/1), |
| 478 | 478 | name: decode_name(m["name"]), |
| 479 | 479 | 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")), | |
| 481 | 481 | text: Enum.map(m["text"], &Text.from_map/1), |
| 482 | 482 | } |
| 483 | 483 | end |
Test case
1 generated file · +1 −1test/inputs/json/misc/0a91a.json
Melixirdefault / QuickType.ex+1 −1
| @@ -1578,7 +1578,7 @@ defmodule Payload do | ||
| 1578 | 1578 | action: m["action"], |
| 1579 | 1579 | before: m["before"], |
| 1580 | 1580 | commits: m["commits"] && Enum.map(m["commits"], &Commit.from_map/1), |
| 1581 | - description: m["description"], | |
| 1581 | + description: m["description"] && decode_description(m["description"]), | |
| 1582 | 1582 | distinct_size: m["distinct_size"], |
| 1583 | 1583 | head: m["head"], |
| 1584 | 1584 | master_branch: m["master_branch"], |
Test case
1 generated file · +2 −2test/inputs/json/misc/10be4.json
Melixirdefault / QuickType.ex+2 −2
| @@ -260,7 +260,7 @@ defmodule OtherName do | ||
| 260 | 260 | def from_map(m) do |
| 261 | 261 | %OtherName{ |
| 262 | 262 | name: decode_name(m["name"]), |
| 263 | - note: Map.fetch!(m, "note"), | |
| 263 | + note: decode_note(Map.fetch!(m, "note")), | |
| 264 | 264 | } |
| 265 | 265 | end |
| 266 | 266 | |
| @@ -488,7 +488,7 @@ defmodule TopLevelElement do | ||
| 488 | 488 | links: Enum.map(m["links"], &Link.from_map/1), |
| 489 | 489 | name: decode_name(m["name"]), |
| 490 | 490 | 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")), | |
| 492 | 492 | text: Enum.map(m["text"], &Text.from_map/1), |
| 493 | 493 | } |
| 494 | 494 | end |
Test case
1 generated file · +5 −5test/inputs/json/misc/1b409.json
Melixirdefault / QuickType.ex+5 −5
| @@ -90,7 +90,7 @@ defmodule Extra do | ||
| 90 | 90 | %Extra{ |
| 91 | 91 | address: decode_address(m["address"]), |
| 92 | 92 | contact_form: m["contact_form"], |
| 93 | - fax: m["fax"], | |
| 93 | + fax: m["fax"] && decode_fax(m["fax"]), | |
| 94 | 94 | office: decode_office(m["office"]), |
| 95 | 95 | rss_url: m["rss_url"], |
| 96 | 96 | } |
| @@ -419,10 +419,10 @@ defmodule Person do | ||
| 419 | 419 | namemod: Namemod.decode(m["namemod"]), |
| 420 | 420 | nickname: decode_nickname(m["nickname"]), |
| 421 | 421 | osid: decode_osid(m["osid"]), |
| 422 | - pvsid: Map.fetch!(m, "pvsid"), | |
| 422 | + pvsid: decode_pvsid(Map.fetch!(m, "pvsid")), | |
| 423 | 423 | 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")), | |
| 426 | 426 | } |
| 427 | 427 | end |
| 428 | 428 | |
| @@ -716,7 +716,7 @@ defmodule Object do | ||
| 716 | 716 | enddate: decode_enddate(m["enddate"]), |
| 717 | 717 | extra: Extra.from_map(m["extra"]), |
| 718 | 718 | id: decode_id(m["id"]), |
| 719 | - leadership_title: Map.fetch!(m, "leadership_title"), | |
| 719 | + leadership_title: decode_leadership_title(Map.fetch!(m, "leadership_title")), | |
| 720 | 720 | party: Party.decode(m["party"]), |
| 721 | 721 | person: Person.from_map(m["person"]), |
| 722 | 722 | phone: decode_phone(m["phone"]), |
Test case
1 generated file · +8 −8test/inputs/json/misc/27332.json
Melixirdefault / QuickType.ex+8 −8
| @@ -1033,8 +1033,8 @@ defmodule ChildData do | ||
| 1033 | 1033 | approved_by: decode_approved_by(m["approved_by"]), |
| 1034 | 1034 | archived: decode_archived(m["archived"]), |
| 1035 | 1035 | 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")), | |
| 1038 | 1038 | banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]), |
| 1039 | 1039 | banned_by: decode_banned_by(m["banned_by"]), |
| 1040 | 1040 | brand_safe: decode_brand_safe(m["brand_safe"]), |
| @@ -1044,7 +1044,7 @@ defmodule ChildData do | ||
| 1044 | 1044 | contest_mode: decode_contest_mode(m["contest_mode"]), |
| 1045 | 1045 | created: decode_created(m["created"]), |
| 1046 | 1046 | created_utc: decode_created_utc(m["created_utc"]), |
| 1047 | - distinguished: Map.fetch!(m, "distinguished"), | |
| 1047 | + distinguished: decode_distinguished(Map.fetch!(m, "distinguished")), | |
| 1048 | 1048 | domain: Domain.decode(m["domain"]), |
| 1049 | 1049 | downs: decode_downs(m["downs"]), |
| 1050 | 1050 | edited: decode_edited(m["edited"]), |
| @@ -1055,8 +1055,8 @@ defmodule ChildData do | ||
| 1055 | 1055 | is_self: decode_is_self(m["is_self"]), |
| 1056 | 1056 | is_video: decode_is_video(m["is_video"]), |
| 1057 | 1057 | 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")), | |
| 1060 | 1060 | locked: decode_locked(m["locked"]), |
| 1061 | 1061 | media: m["media"] && Media.from_map(m["media"]), |
| 1062 | 1062 | media_embed: MediaEmbed.from_map(m["media_embed"]), |
| @@ -1076,7 +1076,7 @@ defmodule ChildData do | ||
| 1076 | 1076 | secure_media: m["secure_media"] && Media.from_map(m["secure_media"]), |
| 1077 | 1077 | secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]), |
| 1078 | 1078 | selftext: decode_selftext(m["selftext"]), |
| 1079 | - selftext_html: Map.fetch!(m, "selftext_html"), | |
| 1079 | + selftext_html: decode_selftext_html(Map.fetch!(m, "selftext_html")), | |
| 1080 | 1080 | spoiler: decode_spoiler(m["spoiler"]), |
| 1081 | 1081 | stickied: decode_stickied(m["stickied"]), |
| 1082 | 1082 | subreddit: Subreddit.decode(m["subreddit"]), |
| @@ -1085,8 +1085,8 @@ defmodule ChildData do | ||
| 1085 | 1085 | subreddit_type: SubredditType.decode(m["subreddit_type"]), |
| 1086 | 1086 | suggested_sort: decode_suggested_sort(m["suggested_sort"]), |
| 1087 | 1087 | 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")), | |
| 1090 | 1090 | title: decode_title(m["title"]), |
| 1091 | 1091 | ups: decode_ups(m["ups"]), |
| 1092 | 1092 | url: decode_url(m["url"]), |
Test case
1 generated file · +5 −5test/inputs/json/misc/29f47.json
Melixirdefault / QuickType.ex+5 −5
| @@ -976,7 +976,7 @@ defmodule ChildData do | ||
| 976 | 976 | distinguished: Distinguished.decode(m["distinguished"]), |
| 977 | 977 | domain: Domain.decode(m["domain"]), |
| 978 | 978 | downs: decode_downs(m["downs"]), |
| 979 | - edited: Map.fetch!(m, "edited"), | |
| 979 | + edited: decode_edited(Map.fetch!(m, "edited")), | |
| 980 | 980 | gilded: decode_gilded(m["gilded"]), |
| 981 | 981 | hidden: decode_hidden(m["hidden"]), |
| 982 | 982 | hide_score: decode_hide_score(m["hide_score"]), |
| @@ -1005,17 +1005,17 @@ defmodule ChildData do | ||
| 1005 | 1005 | secure_media: decode_secure_media(m["secure_media"]), |
| 1006 | 1006 | secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]), |
| 1007 | 1007 | selftext: decode_selftext(m["selftext"]), |
| 1008 | - selftext_html: Map.fetch!(m, "selftext_html"), | |
| 1008 | + selftext_html: decode_selftext_html(Map.fetch!(m, "selftext_html")), | |
| 1009 | 1009 | spoiler: decode_spoiler(m["spoiler"]), |
| 1010 | 1010 | stickied: decode_stickied(m["stickied"]), |
| 1011 | 1011 | subreddit: Subreddit.decode(m["subreddit"]), |
| 1012 | 1012 | subreddit_id: SubredditID.decode(m["subreddit_id"]), |
| 1013 | 1013 | subreddit_name_prefixed: SubredditNamePrefixed.decode(m["subreddit_name_prefixed"]), |
| 1014 | 1014 | 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")), | |
| 1016 | 1016 | 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")), | |
| 1019 | 1019 | title: decode_title(m["title"]), |
| 1020 | 1020 | ups: decode_ups(m["ups"]), |
| 1021 | 1021 | url: decode_url(m["url"]), |
Test case
1 generated file · +3 −3test/inputs/json/misc/2d4e2.json
Melixirdefault / QuickType.ex+3 −3
| @@ -432,8 +432,8 @@ defmodule Person do | ||
| 432 | 432 | osid: decode_osid(m["osid"]), |
| 433 | 433 | pvsid: decode_pvsid(m["pvsid"]), |
| 434 | 434 | 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")), | |
| 437 | 437 | } |
| 438 | 438 | end |
| 439 | 439 | |
| @@ -894,7 +894,7 @@ defmodule Object do | ||
| 894 | 894 | enddate: decode_enddate(m["enddate"]), |
| 895 | 895 | extra: Extra.from_map(m["extra"]), |
| 896 | 896 | id: decode_id(m["id"]), |
| 897 | - leadership_title: Map.fetch!(m, "leadership_title"), | |
| 897 | + leadership_title: decode_leadership_title(Map.fetch!(m, "leadership_title")), | |
| 898 | 898 | party: Party.decode(m["party"]), |
| 899 | 899 | person: Person.from_map(m["person"]), |
| 900 | 900 | phone: decode_phone(m["phone"]), |
Test case
1 generated file · +3 −3test/inputs/json/misc/32431.json
Melixirdefault / QuickType.ex+3 −3
| @@ -393,15 +393,15 @@ defmodule Properties do | ||
| 393 | 393 | cdi: decode_cdi(m["cdi"]), |
| 394 | 394 | code: decode_code(m["code"]), |
| 395 | 395 | detail: decode_detail(m["detail"]), |
| 396 | - dmin: Map.fetch!(m, "dmin"), | |
| 396 | + dmin: decode_dmin(Map.fetch!(m, "dmin")), | |
| 397 | 397 | felt: decode_felt(m["felt"]), |
| 398 | - gap: Map.fetch!(m, "gap"), | |
| 398 | + gap: decode_gap(Map.fetch!(m, "gap")), | |
| 399 | 399 | ids: decode_ids(m["ids"]), |
| 400 | 400 | mag: decode_mag(m["mag"]), |
| 401 | 401 | mag_type: MagType.decode(m["magType"]), |
| 402 | 402 | mmi: decode_mmi(m["mmi"]), |
| 403 | 403 | net: decode_net(m["net"]), |
| 404 | - nst: Map.fetch!(m, "nst"), | |
| 404 | + nst: decode_nst(Map.fetch!(m, "nst")), | |
| 405 | 405 | place: decode_place(m["place"]), |
| 406 | 406 | rms: decode_rms(m["rms"]), |
| 407 | 407 | sig: decode_sig(m["sig"]), |
Test case
1 generated file · +1 −1test/inputs/json/misc/32d5c.json
Melixirdefault / QuickType.ex+1 −1
| @@ -64,7 +64,7 @@ defmodule TopLevelElement do | ||
| 64 | 64 | |
| 65 | 65 | def from_map(m) do |
| 66 | 66 | %TopLevelElement{ |
| 67 | - birth_date: Map.fetch!(m, "BirthDate"), | |
| 67 | + birth_date: decode_birth_date(Map.fetch!(m, "BirthDate")), | |
| 68 | 68 | birth_date_is_protected: decode_birth_date_is_protected(m["BirthDateIsProtected"]), |
| 69 | 69 | gender_type_id: decode_gender_type_id(m["GenderTypeID"]), |
| 70 | 70 | notes: decode_notes(m["Notes"]), |
Test case
1 generated file · +17 −17test/inputs/json/misc/337ed.json
Melixirdefault / QuickType.ex+17 −17
| @@ -382,35 +382,35 @@ defmodule Result do | ||
| 382 | 382 | |
| 383 | 383 | def from_map(m) do |
| 384 | 384 | %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")), | |
| 388 | 388 | created_at: decode_created_at(m["created_at"]), |
| 389 | 389 | custom_incomes: Enum.map(m["customIncomes"], &CustomIncome.from_map/1), |
| 390 | 390 | direct_rep_costs_max: decode_direct_rep_costs_max(m["direct_rep_costs_max"]), |
| 391 | 391 | direct_rep_costs_min: decode_direct_rep_costs_min(m["direct_rep_costs_min"]), |
| 392 | 392 | end_date: decode_end_date(m["end_date"]), |
| 393 | 393 | 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")), | |
| 395 | 395 | 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")), | |
| 397 | 397 | id: decode_id(m["id"]), |
| 398 | 398 | 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")), | |
| 407 | 407 | representative: decode_representative(m["representative"]), |
| 408 | 408 | start_date: decode_start_date(m["start_date"]), |
| 409 | 409 | 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")), | |
| 414 | 414 | type: ResultType.decode(m["type"]), |
| 415 | 415 | updated_at: decode_updated_at(m["updated_at"]), |
| 416 | 416 | uri: decode_uri(m["uri"]), |
Test case
1 generated file · +1 −1test/inputs/json/misc/34702.json
Melixirdefault / QuickType.ex+1 −1
| @@ -484,7 +484,7 @@ defmodule FeatureProperties do | ||
| 484 | 484 | latitude: decode_latitude(m["latitude"]), |
| 485 | 485 | local_govt: decode_local_govt(m["local_govt"]), |
| 486 | 486 | longitude: decode_longitude(m["longitude"]), |
| 487 | - no: Map.fetch!(m, "no"), | |
| 487 | + no: decode_no(Map.fetch!(m, "no")), | |
| 488 | 488 | phone: decode_phone(m["phone"]), |
| 489 | 489 | postcode: decode_postcode(m["postcode"]), |
| 490 | 490 | psa: decode_psa(m["psa"]), |
Test case
1 generated file · +2 −2test/inputs/json/misc/4d6fb.json
Melixirdefault / QuickType.ex+2 −2
| @@ -1094,8 +1094,8 @@ defmodule ChildData do | ||
| 1094 | 1094 | subreddit_type: SubredditType.decode(m["subreddit_type"]), |
| 1095 | 1095 | suggested_sort: decode_suggested_sort(m["suggested_sort"]), |
| 1096 | 1096 | 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")), | |
| 1099 | 1099 | title: decode_title(m["title"]), |
| 1100 | 1100 | ups: decode_ups(m["ups"]), |
| 1101 | 1101 | url: decode_url(m["url"]), |
Test case
1 generated file · +1 −1test/inputs/json/misc/570ec.json
Melixirdefault / QuickType.ex+1 −1
| @@ -160,7 +160,7 @@ defmodule OtherName do | ||
| 160 | 160 | def from_map(m) do |
| 161 | 161 | %OtherName{ |
| 162 | 162 | name: decode_name(m["name"]), |
| 163 | - note: Map.fetch!(m, "note"), | |
| 163 | + note: decode_note(Map.fetch!(m, "note")), | |
| 164 | 164 | } |
| 165 | 165 | end |
Test case
1 generated file · +1 −1test/inputs/json/misc/66121.json
Melixirdefault / QuickType.ex+1 −1
| @@ -428,7 +428,7 @@ defmodule TopLevelElement do | ||
| 428 | 428 | links: Enum.map(m["links"], &Link.from_map/1), |
| 429 | 429 | name: decode_name(m["name"]), |
| 430 | 430 | 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")), | |
| 432 | 432 | text: Enum.map(m["text"], &Text.from_map/1), |
| 433 | 433 | } |
| 434 | 434 | end |
Test case
1 generated file · +8 −8test/inputs/json/misc/6de06.json
Melixirdefault / QuickType.ex+8 −8
| @@ -935,8 +935,8 @@ defmodule ChildData do | ||
| 935 | 935 | approved_by: decode_approved_by(m["approved_by"]), |
| 936 | 936 | archived: decode_archived(m["archived"]), |
| 937 | 937 | 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")), | |
| 940 | 940 | banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]), |
| 941 | 941 | banned_by: decode_banned_by(m["banned_by"]), |
| 942 | 942 | brand_safe: decode_brand_safe(m["brand_safe"]), |
| @@ -957,8 +957,8 @@ defmodule ChildData do | ||
| 957 | 957 | is_self: decode_is_self(m["is_self"]), |
| 958 | 958 | is_video: decode_is_video(m["is_video"]), |
| 959 | 959 | 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")), | |
| 962 | 962 | locked: decode_locked(m["locked"]), |
| 963 | 963 | media: m["media"] && Media.from_map(m["media"]), |
| 964 | 964 | media_embed: MediaEmbed.from_map(m["media_embed"]), |
| @@ -978,17 +978,17 @@ defmodule ChildData do | ||
| 978 | 978 | secure_media: m["secure_media"] && Media.from_map(m["secure_media"]), |
| 979 | 979 | secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]), |
| 980 | 980 | selftext: decode_selftext(m["selftext"]), |
| 981 | - selftext_html: Map.fetch!(m, "selftext_html"), | |
| 981 | + selftext_html: decode_selftext_html(Map.fetch!(m, "selftext_html")), | |
| 982 | 982 | spoiler: decode_spoiler(m["spoiler"]), |
| 983 | 983 | stickied: decode_stickied(m["stickied"]), |
| 984 | 984 | subreddit: decode_subreddit(m["subreddit"]), |
| 985 | 985 | subreddit_id: decode_subreddit_id(m["subreddit_id"]), |
| 986 | 986 | subreddit_name_prefixed: decode_subreddit_name_prefixed(m["subreddit_name_prefixed"]), |
| 987 | 987 | 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")), | |
| 989 | 989 | 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")), | |
| 992 | 992 | title: decode_title(m["title"]), |
| 993 | 993 | ups: decode_ups(m["ups"]), |
| 994 | 994 | url: decode_url(m["url"]), |
Test case
1 generated file · +18 −18test/inputs/json/misc/734ad.json
Melixirdefault / QuickType.ex+18 −18
| @@ -359,21 +359,21 @@ defmodule Result do | ||
| 359 | 359 | |
| 360 | 360 | def from_map(m) do |
| 361 | 361 | %Result{ |
| 362 | - acronym: Map.fetch!(m, "acronym"), | |
| 362 | + acronym: decode_acronym(Map.fetch!(m, "acronym")), | |
| 363 | 363 | activity_consult_committees: decode_activity_consult_committees(m["activity_consult_committees"]), |
| 364 | 364 | activity_eu_legislative: decode_activity_eu_legislative(m["activity_eu_legislative"]), |
| 365 | 365 | activity_expert_groups: decode_activity_expert_groups(m["activity_expert_groups"]), |
| 366 | 366 | activity_high_level_groups: decode_activity_high_level_groups(m["activity_high_level_groups"]), |
| 367 | 367 | activity_industry_forums: decode_activity_industry_forums(m["activity_industry_forums"]), |
| 368 | 368 | 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")), | |
| 370 | 370 | activity_relevant_comm: decode_activity_relevant_comm(m["activity_relevant_comm"]), |
| 371 | 371 | 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"]), | |
| 374 | 374 | 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"]), | |
| 377 | 377 | be_office_street: m["be_office_street"], |
| 378 | 378 | be_office_town: m["be_office_town"], |
| 379 | 379 | code_of_conduct: decode_code_of_conduct(m["code_of_conduct"]), |
| @@ -383,11 +383,11 @@ defmodule Result do | ||
| 383 | 383 | goals: decode_goals(m["goals"]), |
| 384 | 384 | head: decode_head(m["head"]), |
| 385 | 385 | 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")), | |
| 388 | 388 | 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")), | |
| 391 | 391 | head_office_street: decode_head_office_street(m["head_office_street"]), |
| 392 | 392 | head_office_town: decode_head_office_town(m["head_office_town"]), |
| 393 | 393 | id: decode_id(m["id"]), |
| @@ -399,16 +399,16 @@ defmodule Result do | ||
| 399 | 399 | main_category: decode_main_category(m["main_category"]), |
| 400 | 400 | main_category_title: decode_main_category_title(m["main_category_title"]), |
| 401 | 401 | 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")), | |
| 406 | 406 | members_fte: decode_members_fte(m["members_fte"]), |
| 407 | 407 | name: decode_name(m["name"]), |
| 408 | 408 | 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")), | |
| 412 | 412 | registration_date: decode_registration_date(m["registration_date"]), |
| 413 | 413 | status: Status.decode(m["status"]), |
| 414 | 414 | structure_members: decode_structure_members(m["structure_members"]), |
| @@ -416,7 +416,7 @@ defmodule Result do | ||
| 416 | 416 | sub_category_title: decode_sub_category_title(m["sub_category_title"]), |
| 417 | 417 | updated_at: decode_updated_at(m["updated_at"]), |
| 418 | 418 | 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")), | |
| 420 | 420 | } |
| 421 | 421 | end |
Test case
1 generated file · +1 −1test/inputs/json/misc/7f568.json
Melixirdefault / QuickType.ex+1 −1
| @@ -271,7 +271,7 @@ defmodule TopLevelElement do | ||
| 271 | 271 | comments_url: decode_comments_url(m["comments_url"]), |
| 272 | 272 | commits_url: decode_commits_url(m["commits_url"]), |
| 273 | 273 | created_at: decode_created_at(m["created_at"]), |
| 274 | - description: Map.fetch!(m, "description"), | |
| 274 | + description: decode_description(Map.fetch!(m, "description")), | |
| 275 | 275 | files: m["files"] |
| 276 | 276 | |> Map.new(fn {key, value} -> {key, FileValue.from_map(value)} end), |
| 277 | 277 | forks_url: decode_forks_url(m["forks_url"]), |
Test case
1 generated file · +1 −1test/inputs/json/misc/80aff.json
Melixirdefault / QuickType.ex+1 −1
| @@ -90,7 +90,7 @@ defmodule Result do | ||
| 90 | 90 | id: decode_id(m["id"]), |
| 91 | 91 | items: decode_items(m["items"]), |
| 92 | 92 | name: decode_name(m["name"]), |
| 93 | - parent: Map.fetch!(m, "parent"), | |
| 93 | + parent: decode_parent(Map.fetch!(m, "parent")), | |
| 94 | 94 | updated_at: decode_updated_at(m["updated_at"]), |
| 95 | 95 | uri: decode_uri(m["uri"]), |
| 96 | 96 | } |
Test case
1 generated file · +5 −5test/inputs/json/misc/8592b.json
Melixirdefault / QuickType.ex+5 −5
| @@ -845,8 +845,8 @@ defmodule ChildData do | ||
| 845 | 845 | approved_by: decode_approved_by(m["approved_by"]), |
| 846 | 846 | archived: decode_archived(m["archived"]), |
| 847 | 847 | 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")), | |
| 850 | 850 | banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]), |
| 851 | 851 | banned_by: decode_banned_by(m["banned_by"]), |
| 852 | 852 | brand_safe: decode_brand_safe(m["brand_safe"]), |
| @@ -888,7 +888,7 @@ defmodule ChildData do | ||
| 888 | 888 | secure_media: decode_secure_media(m["secure_media"]), |
| 889 | 889 | secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]), |
| 890 | 890 | selftext: decode_selftext(m["selftext"]), |
| 891 | - selftext_html: Map.fetch!(m, "selftext_html"), | |
| 891 | + selftext_html: decode_selftext_html(Map.fetch!(m, "selftext_html")), | |
| 892 | 892 | spoiler: decode_spoiler(m["spoiler"]), |
| 893 | 893 | stickied: decode_stickied(m["stickied"]), |
| 894 | 894 | subreddit: Subreddit.decode(m["subreddit"]), |
| @@ -897,8 +897,8 @@ defmodule ChildData do | ||
| 897 | 897 | subreddit_type: SubredditType.decode(m["subreddit_type"]), |
| 898 | 898 | suggested_sort: SuggestedSort.decode(m["suggested_sort"]), |
| 899 | 899 | 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")), | |
| 902 | 902 | title: decode_title(m["title"]), |
| 903 | 903 | ups: decode_ups(m["ups"]), |
| 904 | 904 | url: decode_url(m["url"]), |
Test case
1 generated file · +1 −1test/inputs/json/misc/996bd.json
Melixirdefault / QuickType.ex+1 −1
| @@ -392,7 +392,7 @@ defmodule TopLevelElement do | ||
| 392 | 392 | links: Enum.map(m["links"], &Link.from_map/1), |
| 393 | 393 | name: decode_name(m["name"]), |
| 394 | 394 | 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")), | |
| 396 | 396 | text: Enum.map(m["text"], &Text.from_map/1), |
| 397 | 397 | } |
| 398 | 398 | end |
Test case
1 generated file · +1 −1test/inputs/json/misc/9ac3b.json
Melixirdefault / QuickType.ex+1 −1
| @@ -200,7 +200,7 @@ defmodule Result do | ||
| 200 | 200 | id: decode_id(m["id"]), |
| 201 | 201 | last_name: decode_last_name(m["last_name"]), |
| 202 | 202 | name: decode_name(m["name"]), |
| 203 | - position: Map.fetch!(m, "position"), | |
| 203 | + position: decode_position(Map.fetch!(m, "position")), | |
| 204 | 204 | status: Status.decode(m["status"]), |
| 205 | 205 | title: m["title"] && Title.decode(m["title"]), |
| 206 | 206 | updated_at: decode_updated_at(m["updated_at"]), |
Test case
1 generated file · +2 −2test/inputs/json/misc/ad8be.json
Melixirdefault / QuickType.ex+2 −2
| @@ -260,7 +260,7 @@ defmodule OtherName do | ||
| 260 | 260 | def from_map(m) do |
| 261 | 261 | %OtherName{ |
| 262 | 262 | name: decode_name(m["name"]), |
| 263 | - note: Map.fetch!(m, "note"), | |
| 263 | + note: decode_note(Map.fetch!(m, "note")), | |
| 264 | 264 | } |
| 265 | 265 | end |
| 266 | 266 | |
| @@ -488,7 +488,7 @@ defmodule TopLevelElement do | ||
| 488 | 488 | links: Enum.map(m["links"], &Link.from_map/1), |
| 489 | 489 | name: decode_name(m["name"]), |
| 490 | 490 | 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")), | |
| 492 | 492 | text: Enum.map(m["text"], &Text.from_map/1), |
| 493 | 493 | } |
| 494 | 494 | end |
Test case
1 generated file · +2 −2test/inputs/json/misc/ae7f0.json
Melixirdefault / QuickType.ex+2 −2
| @@ -664,8 +664,8 @@ defmodule ChildData do | ||
| 664 | 664 | is_self: decode_is_self(m["is_self"]), |
| 665 | 665 | is_video: decode_is_video(m["is_video"]), |
| 666 | 666 | 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")), | |
| 669 | 669 | locked: decode_locked(m["locked"]), |
| 670 | 670 | media: decode_media(m["media"]), |
| 671 | 671 | media_embed: MediaEmbed.from_map(m["media_embed"]), |
Test case
1 generated file · +8 −8test/inputs/json/misc/af2d1.json
Melixirdefault / QuickType.ex+8 −8
| @@ -737,16 +737,16 @@ defmodule FeatureProperties do | ||
| 737 | 737 | add_improv: m["add_improv"] && AddImprov.decode(m["add_improv"]), |
| 738 | 738 | area: decode_area(m["area_"]), |
| 739 | 739 | asset_numb: decode_asset_numb(m["asset_numb"]), |
| 740 | - comments: Map.fetch!(m, "comments"), | |
| 740 | + comments: decode_comments(Map.fetch!(m, "comments")), | |
| 741 | 741 | condition: decode_condition(m["condition"]), |
| 742 | - constructi: Map.fetch!(m, "constructi"), | |
| 742 | + constructi: decode_constructi(Map.fetch!(m, "constructi")), | |
| 743 | 743 | createdate: decode_createdate(m["createdate"]), |
| 744 | 744 | createuser: decode_createuser(m["createuser"]), |
| 745 | 745 | disposal_d: decode_disposal_d(m["disposal_d"]), |
| 746 | 746 | 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")), | |
| 750 | 750 | funding_ba: m["funding_ba"] && FundingBa.decode(m["funding_ba"]), |
| 751 | 751 | historic_c: decode_historic_c(m["historic_c"]), |
| 752 | 752 | inspection: decode_inspection(m["inspection"]), |
| @@ -757,11 +757,11 @@ defmodule FeatureProperties do | ||
| 757 | 757 | mi_prinx: decode_mi_prinx(m["mi_prinx"]), |
| 758 | 758 | mi_symbolo: MiSymbolo.decode(m["mi_symbolo"]), |
| 759 | 759 | number_lan: decode_number_lan(m["number_lan"]), |
| 760 | - owner: Map.fetch!(m, "owner"), | |
| 760 | + owner: decode_owner(Map.fetch!(m, "owner")), | |
| 761 | 761 | 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")), | |
| 763 | 763 | 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")), | |
| 765 | 765 | shape_area: decode_shape_area(m["shape_area"]), |
| 766 | 766 | shape_leng: decode_shape_leng(m["shape_leng"]), |
| 767 | 767 | status: Status.decode(m["status"]), |
Test case
1 generated file · +2 −2test/inputs/json/misc/be234.json
Melixirdefault / QuickType.ex+2 −2
| @@ -1120,7 +1120,7 @@ defmodule ChildData do | ||
| 1120 | 1120 | archived: decode_archived(m["archived"]), |
| 1121 | 1121 | author: decode_author(m["author"]), |
| 1122 | 1122 | 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")), | |
| 1124 | 1124 | banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]), |
| 1125 | 1125 | banned_by: decode_banned_by(m["banned_by"]), |
| 1126 | 1126 | brand_safe: decode_brand_safe(m["brand_safe"]), |
| @@ -1130,7 +1130,7 @@ defmodule ChildData do | ||
| 1130 | 1130 | contest_mode: decode_contest_mode(m["contest_mode"]), |
| 1131 | 1131 | created: decode_created(m["created"]), |
| 1132 | 1132 | created_utc: decode_created_utc(m["created_utc"]), |
| 1133 | - distinguished: Map.fetch!(m, "distinguished"), | |
| 1133 | + distinguished: decode_distinguished(Map.fetch!(m, "distinguished")), | |
| 1134 | 1134 | domain: Domain.decode(m["domain"]), |
| 1135 | 1135 | downs: decode_downs(m["downs"]), |
| 1136 | 1136 | edited: decode_edited(m["edited"]), |
Test case
1 generated file · +1 −1test/inputs/json/misc/d23d5.json
Melixirdefault / QuickType.ex+1 −1
| @@ -79,7 +79,7 @@ defmodule Result do | ||
| 79 | 79 | |
| 80 | 80 | def from_map(m) do |
| 81 | 81 | %Result{ |
| 82 | - acronym: Map.fetch!(m, "acronym"), | |
| 82 | + acronym: decode_acronym(Map.fetch!(m, "acronym")), | |
| 83 | 83 | created_at: decode_created_at(m["created_at"]), |
| 84 | 84 | id: decode_id(m["id"]), |
| 85 | 85 | name: decode_name(m["name"]), |
Test case
1 generated file · +2 −2test/inputs/json/misc/f22f5.json
Melixirdefault / QuickType.ex+2 −2
| @@ -625,8 +625,8 @@ defmodule ChildData do | ||
| 625 | 625 | is_self: decode_is_self(m["is_self"]), |
| 626 | 626 | is_video: decode_is_video(m["is_video"]), |
| 627 | 627 | 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")), | |
| 630 | 630 | locked: decode_locked(m["locked"]), |
| 631 | 631 | media: decode_media(m["media"]), |
| 632 | 632 | media_embed: MediaEmbed.from_map(m["media_embed"]), |
Test case
1 generated file · +2 −2test/inputs/json/priority/bug2590.json
Melixirdefault / QuickType.ex+2 −2
| @@ -23,8 +23,8 @@ defmodule Invoice do | ||
| 23 | 23 | |
| 24 | 24 | def from_map(m) do |
| 25 | 25 | %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")), | |
| 28 | 28 | name: decode_name(m["name"]), |
| 29 | 29 | } |
| 30 | 30 | end |
Test case
1 generated file · +1 −1test/inputs/json/priority/nbl-stats.json
Melixirdefault / QuickType.ex+1 −1
| @@ -1347,7 +1347,7 @@ defmodule Pl do | ||
| 1347 | 1347 | s_free_throws_attempted: decode_s_free_throws_attempted(m["sFreeThrowsAttempted"]), |
| 1348 | 1348 | s_free_throws_made: decode_s_free_throws_made(m["sFreeThrowsMade"]), |
| 1349 | 1349 | 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")), | |
| 1351 | 1351 | s_plus_minus_points: decode_s_plus_minus_points(m["sPlusMinusPoints"]), |
| 1352 | 1352 | s_points: decode_s_points(m["sPoints"]), |
| 1353 | 1353 | s_points_fast_break: decode_s_points_fast_break(m["sPointsFastBreak"]), |
Test case
1 generated file · +1 −1test/inputs/json/priority/optional-union.json
Melixirdefault / QuickType.ex+1 −1
| @@ -14,7 +14,7 @@ defmodule TopLevelElement do | ||
| 14 | 14 | |
| 15 | 15 | def from_map(m) do |
| 16 | 16 | %TopLevelElement{ |
| 17 | - a: m["a"], | |
| 17 | + a: m["a"] && decode_a(m["a"]), | |
| 18 | 18 | } |
| 19 | 19 | end |
Test case
1 generated file · +2 −2test/inputs/json/samples/github-events.json
Melixirdefault / QuickType.ex+2 −2
| @@ -701,7 +701,7 @@ defmodule Milestone do | ||
| 701 | 701 | created_at: decode_created_at(m["created_at"]), |
| 702 | 702 | creator: User.from_map(m["creator"]), |
| 703 | 703 | description: decode_description(m["description"]), |
| 704 | - due_on: Map.fetch!(m, "due_on"), | |
| 704 | + due_on: decode_due_on(Map.fetch!(m, "due_on")), | |
| 705 | 705 | html_url: decode_html_url(m["html_url"]), |
| 706 | 706 | id: decode_id(m["id"]), |
| 707 | 707 | labels_url: decode_labels_url(m["labels_url"]), |
| @@ -955,7 +955,7 @@ defmodule Issue do | ||
| 955 | 955 | assignee: decode_assignee(m["assignee"]), |
| 956 | 956 | assignees: decode_assignees(m["assignees"]), |
| 957 | 957 | body: decode_body(m["body"]), |
| 958 | - closed_at: Map.fetch!(m, "closed_at"), | |
| 958 | + closed_at: decode_closed_at(Map.fetch!(m, "closed_at")), | |
| 959 | 959 | comments: decode_comments(m["comments"]), |
| 960 | 960 | comments_url: decode_comments_url(m["comments_url"]), |
| 961 | 961 | created_at: decode_created_at(m["created_at"]), |
Test case
1 generated file · +1 −1test/inputs/json/samples/kitchen-sink.json
Melixirdefault / QuickType.ex+1 −1
| @@ -62,7 +62,7 @@ defmodule PersonElement do | ||
| 62 | 62 | |
| 63 | 63 | def from_map(m) do |
| 64 | 64 | %PersonElement{ |
| 65 | - int_or_string: Map.fetch!(m, "intOrString"), | |
| 65 | + int_or_string: decode_int_or_string(Map.fetch!(m, "intOrString")), | |
| 66 | 66 | name: decode_name(m["name"]), |
| 67 | 67 | optional_value: m["optionalValue"], |
| 68 | 68 | } |
Test case
1 generated file · +1 −1test/inputs/json/samples/null-safe.json
Melixirdefault / QuickType.ex+1 −1
| @@ -84,7 +84,7 @@ defmodule Item do | ||
| 84 | 84 | address: m["address"] && Address.from_map(m["address"]), |
| 85 | 85 | created_at: m["created_at"], |
| 86 | 86 | name: decode_name(m["name"]), |
| 87 | - sex: Map.fetch!(m, "sex"), | |
| 87 | + sex: decode_sex(Map.fetch!(m, "sex")), | |
| 88 | 88 | } |
| 89 | 89 | end |
Test case
1 generated file · +5 −5test/inputs/json/samples/reddit.json
Melixirdefault / QuickType.ex+5 −5
| @@ -968,8 +968,8 @@ defmodule ChildData do | ||
| 968 | 968 | approved_by: decode_approved_by(m["approved_by"]), |
| 969 | 969 | archived: decode_archived(m["archived"]), |
| 970 | 970 | 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")), | |
| 973 | 973 | banned_at_utc: decode_banned_at_utc(m["banned_at_utc"]), |
| 974 | 974 | banned_by: decode_banned_by(m["banned_by"]), |
| 975 | 975 | brand_safe: decode_brand_safe(m["brand_safe"]), |
| @@ -979,7 +979,7 @@ defmodule ChildData do | ||
| 979 | 979 | contest_mode: decode_contest_mode(m["contest_mode"]), |
| 980 | 980 | created: decode_created(m["created"]), |
| 981 | 981 | created_utc: decode_created_utc(m["created_utc"]), |
| 982 | - distinguished: Map.fetch!(m, "distinguished"), | |
| 982 | + distinguished: decode_distinguished(Map.fetch!(m, "distinguished")), | |
| 983 | 983 | domain: Domain.decode(m["domain"]), |
| 984 | 984 | downs: decode_downs(m["downs"]), |
| 985 | 985 | edited: decode_edited(m["edited"]), |
| @@ -990,8 +990,8 @@ defmodule ChildData do | ||
| 990 | 990 | is_self: decode_is_self(m["is_self"]), |
| 991 | 991 | is_video: decode_is_video(m["is_video"]), |
| 992 | 992 | 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")), | |
| 995 | 995 | locked: decode_locked(m["locked"]), |
| 996 | 996 | media: decode_media(m["media"]), |
| 997 | 997 | media_embed: MediaEmbed.from_map(m["media_embed"]), |
Test case
1 generated file · +3 −3test/inputs/json/samples/us-senators.json
Melixirdefault / QuickType.ex+3 −3
| @@ -424,8 +424,8 @@ defmodule Person do | ||
| 424 | 424 | osid: decode_osid(m["osid"]), |
| 425 | 425 | pvsid: decode_pvsid(m["pvsid"]), |
| 426 | 426 | 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")), | |
| 429 | 429 | } |
| 430 | 430 | end |
| 431 | 431 | |
| @@ -877,7 +877,7 @@ defmodule Object do | ||
| 877 | 877 | district: decode_district(m["district"]), |
| 878 | 878 | enddate: decode_enddate(m["enddate"]), |
| 879 | 879 | 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")), | |
| 881 | 881 | party: Party.decode(m["party"]), |
| 882 | 882 | person: Person.from_map(m["person"]), |
| 883 | 883 | phone: decode_phone(m["phone"]), |
Test case
1 generated file · +1 −1test/inputs/schema/accessors.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -80,7 +80,7 @@ defmodule TopLevel do | ||
| 80 | 80 | barre: decode_barre(m["bar"]), |
| 81 | 81 | enumerification: EnumEnum.decode(m["enum"]), |
| 82 | 82 | foo: decode_foo(m["foo"]), |
| 83 | - unionization: Map.fetch!(m, "union"), | |
| 83 | + unionization: decode_unionization(Map.fetch!(m, "union")), | |
| 84 | 84 | } |
| 85 | 85 | end |
Test case
1 generated file · +3 −3test/inputs/schema/bool-string.schema
Mschema-elixirdefault / QuickType.ex+3 −3
| @@ -37,11 +37,11 @@ defmodule TopLevel do | ||
| 37 | 37 | %TopLevel{ |
| 38 | 38 | arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), |
| 39 | 39 | arr_one: m["arrOne"], |
| 40 | - nullable: Map.fetch!(m, "nullable"), | |
| 40 | + nullable: decode_nullable(Map.fetch!(m, "nullable")), | |
| 41 | 41 | one: decode_one(m["one"]), |
| 42 | 42 | 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")), | |
| 45 | 45 | } |
| 46 | 46 | end |
Test case
1 generated file · +0 −86test/inputs/schema/class-map-union.schema
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
1 generated file · +1 −1test/inputs/schema/description.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -133,7 +133,7 @@ defmodule TopLevel do | ||
| 133 | 133 | enum: EnumEnum.decode(m["enum"]), |
| 134 | 134 | foo: m["foo"], |
| 135 | 135 | 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")), | |
| 137 | 137 | } |
| 138 | 138 | end |
Test case
1 generated file · +0 −96test/inputs/schema/implicit-class-array-union.schema
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
1 generated file · +3 −3test/inputs/schema/integer-string.schema
Mschema-elixirdefault / QuickType.ex+3 −3
| @@ -37,11 +37,11 @@ defmodule TopLevel do | ||
| 37 | 37 | %TopLevel{ |
| 38 | 38 | arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), |
| 39 | 39 | arr_one: m["arrOne"], |
| 40 | - nullable: Map.fetch!(m, "nullable"), | |
| 40 | + nullable: decode_nullable(Map.fetch!(m, "nullable")), | |
| 41 | 41 | one: decode_one(m["one"]), |
| 42 | 42 | 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")), | |
| 45 | 45 | } |
| 46 | 46 | end |
Test case
1 generated file · +1 −1test/inputs/schema/minmaxlength.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -65,7 +65,7 @@ defmodule TopLevel do | ||
| 65 | 65 | def from_map(m) do |
| 66 | 66 | %TopLevel{ |
| 67 | 67 | intersection: decode_intersection(m["intersection"]), |
| 68 | - in_union: Map.fetch!(m, "inUnion"), | |
| 68 | + in_union: decode_in_union(Map.fetch!(m, "inUnion")), | |
| 69 | 69 | maxlength: decode_maxlength(m["maxlength"]), |
| 70 | 70 | minlength: decode_minlength(m["minlength"]), |
| 71 | 71 | min_max_intersection: decode_min_max_intersection(m["minMaxIntersection"]), |
Test case
1 generated file · +1 −1test/inputs/schema/nullable-optional-one-of.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -62,7 +62,7 @@ defmodule TopLevel do | ||
| 62 | 62 | |
| 63 | 63 | def from_map(m) do |
| 64 | 64 | %TopLevel{ |
| 65 | - b: m["b"], | |
| 65 | + b: m["b"] && decode_b(m["b"]), | |
| 66 | 66 | kind: Kind.decode(m["kind"]), |
| 67 | 67 | } |
| 68 | 68 | end |
Test case
1 generated file · +1 −1test/inputs/schema/strict-optional.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -15,7 +15,7 @@ defmodule TopLevel do | ||
| 15 | 15 | |
| 16 | 16 | def from_map(m) do |
| 17 | 17 | %TopLevel{ |
| 18 | - foo: Map.fetch!(m, "foo"), | |
| 18 | + foo: decode_foo(Map.fetch!(m, "foo")), | |
| 19 | 19 | } |
| 20 | 20 | end |
Test case
1 generated file · +1 −1test/inputs/schema/union-int-double.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -15,7 +15,7 @@ defmodule TopLevel do | ||
| 15 | 15 | |
| 16 | 16 | def from_map(m) do |
| 17 | 17 | %TopLevel{ |
| 18 | - value: Map.fetch!(m, "value"), | |
| 18 | + value: decode_value(Map.fetch!(m, "value")), | |
| 19 | 19 | } |
| 20 | 20 | end |
Test case
1 generated file · +1 −1test/inputs/schema/uuid.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -42,7 +42,7 @@ defmodule TopLevel do | ||
| 42 | 42 | %TopLevel{ |
| 43 | 43 | arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), |
| 44 | 44 | arr_one: m["arrOne"], |
| 45 | - nullable: Map.fetch!(m, "nullable"), | |
| 45 | + nullable: decode_nullable(Map.fetch!(m, "nullable")), | |
| 46 | 46 | one: decode_one(m["one"]), |
| 47 | 47 | optional: m["optional"], |
| 48 | 48 | union_with_enum: decode_union_with_enum(m["unionWithEnum"]), |
Test case
1 generated file · +31 −31test/inputs/schema/vega-lite.schema
Mschema-elixirdefault / QuickType.ex+31 −31
| @@ -914,9 +914,9 @@ defmodule AxisConfig do | ||
| 914 | 914 | grid_opacity: m["gridOpacity"], |
| 915 | 915 | grid_width: m["gridWidth"], |
| 916 | 916 | label_angle: m["labelAngle"], |
| 917 | - label_bound: m["labelBound"], | |
| 917 | + label_bound: m["labelBound"] && decode_label_bound(m["labelBound"]), | |
| 918 | 918 | label_color: m["labelColor"], |
| 919 | - label_flush: m["labelFlush"], | |
| 919 | + label_flush: m["labelFlush"] && decode_label_flush(m["labelFlush"]), | |
| 920 | 920 | label_font: m["labelFont"], |
| 921 | 921 | label_font_size: m["labelFontSize"], |
| 922 | 922 | label_limit: m["labelLimit"], |
| @@ -937,7 +937,7 @@ defmodule AxisConfig do | ||
| 937 | 937 | title_color: m["titleColor"], |
| 938 | 938 | title_font: m["titleFont"], |
| 939 | 939 | title_font_size: m["titleFontSize"], |
| 940 | - title_font_weight: m["titleFontWeight"], | |
| 940 | + title_font_weight: m["titleFontWeight"] && decode_title_font_weight(m["titleFontWeight"]), | |
| 941 | 941 | title_limit: m["titleLimit"], |
| 942 | 942 | title_max_length: m["titleMaxLength"], |
| 943 | 943 | title_padding: m["titlePadding"], |
| @@ -1123,9 +1123,9 @@ defmodule VGAxisConfig do | ||
| 1123 | 1123 | grid_opacity: m["gridOpacity"], |
| 1124 | 1124 | grid_width: m["gridWidth"], |
| 1125 | 1125 | label_angle: m["labelAngle"], |
| 1126 | - label_bound: m["labelBound"], | |
| 1126 | + label_bound: m["labelBound"] && decode_label_bound(m["labelBound"]), | |
| 1127 | 1127 | label_color: m["labelColor"], |
| 1128 | - label_flush: m["labelFlush"], | |
| 1128 | + label_flush: m["labelFlush"] && decode_label_flush(m["labelFlush"]), | |
| 1129 | 1129 | label_font: m["labelFont"], |
| 1130 | 1130 | label_font_size: m["labelFontSize"], |
| 1131 | 1131 | label_limit: m["labelLimit"], |
| @@ -1145,7 +1145,7 @@ defmodule VGAxisConfig do | ||
| 1145 | 1145 | title_color: m["titleColor"], |
| 1146 | 1146 | title_font: m["titleFont"], |
| 1147 | 1147 | title_font_size: m["titleFontSize"], |
| 1148 | - title_font_weight: m["titleFontWeight"], | |
| 1148 | + title_font_weight: m["titleFontWeight"] && decode_title_font_weight(m["titleFontWeight"]), | |
| 1149 | 1149 | title_limit: m["titleLimit"], |
| 1150 | 1150 | title_max_length: m["titleMaxLength"], |
| 1151 | 1151 | title_padding: m["titlePadding"], |
| @@ -1672,7 +1672,7 @@ defmodule LegendConfig do | ||
| 1672 | 1672 | title_color: m["titleColor"], |
| 1673 | 1673 | title_font: m["titleFont"], |
| 1674 | 1674 | title_font_size: m["titleFontSize"], |
| 1675 | - title_font_weight: m["titleFontWeight"], | |
| 1675 | + title_font_weight: m["titleFontWeight"] && decode_title_font_weight(m["titleFontWeight"]), | |
| 1676 | 1676 | title_limit: m["titleLimit"], |
| 1677 | 1677 | title_padding: m["titlePadding"], |
| 1678 | 1678 | } |
| @@ -2047,7 +2047,7 @@ defmodule ScaleConfig do | ||
| 2047 | 2047 | min_size: m["minSize"], |
| 2048 | 2048 | min_stroke_width: m["minStrokeWidth"], |
| 2049 | 2049 | point_padding: m["pointPadding"], |
| 2050 | - range_step: m["rangeStep"], | |
| 2050 | + range_step: m["rangeStep"] && decode_range_step(m["rangeStep"]), | |
| 2051 | 2051 | round: m["round"], |
| 2052 | 2052 | text_x_range_step: m["textXRangeStep"], |
| 2053 | 2053 | use_unaggregated_domain: m["useUnaggregatedDomain"], |
| @@ -2405,8 +2405,8 @@ defmodule IntervalSelectionConfig do | ||
| 2405 | 2405 | mark: m["mark"] && BrushConfig.from_map(m["mark"]), |
| 2406 | 2406 | on: m["on"], |
| 2407 | 2407 | 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"]), | |
| 2410 | 2410 | } |
| 2411 | 2411 | end |
| 2412 | 2412 | |
| @@ -2474,7 +2474,7 @@ defmodule MultiSelectionConfig do | ||
| 2474 | 2474 | nearest: m["nearest"], |
| 2475 | 2475 | on: m["on"], |
| 2476 | 2476 | resolve: m["resolve"] && SelectionResolution.decode(m["resolve"]), |
| 2477 | - toggle: m["toggle"], | |
| 2477 | + toggle: m["toggle"] && decode_toggle(m["toggle"]), | |
| 2478 | 2478 | } |
| 2479 | 2479 | end |
| 2480 | 2480 | |
| @@ -4191,11 +4191,11 @@ defmodule DateTimeClass do | ||
| 4191 | 4191 | def from_map(m) do |
| 4192 | 4192 | %DateTimeClass{ |
| 4193 | 4193 | date: m["date"], |
| 4194 | - day: m["day"], | |
| 4194 | + day: m["day"] && decode_day(m["day"]), | |
| 4195 | 4195 | hours: m["hours"], |
| 4196 | 4196 | milliseconds: m["milliseconds"], |
| 4197 | 4197 | minutes: m["minutes"], |
| 4198 | - month: m["month"], | |
| 4198 | + month: m["month"] && decode_month(m["month"]), | |
| 4199 | 4199 | quarter: m["quarter"], |
| 4200 | 4200 | seconds: m["seconds"], |
| 4201 | 4201 | utc: m["utc"], |
| @@ -4512,7 +4512,7 @@ defmodule ConditionalValueDef do | ||
| 4512 | 4512 | def from_map(m) do |
| 4513 | 4513 | %ConditionalValueDef{ |
| 4514 | 4514 | test: decode_test(m["test"]), |
| 4515 | - value: Map.fetch!(m, "value"), | |
| 4515 | + value: decode_value(Map.fetch!(m, "value")), | |
| 4516 | 4516 | selection: decode_selection(m["selection"]), |
| 4517 | 4517 | } |
| 4518 | 4518 | end |
| @@ -4724,7 +4724,7 @@ defmodule Legend do | ||
| 4724 | 4724 | orient: m["orient"] && LegendOrient.decode(m["orient"]), |
| 4725 | 4725 | padding: m["padding"], |
| 4726 | 4726 | tick_count: m["tickCount"], |
| 4727 | - title: m["title"], | |
| 4727 | + title: m["title"] && decode_title(m["title"]), | |
| 4728 | 4728 | type: m["type"] && LegendType.decode(m["type"]), |
| 4729 | 4729 | values: m["values"] && Enum.map(m["values"], &decode_values_element/1), |
| 4730 | 4730 | zindex: m["zindex"], |
| @@ -5274,7 +5274,7 @@ defmodule Scale do | ||
| 5274 | 5274 | padding_inner: m["paddingInner"], |
| 5275 | 5275 | padding_outer: m["paddingOuter"], |
| 5276 | 5276 | range: decode_range(m["range"]), |
| 5277 | - range_step: m["rangeStep"], | |
| 5277 | + range_step: m["rangeStep"] && decode_range_step(m["rangeStep"]), | |
| 5278 | 5278 | round: m["round"], |
| 5279 | 5279 | scheme: decode_scheme(m["scheme"]), |
| 5280 | 5280 | type: m["type"] && ScaleType.decode(m["type"]), |
| @@ -5559,7 +5559,7 @@ defmodule ConditionalPredicateMarkPropFieldDefClass do | ||
| 5559 | 5559 | def from_map(m) do |
| 5560 | 5560 | %ConditionalPredicateMarkPropFieldDefClass{ |
| 5561 | 5561 | test: decode_test(m["test"]), |
| 5562 | - value: m["value"], | |
| 5562 | + value: m["value"] && decode_value(m["value"]), | |
| 5563 | 5563 | selection: decode_selection(m["selection"]), |
| 5564 | 5564 | aggregate: m["aggregate"] && AggregateOp.decode(m["aggregate"]), |
| 5565 | 5565 | bin: decode_bin(m["bin"]), |
| @@ -5722,7 +5722,7 @@ defmodule MarkPropDefWithCondition do | ||
| 5722 | 5722 | sort: decode_sort(m["sort"]), |
| 5723 | 5723 | time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]), |
| 5724 | 5724 | type: m["type"] && Type.decode(m["type"]), |
| 5725 | - value: m["value"], | |
| 5725 | + value: m["value"] && decode_value(m["value"]), | |
| 5726 | 5726 | } |
| 5727 | 5727 | end |
| 5728 | 5728 | |
| @@ -5776,7 +5776,7 @@ defmodule Header do | ||
| 5776 | 5776 | %Header{ |
| 5777 | 5777 | format: m["format"], |
| 5778 | 5778 | label_angle: m["labelAngle"], |
| 5779 | - title: m["title"], | |
| 5779 | + title: m["title"] && decode_title(m["title"]), | |
| 5780 | 5780 | } |
| 5781 | 5781 | end |
| 5782 | 5782 | |
| @@ -6026,7 +6026,7 @@ defmodule ConditionalPredicateFieldDefClass do | ||
| 6026 | 6026 | def from_map(m) do |
| 6027 | 6027 | %ConditionalPredicateFieldDefClass{ |
| 6028 | 6028 | test: decode_test(m["test"]), |
| 6029 | - value: m["value"], | |
| 6029 | + value: m["value"] && decode_value(m["value"]), | |
| 6030 | 6030 | selection: decode_selection(m["selection"]), |
| 6031 | 6031 | aggregate: m["aggregate"] && AggregateOp.decode(m["aggregate"]), |
| 6032 | 6032 | bin: decode_bin(m["bin"]), |
| @@ -6137,7 +6137,7 @@ defmodule DefWithCondition do | ||
| 6137 | 6137 | field: decode_field(m["field"]), |
| 6138 | 6138 | time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]), |
| 6139 | 6139 | type: m["type"] && Type.decode(m["type"]), |
| 6140 | - value: m["value"], | |
| 6140 | + value: m["value"] && decode_value(m["value"]), | |
| 6141 | 6141 | } |
| 6142 | 6142 | end |
| 6143 | 6143 | |
| @@ -6312,7 +6312,7 @@ defmodule ConditionalPredicateTextFieldDefClass do | ||
| 6312 | 6312 | def from_map(m) do |
| 6313 | 6313 | %ConditionalPredicateTextFieldDefClass{ |
| 6314 | 6314 | test: decode_test(m["test"]), |
| 6315 | - value: m["value"], | |
| 6315 | + value: m["value"] && decode_value(m["value"]), | |
| 6316 | 6316 | selection: decode_selection(m["selection"]), |
| 6317 | 6317 | aggregate: m["aggregate"] && AggregateOp.decode(m["aggregate"]), |
| 6318 | 6318 | bin: decode_bin(m["bin"]), |
| @@ -6430,7 +6430,7 @@ defmodule TextDefWithCondition do | ||
| 6430 | 6430 | format: m["format"], |
| 6431 | 6431 | time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]), |
| 6432 | 6432 | type: m["type"] && Type.decode(m["type"]), |
| 6433 | - value: m["value"], | |
| 6433 | + value: m["value"] && decode_value(m["value"]), | |
| 6434 | 6434 | } |
| 6435 | 6435 | end |
| 6436 | 6436 | |
| @@ -6539,8 +6539,8 @@ defmodule Axis do | ||
| 6539 | 6539 | format: m["format"], |
| 6540 | 6540 | grid: m["grid"], |
| 6541 | 6541 | 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"]), | |
| 6544 | 6544 | label_overlap: decode_label_overlap(m["labelOverlap"]), |
| 6545 | 6545 | label_padding: m["labelPadding"], |
| 6546 | 6546 | labels: m["labels"], |
| @@ -6552,7 +6552,7 @@ defmodule Axis do | ||
| 6552 | 6552 | tick_count: m["tickCount"], |
| 6553 | 6553 | ticks: m["ticks"], |
| 6554 | 6554 | tick_size: m["tickSize"], |
| 6555 | - title: m["title"], | |
| 6555 | + title: m["title"] && decode_title(m["title"]), | |
| 6556 | 6556 | title_max_length: m["titleMaxLength"], |
| 6557 | 6557 | title_padding: m["titlePadding"], |
| 6558 | 6558 | values: m["values"] && Enum.map(m["values"], &decode_values_element/1), |
| @@ -6675,7 +6675,7 @@ defmodule XClass do | ||
| 6675 | 6675 | stack: m["stack"] && StackOffset.decode(m["stack"]), |
| 6676 | 6676 | time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]), |
| 6677 | 6677 | type: m["type"] && Type.decode(m["type"]), |
| 6678 | - value: m["value"], | |
| 6678 | + value: m["value"] && decode_value(m["value"]), | |
| 6679 | 6679 | } |
| 6680 | 6680 | end |
| 6681 | 6681 | |
| @@ -6762,7 +6762,7 @@ defmodule X2Class do | ||
| 6762 | 6762 | field: decode_field(m["field"]), |
| 6763 | 6763 | time_unit: m["timeUnit"] && TimeUnit.decode(m["timeUnit"]), |
| 6764 | 6764 | type: m["type"] && Type.decode(m["type"]), |
| 6765 | - value: m["value"], | |
| 6765 | + value: m["value"] && decode_value(m["value"]), | |
| 6766 | 6766 | } |
| 6767 | 6767 | end |
| 6768 | 6768 | |
| @@ -7720,10 +7720,10 @@ defmodule SelectionDef do | ||
| 7720 | 7720 | on: m["on"], |
| 7721 | 7721 | resolve: m["resolve"] && SelectionResolution.decode(m["resolve"]), |
| 7722 | 7722 | type: SelectionDefType.decode(m["type"]), |
| 7723 | - toggle: m["toggle"], | |
| 7723 | + toggle: m["toggle"] && decode_toggle(m["toggle"]), | |
| 7724 | 7724 | 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"]), | |
| 7727 | 7727 | } |
| 7728 | 7728 | end |
No generated files match these filters.