Test case
1 generated file · +1 −1test/inputs/graphql/github1.graphql
Mgraphql-elixirdefault / QuickType.ex+1 −1
| @@ -17,7 +17,7 @@ defmodule User do | ||
| 17 | 17 | def from_map(m) do |
| 18 | 18 | %User{ |
| 19 | 19 | login: m["login"], |
| 20 | - real_name: m["realName"], | |
| 20 | + real_name: Map.fetch!(m, "realName"), | |
| 21 | 21 | } |
| 22 | 22 | end |
Test case
1 generated file · +1 −1test/inputs/graphql/github4.graphql
Mgraphql-elixirdefault / QuickType.ex+1 −1
| @@ -172,7 +172,7 @@ defmodule User do | ||
| 172 | 172 | def from_map(m) do |
| 173 | 173 | %User{ |
| 174 | 174 | login: m["login"], |
| 175 | - name: m["name"], | |
| 175 | + name: Map.fetch!(m, "name"), | |
| 176 | 176 | repository: m["repository"] && Repository.from_map(m["repository"]), |
| 177 | 177 | } |
| 178 | 178 | end |
Test case
1 generated file · +1 −1test/inputs/graphql/github9.graphql
Mgraphql-elixirdefault / QuickType.ex+1 −1
| @@ -136,7 +136,7 @@ defmodule AddReactionPayload do | ||
| 136 | 136 | |
| 137 | 137 | def from_map(m) do |
| 138 | 138 | %AddReactionPayload{ |
| 139 | - client_mutation_id: m["clientMutationId"], | |
| 139 | + client_mutation_id: Map.fetch!(m, "clientMutationId"), | |
| 140 | 140 | reaction: Reaction.from_map(m["reaction"]), |
| 141 | 141 | subject: Reactable.from_map(m["subject"]), |
| 142 | 142 | } |
Test case
1 generated file · +2 −2test/inputs/json/misc/050b0.json
Melixirdefault / QuickType.ex+2 −2
| @@ -233,7 +233,7 @@ defmodule OtherName do | ||
| 233 | 233 | def from_map(m) do |
| 234 | 234 | %OtherName{ |
| 235 | 235 | name: m["name"], |
| 236 | - note: m["note"], | |
| 236 | + note: Map.fetch!(m, "note"), | |
| 237 | 237 | } |
| 238 | 238 | end |
| 239 | 239 | |
| @@ -411,7 +411,7 @@ defmodule TopLevelElement do | ||
| 411 | 411 | links: Enum.map(m["links"], &Link.from_map/1), |
| 412 | 412 | name: m["name"], |
| 413 | 413 | other_names: Enum.map(m["other_names"], &OtherName.from_map/1), |
| 414 | - superseded_by: m["superseded_by"], | |
| 414 | + superseded_by: Map.fetch!(m, "superseded_by"), | |
| 415 | 415 | text: Enum.map(m["text"], &Text.from_map/1), |
| 416 | 416 | } |
| 417 | 417 | end |
Test case
1 generated file · +2 −2test/inputs/json/misc/10be4.json
Melixirdefault / QuickType.ex+2 −2
| @@ -242,7 +242,7 @@ defmodule OtherName do | ||
| 242 | 242 | def from_map(m) do |
| 243 | 243 | %OtherName{ |
| 244 | 244 | name: m["name"], |
| 245 | - note: m["note"], | |
| 245 | + note: Map.fetch!(m, "note"), | |
| 246 | 246 | } |
| 247 | 247 | end |
| 248 | 248 | |
| @@ -422,7 +422,7 @@ defmodule TopLevelElement do | ||
| 422 | 422 | links: Enum.map(m["links"], &Link.from_map/1), |
| 423 | 423 | name: m["name"], |
| 424 | 424 | other_names: Enum.map(m["other_names"], &OtherName.from_map/1), |
| 425 | - superseded_by: m["superseded_by"], | |
| 425 | + superseded_by: Map.fetch!(m, "superseded_by"), | |
| 426 | 426 | text: Enum.map(m["text"], &Text.from_map/1), |
| 427 | 427 | } |
| 428 | 428 | end |
Test case
1 generated file · +4 −4test/inputs/json/misc/1b409.json
Melixirdefault / QuickType.ex+4 −4
| @@ -317,10 +317,10 @@ defmodule Person do | ||
| 317 | 317 | namemod: Namemod.decode(m["namemod"]), |
| 318 | 318 | nickname: m["nickname"], |
| 319 | 319 | osid: m["osid"], |
| 320 | - pvsid: m["pvsid"], | |
| 320 | + pvsid: Map.fetch!(m, "pvsid"), | |
| 321 | 321 | sortname: m["sortname"], |
| 322 | - twitterid: m["twitterid"], | |
| 323 | - youtubeid: m["youtubeid"], | |
| 322 | + twitterid: Map.fetch!(m, "twitterid"), | |
| 323 | + youtubeid: Map.fetch!(m, "youtubeid"), | |
| 324 | 324 | } |
| 325 | 325 | end |
| 326 | 326 | |
| @@ -536,7 +536,7 @@ defmodule Object do | ||
| 536 | 536 | enddate: m["enddate"], |
| 537 | 537 | extra: Extra.from_map(m["extra"]), |
| 538 | 538 | id: m["id"], |
| 539 | - leadership_title: m["leadership_title"], | |
| 539 | + leadership_title: Map.fetch!(m, "leadership_title"), | |
| 540 | 540 | party: Party.decode(m["party"]), |
| 541 | 541 | person: Person.from_map(m["person"]), |
| 542 | 542 | phone: m["phone"], |
Test case
1 generated file · +8 −8test/inputs/json/misc/27332.json
Melixirdefault / QuickType.ex+8 −8
| @@ -645,8 +645,8 @@ defmodule ChildData do | ||
| 645 | 645 | approved_by: m["approved_by"], |
| 646 | 646 | archived: m["archived"], |
| 647 | 647 | author: m["author"], |
| 648 | - author_flair_css_class: m["author_flair_css_class"], | |
| 649 | - author_flair_text: m["author_flair_text"], | |
| 648 | + author_flair_css_class: Map.fetch!(m, "author_flair_css_class"), | |
| 649 | + author_flair_text: Map.fetch!(m, "author_flair_text"), | |
| 650 | 650 | banned_at_utc: m["banned_at_utc"], |
| 651 | 651 | banned_by: m["banned_by"], |
| 652 | 652 | brand_safe: m["brand_safe"], |
| @@ -656,7 +656,7 @@ defmodule ChildData do | ||
| 656 | 656 | contest_mode: m["contest_mode"], |
| 657 | 657 | created: m["created"], |
| 658 | 658 | created_utc: m["created_utc"], |
| 659 | - distinguished: m["distinguished"], | |
| 659 | + distinguished: Map.fetch!(m, "distinguished"), | |
| 660 | 660 | domain: Domain.decode(m["domain"]), |
| 661 | 661 | downs: m["downs"], |
| 662 | 662 | edited: m["edited"], |
| @@ -667,8 +667,8 @@ defmodule ChildData do | ||
| 667 | 667 | is_self: m["is_self"], |
| 668 | 668 | is_video: m["is_video"], |
| 669 | 669 | likes: m["likes"], |
| 670 | - link_flair_css_class: m["link_flair_css_class"], | |
| 671 | - link_flair_text: m["link_flair_text"], | |
| 670 | + link_flair_css_class: Map.fetch!(m, "link_flair_css_class"), | |
| 671 | + link_flair_text: Map.fetch!(m, "link_flair_text"), | |
| 672 | 672 | locked: m["locked"], |
| 673 | 673 | media: m["media"] && Media.from_map(m["media"]), |
| 674 | 674 | media_embed: MediaEmbed.from_map(m["media_embed"]), |
| @@ -688,7 +688,7 @@ defmodule ChildData do | ||
| 688 | 688 | secure_media: m["secure_media"] && Media.from_map(m["secure_media"]), |
| 689 | 689 | secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]), |
| 690 | 690 | selftext: m["selftext"], |
| 691 | - selftext_html: m["selftext_html"], | |
| 691 | + selftext_html: Map.fetch!(m, "selftext_html"), | |
| 692 | 692 | spoiler: m["spoiler"], |
| 693 | 693 | stickied: m["stickied"], |
| 694 | 694 | subreddit: Subreddit.decode(m["subreddit"]), |
| @@ -697,8 +697,8 @@ defmodule ChildData do | ||
| 697 | 697 | subreddit_type: SubredditType.decode(m["subreddit_type"]), |
| 698 | 698 | suggested_sort: m["suggested_sort"], |
| 699 | 699 | thumbnail: m["thumbnail"], |
| 700 | - thumbnail_height: m["thumbnail_height"], | |
| 701 | - thumbnail_width: m["thumbnail_width"], | |
| 700 | + thumbnail_height: Map.fetch!(m, "thumbnail_height"), | |
| 701 | + thumbnail_width: Map.fetch!(m, "thumbnail_width"), | |
| 702 | 702 | title: m["title"], |
| 703 | 703 | ups: m["ups"], |
| 704 | 704 | url: m["url"], |
Test case
1 generated file · +5 −5test/inputs/json/misc/29f47.json
Melixirdefault / QuickType.ex+5 −5
| @@ -630,7 +630,7 @@ defmodule ChildData do | ||
| 630 | 630 | distinguished: Distinguished.decode(m["distinguished"]), |
| 631 | 631 | domain: Domain.decode(m["domain"]), |
| 632 | 632 | downs: m["downs"], |
| 633 | - edited: m["edited"], | |
| 633 | + edited: Map.fetch!(m, "edited"), | |
| 634 | 634 | gilded: m["gilded"], |
| 635 | 635 | hidden: m["hidden"], |
| 636 | 636 | hide_score: m["hide_score"], |
| @@ -659,17 +659,17 @@ defmodule ChildData do | ||
| 659 | 659 | secure_media: m["secure_media"], |
| 660 | 660 | secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]), |
| 661 | 661 | selftext: m["selftext"], |
| 662 | - selftext_html: m["selftext_html"], | |
| 662 | + selftext_html: Map.fetch!(m, "selftext_html"), | |
| 663 | 663 | spoiler: m["spoiler"], |
| 664 | 664 | stickied: m["stickied"], |
| 665 | 665 | subreddit: Subreddit.decode(m["subreddit"]), |
| 666 | 666 | subreddit_id: SubredditID.decode(m["subreddit_id"]), |
| 667 | 667 | subreddit_name_prefixed: SubredditNamePrefixed.decode(m["subreddit_name_prefixed"]), |
| 668 | 668 | subreddit_type: SubredditType.decode(m["subreddit_type"]), |
| 669 | - suggested_sort: m["suggested_sort"], | |
| 669 | + suggested_sort: Map.fetch!(m, "suggested_sort"), | |
| 670 | 670 | thumbnail: m["thumbnail"], |
| 671 | - thumbnail_height: m["thumbnail_height"], | |
| 672 | - thumbnail_width: m["thumbnail_width"], | |
| 671 | + thumbnail_height: Map.fetch!(m, "thumbnail_height"), | |
| 672 | + thumbnail_width: Map.fetch!(m, "thumbnail_width"), | |
| 673 | 673 | title: m["title"], |
| 674 | 674 | ups: m["ups"], |
| 675 | 675 | url: m["url"], |
Test case
1 generated file · +3 −3test/inputs/json/misc/2d4e2.json
Melixirdefault / QuickType.ex+3 −3
| @@ -318,8 +318,8 @@ defmodule Person do | ||
| 318 | 318 | osid: m["osid"], |
| 319 | 319 | pvsid: m["pvsid"], |
| 320 | 320 | sortname: m["sortname"], |
| 321 | - twitterid: m["twitterid"], | |
| 322 | - youtubeid: m["youtubeid"], | |
| 321 | + twitterid: Map.fetch!(m, "twitterid"), | |
| 322 | + youtubeid: Map.fetch!(m, "youtubeid"), | |
| 323 | 323 | } |
| 324 | 324 | end |
| 325 | 325 | |
| @@ -720,7 +720,7 @@ defmodule Object do | ||
| 720 | 720 | enddate: m["enddate"], |
| 721 | 721 | extra: Extra.from_map(m["extra"]), |
| 722 | 722 | id: m["id"], |
| 723 | - leadership_title: m["leadership_title"], | |
| 723 | + leadership_title: Map.fetch!(m, "leadership_title"), | |
| 724 | 724 | party: Party.decode(m["party"]), |
| 725 | 725 | person: Person.from_map(m["person"]), |
| 726 | 726 | phone: m["phone"], |
Test case
1 generated file · +3 −3test/inputs/json/misc/32431.json
Melixirdefault / QuickType.ex+3 −3
| @@ -263,15 +263,15 @@ defmodule Properties do | ||
| 263 | 263 | cdi: m["cdi"], |
| 264 | 264 | code: m["code"], |
| 265 | 265 | detail: m["detail"], |
| 266 | - dmin: m["dmin"], | |
| 266 | + dmin: Map.fetch!(m, "dmin"), | |
| 267 | 267 | felt: m["felt"], |
| 268 | - gap: m["gap"], | |
| 268 | + gap: Map.fetch!(m, "gap"), | |
| 269 | 269 | ids: m["ids"], |
| 270 | 270 | mag: m["mag"], |
| 271 | 271 | mag_type: MagType.decode(m["magType"]), |
| 272 | 272 | mmi: m["mmi"], |
| 273 | 273 | net: m["net"], |
| 274 | - nst: m["nst"], | |
| 274 | + nst: Map.fetch!(m, "nst"), | |
| 275 | 275 | place: m["place"], |
| 276 | 276 | rms: m["rms"], |
| 277 | 277 | sig: m["sig"], |
Test case
1 generated file · +1 −1test/inputs/json/misc/32d5c.json
Melixirdefault / QuickType.ex+1 −1
| @@ -22,7 +22,7 @@ defmodule TopLevelElement do | ||
| 22 | 22 | |
| 23 | 23 | def from_map(m) do |
| 24 | 24 | %TopLevelElement{ |
| 25 | - birth_date: m["BirthDate"], | |
| 25 | + birth_date: Map.fetch!(m, "BirthDate"), | |
| 26 | 26 | birth_date_is_protected: m["BirthDateIsProtected"], |
| 27 | 27 | gender_type_id: m["GenderTypeID"], |
| 28 | 28 | notes: m["Notes"], |
Test case
1 generated file · +17 −17test/inputs/json/misc/337ed.json
Melixirdefault / QuickType.ex+17 −17
| @@ -268,35 +268,35 @@ defmodule Result do | ||
| 268 | 268 | |
| 269 | 269 | def from_map(m) do |
| 270 | 270 | %Result{ |
| 271 | - cost_absolute: m["cost_absolute"], | |
| 272 | - cost_max: m["cost_max"], | |
| 273 | - cost_min: m["cost_min"], | |
| 271 | + cost_absolute: Map.fetch!(m, "cost_absolute"), | |
| 272 | + cost_max: Map.fetch!(m, "cost_max"), | |
| 273 | + cost_min: Map.fetch!(m, "cost_min"), | |
| 274 | 274 | created_at: m["created_at"], |
| 275 | 275 | custom_incomes: Enum.map(m["customIncomes"], &CustomIncome.from_map/1), |
| 276 | 276 | direct_rep_costs_max: m["direct_rep_costs_max"], |
| 277 | 277 | direct_rep_costs_min: m["direct_rep_costs_min"], |
| 278 | 278 | end_date: m["end_date"], |
| 279 | 279 | eur_sources_grants: m["eur_sources_grants"], |
| 280 | - eur_sources_grants_src: m["eur_sources_grants_src"], | |
| 280 | + eur_sources_grants_src: Map.fetch!(m, "eur_sources_grants_src"), | |
| 281 | 281 | eur_sources_procurement: m["eur_sources_procurement"], |
| 282 | - eur_sources_procurement_src: m["eur_sources_procurement_src"], | |
| 282 | + eur_sources_procurement_src: Map.fetch!(m, "eur_sources_procurement_src"), | |
| 283 | 283 | id: m["id"], |
| 284 | 284 | new_organisation: m["new_organisation"], |
| 285 | - no_clients: m["no_clients"], | |
| 286 | - other_financial_information: m["other_financial_information"], | |
| 287 | - other_sources_contributions: m["other_sources_contributions"], | |
| 288 | - other_sources_donation: m["other_sources_donation"], | |
| 289 | - other_sources_total: m["other_sources_total"], | |
| 290 | - public_financing_infranational: m["public_financing_infranational"], | |
| 291 | - public_financing_national: m["public_financing_national"], | |
| 292 | - public_financing_total: m["public_financing_total"], | |
| 285 | + no_clients: Map.fetch!(m, "no_clients"), | |
| 286 | + other_financial_information: Map.fetch!(m, "other_financial_information"), | |
| 287 | + other_sources_contributions: Map.fetch!(m, "other_sources_contributions"), | |
| 288 | + other_sources_donation: Map.fetch!(m, "other_sources_donation"), | |
| 289 | + other_sources_total: Map.fetch!(m, "other_sources_total"), | |
| 290 | + public_financing_infranational: Map.fetch!(m, "public_financing_infranational"), | |
| 291 | + public_financing_national: Map.fetch!(m, "public_financing_national"), | |
| 292 | + public_financing_total: Map.fetch!(m, "public_financing_total"), | |
| 293 | 293 | representative: m["representative"], |
| 294 | 294 | start_date: m["start_date"], |
| 295 | 295 | status: Status.decode(m["status"]), |
| 296 | - total_budget: m["total_budget"], | |
| 297 | - turnover_absolute: m["turnover_absolute"], | |
| 298 | - turnover_max: m["turnover_max"], | |
| 299 | - turnover_min: m["turnover_min"], | |
| 296 | + total_budget: Map.fetch!(m, "total_budget"), | |
| 297 | + turnover_absolute: Map.fetch!(m, "turnover_absolute"), | |
| 298 | + turnover_max: Map.fetch!(m, "turnover_max"), | |
| 299 | + turnover_min: Map.fetch!(m, "turnover_min"), | |
| 300 | 300 | type: ResultType.decode(m["type"]), |
| 301 | 301 | updated_at: m["updated_at"], |
| 302 | 302 | uri: m["uri"], |
Test case
1 generated file · +1 −1test/inputs/json/misc/34702.json
Melixirdefault / QuickType.ex+1 −1
| @@ -392,7 +392,7 @@ defmodule FeatureProperties do | ||
| 392 | 392 | latitude: m["latitude"], |
| 393 | 393 | local_govt: m["local_govt"], |
| 394 | 394 | longitude: m["longitude"], |
| 395 | - no: m["no"], | |
| 395 | + no: Map.fetch!(m, "no"), | |
| 396 | 396 | phone: m["phone"], |
| 397 | 397 | postcode: m["postcode"], |
| 398 | 398 | psa: m["psa"], |
Test case
1 generated file · +2 −2test/inputs/json/misc/4d6fb.json
Melixirdefault / QuickType.ex+2 −2
| @@ -652,8 +652,8 @@ defmodule ChildData do | ||
| 652 | 652 | subreddit_type: SubredditType.decode(m["subreddit_type"]), |
| 653 | 653 | suggested_sort: m["suggested_sort"], |
| 654 | 654 | thumbnail: m["thumbnail"], |
| 655 | - thumbnail_height: m["thumbnail_height"], | |
| 656 | - thumbnail_width: m["thumbnail_width"], | |
| 655 | + thumbnail_height: Map.fetch!(m, "thumbnail_height"), | |
| 656 | + thumbnail_width: Map.fetch!(m, "thumbnail_width"), | |
| 657 | 657 | title: m["title"], |
| 658 | 658 | ups: m["ups"], |
| 659 | 659 | url: m["url"], |
Test case
1 generated file · +1 −1test/inputs/json/misc/570ec.json
Melixirdefault / QuickType.ex+1 −1
| @@ -136,7 +136,7 @@ defmodule OtherName do | ||
| 136 | 136 | def from_map(m) do |
| 137 | 137 | %OtherName{ |
| 138 | 138 | name: m["name"], |
| 139 | - note: m["note"], | |
| 139 | + note: Map.fetch!(m, "note"), | |
| 140 | 140 | } |
| 141 | 141 | end |
Test case
1 generated file · +1 −1test/inputs/json/misc/66121.json
Melixirdefault / QuickType.ex+1 −1
| @@ -368,7 +368,7 @@ defmodule TopLevelElement do | ||
| 368 | 368 | links: Enum.map(m["links"], &Link.from_map/1), |
| 369 | 369 | name: m["name"], |
| 370 | 370 | other_names: m["other_names"], |
| 371 | - superseded_by: m["superseded_by"], | |
| 371 | + superseded_by: Map.fetch!(m, "superseded_by"), | |
| 372 | 372 | text: Enum.map(m["text"], &Text.from_map/1), |
| 373 | 373 | } |
| 374 | 374 | end |
Test case
1 generated file · +8 −8test/inputs/json/misc/6de06.json
Melixirdefault / QuickType.ex+8 −8
| @@ -511,8 +511,8 @@ defmodule ChildData do | ||
| 511 | 511 | approved_by: m["approved_by"], |
| 512 | 512 | archived: m["archived"], |
| 513 | 513 | author: m["author"], |
| 514 | - author_flair_css_class: m["author_flair_css_class"], | |
| 515 | - author_flair_text: m["author_flair_text"], | |
| 514 | + author_flair_css_class: Map.fetch!(m, "author_flair_css_class"), | |
| 515 | + author_flair_text: Map.fetch!(m, "author_flair_text"), | |
| 516 | 516 | banned_at_utc: m["banned_at_utc"], |
| 517 | 517 | banned_by: m["banned_by"], |
| 518 | 518 | brand_safe: m["brand_safe"], |
| @@ -533,8 +533,8 @@ defmodule ChildData do | ||
| 533 | 533 | is_self: m["is_self"], |
| 534 | 534 | is_video: m["is_video"], |
| 535 | 535 | likes: m["likes"], |
| 536 | - link_flair_css_class: m["link_flair_css_class"], | |
| 537 | - link_flair_text: m["link_flair_text"], | |
| 536 | + link_flair_css_class: Map.fetch!(m, "link_flair_css_class"), | |
| 537 | + link_flair_text: Map.fetch!(m, "link_flair_text"), | |
| 538 | 538 | locked: m["locked"], |
| 539 | 539 | media: m["media"] && Media.from_map(m["media"]), |
| 540 | 540 | media_embed: MediaEmbed.from_map(m["media_embed"]), |
| @@ -554,17 +554,17 @@ defmodule ChildData do | ||
| 554 | 554 | secure_media: m["secure_media"] && Media.from_map(m["secure_media"]), |
| 555 | 555 | secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]), |
| 556 | 556 | selftext: m["selftext"], |
| 557 | - selftext_html: m["selftext_html"], | |
| 557 | + selftext_html: Map.fetch!(m, "selftext_html"), | |
| 558 | 558 | spoiler: m["spoiler"], |
| 559 | 559 | stickied: m["stickied"], |
| 560 | 560 | subreddit: m["subreddit"], |
| 561 | 561 | subreddit_id: m["subreddit_id"], |
| 562 | 562 | subreddit_name_prefixed: m["subreddit_name_prefixed"], |
| 563 | 563 | subreddit_type: SubredditType.decode(m["subreddit_type"]), |
| 564 | - suggested_sort: m["suggested_sort"], | |
| 564 | + suggested_sort: Map.fetch!(m, "suggested_sort"), | |
| 565 | 565 | thumbnail: m["thumbnail"], |
| 566 | - thumbnail_height: m["thumbnail_height"], | |
| 567 | - thumbnail_width: m["thumbnail_width"], | |
| 566 | + thumbnail_height: Map.fetch!(m, "thumbnail_height"), | |
| 567 | + thumbnail_width: Map.fetch!(m, "thumbnail_width"), | |
| 568 | 568 | title: m["title"], |
| 569 | 569 | ups: m["ups"], |
| 570 | 570 | url: m["url"], |
Test case
1 generated file · +14 −14test/inputs/json/misc/734ad.json
Melixirdefault / QuickType.ex+14 −14
| @@ -147,14 +147,14 @@ defmodule Result do | ||
| 147 | 147 | |
| 148 | 148 | def from_map(m) do |
| 149 | 149 | %Result{ |
| 150 | - acronym: m["acronym"], | |
| 150 | + acronym: Map.fetch!(m, "acronym"), | |
| 151 | 151 | activity_consult_committees: m["activity_consult_committees"], |
| 152 | 152 | activity_eu_legislative: m["activity_eu_legislative"], |
| 153 | 153 | activity_expert_groups: m["activity_expert_groups"], |
| 154 | 154 | activity_high_level_groups: m["activity_high_level_groups"], |
| 155 | 155 | activity_industry_forums: m["activity_industry_forums"], |
| 156 | 156 | activity_inter_groups: m["activity_inter_groups"], |
| 157 | - activity_other: m["activity_other"], | |
| 157 | + activity_other: Map.fetch!(m, "activity_other"), | |
| 158 | 158 | activity_relevant_comm: m["activity_relevant_comm"], |
| 159 | 159 | be_office_country: m["be_office_country"], |
| 160 | 160 | be_office_lat: m["be_office_lat"], |
| @@ -171,11 +171,11 @@ defmodule Result do | ||
| 171 | 171 | goals: m["goals"], |
| 172 | 172 | head: m["head"], |
| 173 | 173 | head_office_country: m["head_office_country"], |
| 174 | - head_office_lat: m["head_office_lat"], | |
| 175 | - head_office_lon: m["head_office_lon"], | |
| 174 | + head_office_lat: Map.fetch!(m, "head_office_lat"), | |
| 175 | + head_office_lon: Map.fetch!(m, "head_office_lon"), | |
| 176 | 176 | head_office_phone: m["head_office_phone"], |
| 177 | - head_office_post_code: m["head_office_post_code"], | |
| 178 | - head_office_postbox: m["head_office_postbox"], | |
| 177 | + head_office_post_code: Map.fetch!(m, "head_office_post_code"), | |
| 178 | + head_office_postbox: Map.fetch!(m, "head_office_postbox"), | |
| 179 | 179 | head_office_street: m["head_office_street"], |
| 180 | 180 | head_office_town: m["head_office_town"], |
| 181 | 181 | id: m["id"], |
| @@ -187,16 +187,16 @@ defmodule Result do | ||
| 187 | 187 | main_category: m["main_category"], |
| 188 | 188 | main_category_title: m["main_category_title"], |
| 189 | 189 | members: m["members"], |
| 190 | - members_100: m["members_100"], | |
| 191 | - members_25: m["members_25"], | |
| 192 | - members_50: m["members_50"], | |
| 193 | - members_75: m["members_75"], | |
| 190 | + members_100: Map.fetch!(m, "members_100"), | |
| 191 | + members_25: Map.fetch!(m, "members_25"), | |
| 192 | + members_50: Map.fetch!(m, "members_50"), | |
| 193 | + members_75: Map.fetch!(m, "members_75"), | |
| 194 | 194 | members_fte: m["members_fte"], |
| 195 | 195 | name: m["name"], |
| 196 | 196 | native_name: m["native_name"], |
| 197 | - networking: m["networking"], | |
| 198 | - number_of_natural_persons: m["number_of_natural_persons"], | |
| 199 | - other_code_of_conduct: m["other_code_of_conduct"], | |
| 197 | + networking: Map.fetch!(m, "networking"), | |
| 198 | + number_of_natural_persons: Map.fetch!(m, "number_of_natural_persons"), | |
| 199 | + other_code_of_conduct: Map.fetch!(m, "other_code_of_conduct"), | |
| 200 | 200 | registration_date: m["registration_date"], |
| 201 | 201 | status: Status.decode(m["status"]), |
| 202 | 202 | structure_members: m["structure_members"], |
| @@ -204,7 +204,7 @@ defmodule Result do | ||
| 204 | 204 | sub_category_title: m["sub_category_title"], |
| 205 | 205 | updated_at: m["updated_at"], |
| 206 | 206 | uri: m["uri"], |
| 207 | - web_site_url: m["web_site_url"], | |
| 207 | + web_site_url: Map.fetch!(m, "web_site_url"), | |
| 208 | 208 | } |
| 209 | 209 | end |
Test case
1 generated file · +1 −1test/inputs/json/misc/7f568.json
Melixirdefault / QuickType.ex+1 −1
| @@ -169,7 +169,7 @@ defmodule TopLevelElement do | ||
| 169 | 169 | comments_url: m["comments_url"], |
| 170 | 170 | commits_url: m["commits_url"], |
| 171 | 171 | created_at: m["created_at"], |
| 172 | - description: m["description"], | |
| 172 | + description: Map.fetch!(m, "description"), | |
| 173 | 173 | files: m["files"] |
| 174 | 174 | |> Map.new(fn {key, value} -> {key, FileValue.from_map(value)} end), |
| 175 | 175 | forks_url: m["forks_url"], |
Test case
1 generated file · +1 −1test/inputs/json/misc/80aff.json
Melixirdefault / QuickType.ex+1 −1
| @@ -54,7 +54,7 @@ defmodule Result do | ||
| 54 | 54 | id: m["id"], |
| 55 | 55 | items: m["items"], |
| 56 | 56 | name: m["name"], |
| 57 | - parent: m["parent"], | |
| 57 | + parent: Map.fetch!(m, "parent"), | |
| 58 | 58 | updated_at: m["updated_at"], |
| 59 | 59 | uri: m["uri"], |
| 60 | 60 | } |
Test case
1 generated file · +5 −5test/inputs/json/misc/8592b.json
Melixirdefault / QuickType.ex+5 −5
| @@ -499,8 +499,8 @@ defmodule ChildData do | ||
| 499 | 499 | approved_by: m["approved_by"], |
| 500 | 500 | archived: m["archived"], |
| 501 | 501 | author: m["author"], |
| 502 | - author_flair_css_class: m["author_flair_css_class"], | |
| 503 | - author_flair_text: m["author_flair_text"], | |
| 502 | + author_flair_css_class: Map.fetch!(m, "author_flair_css_class"), | |
| 503 | + author_flair_text: Map.fetch!(m, "author_flair_text"), | |
| 504 | 504 | banned_at_utc: m["banned_at_utc"], |
| 505 | 505 | banned_by: m["banned_by"], |
| 506 | 506 | brand_safe: m["brand_safe"], |
| @@ -542,7 +542,7 @@ defmodule ChildData do | ||
| 542 | 542 | secure_media: m["secure_media"], |
| 543 | 543 | secure_media_embed: MediaEmbed.from_map(m["secure_media_embed"]), |
| 544 | 544 | selftext: m["selftext"], |
| 545 | - selftext_html: m["selftext_html"], | |
| 545 | + selftext_html: Map.fetch!(m, "selftext_html"), | |
| 546 | 546 | spoiler: m["spoiler"], |
| 547 | 547 | stickied: m["stickied"], |
| 548 | 548 | subreddit: Subreddit.decode(m["subreddit"]), |
| @@ -551,8 +551,8 @@ defmodule ChildData do | ||
| 551 | 551 | subreddit_type: SubredditType.decode(m["subreddit_type"]), |
| 552 | 552 | suggested_sort: SuggestedSort.decode(m["suggested_sort"]), |
| 553 | 553 | thumbnail: m["thumbnail"], |
| 554 | - thumbnail_height: m["thumbnail_height"], | |
| 555 | - thumbnail_width: m["thumbnail_width"], | |
| 554 | + thumbnail_height: Map.fetch!(m, "thumbnail_height"), | |
| 555 | + thumbnail_width: Map.fetch!(m, "thumbnail_width"), | |
| 556 | 556 | title: m["title"], |
| 557 | 557 | ups: m["ups"], |
| 558 | 558 | url: m["url"], |
Test case
1 generated file · +1 −1test/inputs/json/misc/996bd.json
Melixirdefault / QuickType.ex+1 −1
| @@ -326,7 +326,7 @@ defmodule TopLevelElement do | ||
| 326 | 326 | links: Enum.map(m["links"], &Link.from_map/1), |
| 327 | 327 | name: m["name"], |
| 328 | 328 | other_names: m["other_names"], |
| 329 | - superseded_by: m["superseded_by"], | |
| 329 | + superseded_by: Map.fetch!(m, "superseded_by"), | |
| 330 | 330 | text: Enum.map(m["text"], &Text.from_map/1), |
| 331 | 331 | } |
| 332 | 332 | end |
Test case
1 generated file · +1 −1test/inputs/json/misc/9ac3b.json
Melixirdefault / QuickType.ex+1 −1
| @@ -152,7 +152,7 @@ defmodule Result do | ||
| 152 | 152 | id: m["id"], |
| 153 | 153 | last_name: m["last_name"], |
| 154 | 154 | name: m["name"], |
| 155 | - position: m["position"], | |
| 155 | + position: Map.fetch!(m, "position"), | |
| 156 | 156 | status: Status.decode(m["status"]), |
| 157 | 157 | title: m["title"] && Title.decode(m["title"]), |
| 158 | 158 | updated_at: m["updated_at"], |
Test case
1 generated file · +2 −2test/inputs/json/misc/ad8be.json
Melixirdefault / QuickType.ex+2 −2
| @@ -242,7 +242,7 @@ defmodule OtherName do | ||
| 242 | 242 | def from_map(m) do |
| 243 | 243 | %OtherName{ |
| 244 | 244 | name: m["name"], |
| 245 | - note: m["note"], | |
| 245 | + note: Map.fetch!(m, "note"), | |
| 246 | 246 | } |
| 247 | 247 | end |
| 248 | 248 | |
| @@ -422,7 +422,7 @@ defmodule TopLevelElement do | ||
| 422 | 422 | links: Enum.map(m["links"], &Link.from_map/1), |
| 423 | 423 | name: m["name"], |
| 424 | 424 | other_names: Enum.map(m["other_names"], &OtherName.from_map/1), |
| 425 | - superseded_by: m["superseded_by"], | |
| 425 | + superseded_by: Map.fetch!(m, "superseded_by"), | |
| 426 | 426 | text: Enum.map(m["text"], &Text.from_map/1), |
| 427 | 427 | } |
| 428 | 428 | end |
Test case
1 generated file · +2 −2test/inputs/json/misc/ae7f0.json
Melixirdefault / QuickType.ex+2 −2
| @@ -354,8 +354,8 @@ defmodule ChildData do | ||
| 354 | 354 | is_self: m["is_self"], |
| 355 | 355 | is_video: m["is_video"], |
| 356 | 356 | likes: m["likes"], |
| 357 | - link_flair_css_class: m["link_flair_css_class"], | |
| 358 | - link_flair_text: m["link_flair_text"], | |
| 357 | + link_flair_css_class: Map.fetch!(m, "link_flair_css_class"), | |
| 358 | + link_flair_text: Map.fetch!(m, "link_flair_text"), | |
| 359 | 359 | locked: m["locked"], |
| 360 | 360 | media: m["media"], |
| 361 | 361 | 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
| @@ -577,16 +577,16 @@ defmodule FeatureProperties do | ||
| 577 | 577 | add_improv: m["add_improv"] && AddImprov.decode(m["add_improv"]), |
| 578 | 578 | area: m["area_"], |
| 579 | 579 | asset_numb: m["asset_numb"], |
| 580 | - comments: m["comments"], | |
| 580 | + comments: Map.fetch!(m, "comments"), | |
| 581 | 581 | condition: m["condition"], |
| 582 | - constructi: m["constructi"], | |
| 582 | + constructi: Map.fetch!(m, "constructi"), | |
| 583 | 583 | createdate: m["createdate"], |
| 584 | 584 | createuser: m["createuser"], |
| 585 | 585 | disposal_d: m["disposal_d"], |
| 586 | 586 | documents: m["documents"], |
| 587 | - drawing_nu: m["drawing_nu"], | |
| 588 | - file_numbe: m["file_numbe"], | |
| 589 | - folder_num: m["folder_num"], | |
| 587 | + drawing_nu: Map.fetch!(m, "drawing_nu"), | |
| 588 | + file_numbe: Map.fetch!(m, "file_numbe"), | |
| 589 | + folder_num: Map.fetch!(m, "folder_num"), | |
| 590 | 590 | funding_ba: m["funding_ba"] && FundingBa.decode(m["funding_ba"]), |
| 591 | 591 | historic_c: m["historic_c"], |
| 592 | 592 | inspection: m["inspection"], |
| @@ -597,11 +597,11 @@ defmodule FeatureProperties do | ||
| 597 | 597 | mi_prinx: m["mi_prinx"], |
| 598 | 598 | mi_symbolo: MiSymbolo.decode(m["mi_symbolo"]), |
| 599 | 599 | number_lan: m["number_lan"], |
| 600 | - owner: m["owner"], | |
| 600 | + owner: Map.fetch!(m, "owner"), | |
| 601 | 601 | positional: m["positional"] && LevelAccu.decode(m["positional"]), |
| 602 | - project_nu: m["project_nu"], | |
| 602 | + project_nu: Map.fetch!(m, "project_nu"), | |
| 603 | 603 | rec_id: m["rec_id"], |
| 604 | - record_cre: m["record_cre"], | |
| 604 | + record_cre: Map.fetch!(m, "record_cre"), | |
| 605 | 605 | shape_area: m["shape_area"], |
| 606 | 606 | shape_leng: m["shape_leng"], |
| 607 | 607 | status: Status.decode(m["status"]), |
Test case
1 generated file · +2 −2test/inputs/json/misc/be234.json
Melixirdefault / QuickType.ex+2 −2
| @@ -690,7 +690,7 @@ defmodule ChildData do | ||
| 690 | 690 | archived: m["archived"], |
| 691 | 691 | author: m["author"], |
| 692 | 692 | author_flair_css_class: m["author_flair_css_class"], |
| 693 | - author_flair_text: m["author_flair_text"], | |
| 693 | + author_flair_text: Map.fetch!(m, "author_flair_text"), | |
| 694 | 694 | banned_at_utc: m["banned_at_utc"], |
| 695 | 695 | banned_by: m["banned_by"], |
| 696 | 696 | brand_safe: m["brand_safe"], |
| @@ -700,7 +700,7 @@ defmodule ChildData do | ||
| 700 | 700 | contest_mode: m["contest_mode"], |
| 701 | 701 | created: m["created"], |
| 702 | 702 | created_utc: m["created_utc"], |
| 703 | - distinguished: m["distinguished"], | |
| 703 | + distinguished: Map.fetch!(m, "distinguished"), | |
| 704 | 704 | domain: Domain.decode(m["domain"]), |
| 705 | 705 | downs: m["downs"], |
| 706 | 706 | edited: m["edited"], |
Test case
1 generated file · +1 −1test/inputs/json/misc/d23d5.json
Melixirdefault / QuickType.ex+1 −1
| @@ -49,7 +49,7 @@ defmodule Result do | ||
| 49 | 49 | |
| 50 | 50 | def from_map(m) do |
| 51 | 51 | %Result{ |
| 52 | - acronym: m["acronym"], | |
| 52 | + acronym: Map.fetch!(m, "acronym"), | |
| 53 | 53 | created_at: m["created_at"], |
| 54 | 54 | id: m["id"], |
| 55 | 55 | name: m["name"], |
Test case
1 generated file · +2 −2test/inputs/json/misc/f22f5.json
Melixirdefault / QuickType.ex+2 −2
| @@ -309,8 +309,8 @@ defmodule ChildData do | ||
| 309 | 309 | is_self: m["is_self"], |
| 310 | 310 | is_video: m["is_video"], |
| 311 | 311 | likes: m["likes"], |
| 312 | - link_flair_css_class: m["link_flair_css_class"], | |
| 313 | - link_flair_text: m["link_flair_text"], | |
| 312 | + link_flair_css_class: Map.fetch!(m, "link_flair_css_class"), | |
| 313 | + link_flair_text: Map.fetch!(m, "link_flair_text"), | |
| 314 | 314 | locked: m["locked"], |
| 315 | 315 | media: m["media"], |
| 316 | 316 | 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
| @@ -17,8 +17,8 @@ defmodule Invoice do | ||
| 17 | 17 | |
| 18 | 18 | def from_map(m) do |
| 19 | 19 | %Invoice{ |
| 20 | - created_at: m["createdAt"], | |
| 21 | - due_date: m["dueDate"], | |
| 20 | + created_at: Map.fetch!(m, "createdAt"), | |
| 21 | + due_date: Map.fetch!(m, "dueDate"), | |
| 22 | 22 | name: m["name"], |
| 23 | 23 | } |
| 24 | 24 | end |
Test case
1 generated file · +1 −1test/inputs/json/priority/nbl-stats.json
Melixirdefault / QuickType.ex+1 −1
| @@ -875,7 +875,7 @@ defmodule Pl do | ||
| 875 | 875 | s_free_throws_attempted: m["sFreeThrowsAttempted"], |
| 876 | 876 | s_free_throws_made: m["sFreeThrowsMade"], |
| 877 | 877 | s_free_throws_percentage: m["sFreeThrowsPercentage"], |
| 878 | - s_minutes: m["sMinutes"], | |
| 878 | + s_minutes: Map.fetch!(m, "sMinutes"), | |
| 879 | 879 | s_plus_minus_points: m["sPlusMinusPoints"], |
| 880 | 880 | s_points: m["sPoints"], |
| 881 | 881 | s_points_fast_break: m["sPointsFastBreak"], |
Test case
1 generated file · +2 −2test/inputs/json/samples/github-events.json
Melixirdefault / QuickType.ex+2 −2
| @@ -389,7 +389,7 @@ defmodule Milestone do | ||
| 389 | 389 | created_at: m["created_at"], |
| 390 | 390 | creator: User.from_map(m["creator"]), |
| 391 | 391 | description: m["description"], |
| 392 | - due_on: m["due_on"], | |
| 392 | + due_on: Map.fetch!(m, "due_on"), | |
| 393 | 393 | html_url: m["html_url"], |
| 394 | 394 | id: m["id"], |
| 395 | 395 | labels_url: m["labels_url"], |
| @@ -511,7 +511,7 @@ defmodule Issue do | ||
| 511 | 511 | assignee: m["assignee"], |
| 512 | 512 | assignees: m["assignees"], |
| 513 | 513 | body: m["body"], |
| 514 | - closed_at: m["closed_at"], | |
| 514 | + closed_at: Map.fetch!(m, "closed_at"), | |
| 515 | 515 | comments: m["comments"], |
| 516 | 516 | comments_url: m["comments_url"], |
| 517 | 517 | created_at: m["created_at"], |
Test case
1 generated file · +1 −1test/inputs/json/samples/kitchen-sink.json
Melixirdefault / QuickType.ex+1 −1
| @@ -50,7 +50,7 @@ defmodule PersonElement do | ||
| 50 | 50 | |
| 51 | 51 | def from_map(m) do |
| 52 | 52 | %PersonElement{ |
| 53 | - int_or_string: m["intOrString"], | |
| 53 | + int_or_string: Map.fetch!(m, "intOrString"), | |
| 54 | 54 | name: m["name"], |
| 55 | 55 | optional_value: m["optionalValue"], |
| 56 | 56 | } |
Test case
1 generated file · +1 −1test/inputs/json/samples/null-safe.json
Melixirdefault / QuickType.ex+1 −1
| @@ -60,7 +60,7 @@ defmodule Item do | ||
| 60 | 60 | address: m["address"] && Address.from_map(m["address"]), |
| 61 | 61 | created_at: m["created_at"], |
| 62 | 62 | name: m["name"], |
| 63 | - sex: m["sex"], | |
| 63 | + sex: Map.fetch!(m, "sex"), | |
| 64 | 64 | } |
| 65 | 65 | end |
Test case
1 generated file · +5 −5test/inputs/json/samples/reddit.json
Melixirdefault / QuickType.ex+5 −5
| @@ -620,8 +620,8 @@ defmodule ChildData do | ||
| 620 | 620 | approved_by: m["approved_by"], |
| 621 | 621 | archived: m["archived"], |
| 622 | 622 | author: m["author"], |
| 623 | - author_flair_css_class: m["author_flair_css_class"], | |
| 624 | - author_flair_text: m["author_flair_text"], | |
| 623 | + author_flair_css_class: Map.fetch!(m, "author_flair_css_class"), | |
| 624 | + author_flair_text: Map.fetch!(m, "author_flair_text"), | |
| 625 | 625 | banned_at_utc: m["banned_at_utc"], |
| 626 | 626 | banned_by: m["banned_by"], |
| 627 | 627 | brand_safe: m["brand_safe"], |
| @@ -631,7 +631,7 @@ defmodule ChildData do | ||
| 631 | 631 | contest_mode: m["contest_mode"], |
| 632 | 632 | created: m["created"], |
| 633 | 633 | created_utc: m["created_utc"], |
| 634 | - distinguished: m["distinguished"], | |
| 634 | + distinguished: Map.fetch!(m, "distinguished"), | |
| 635 | 635 | domain: Domain.decode(m["domain"]), |
| 636 | 636 | downs: m["downs"], |
| 637 | 637 | edited: m["edited"], |
| @@ -642,8 +642,8 @@ defmodule ChildData do | ||
| 642 | 642 | is_self: m["is_self"], |
| 643 | 643 | is_video: m["is_video"], |
| 644 | 644 | likes: m["likes"], |
| 645 | - link_flair_css_class: m["link_flair_css_class"], | |
| 646 | - link_flair_text: m["link_flair_text"], | |
| 645 | + link_flair_css_class: Map.fetch!(m, "link_flair_css_class"), | |
| 646 | + link_flair_text: Map.fetch!(m, "link_flair_text"), | |
| 647 | 647 | locked: m["locked"], |
| 648 | 648 | media: m["media"], |
| 649 | 649 | 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
| @@ -316,8 +316,8 @@ defmodule Person do | ||
| 316 | 316 | osid: m["osid"], |
| 317 | 317 | pvsid: m["pvsid"], |
| 318 | 318 | sortname: m["sortname"], |
| 319 | - twitterid: m["twitterid"], | |
| 320 | - youtubeid: m["youtubeid"], | |
| 319 | + twitterid: Map.fetch!(m, "twitterid"), | |
| 320 | + youtubeid: Map.fetch!(m, "youtubeid"), | |
| 321 | 321 | } |
| 322 | 322 | end |
| 323 | 323 | |
| @@ -715,7 +715,7 @@ defmodule Object do | ||
| 715 | 715 | district: m["district"], |
| 716 | 716 | enddate: m["enddate"], |
| 717 | 717 | extra: Extra.from_map(m["extra"]), |
| 718 | - leadership_title: m["leadership_title"], | |
| 718 | + leadership_title: Map.fetch!(m, "leadership_title"), | |
| 719 | 719 | party: Party.decode(m["party"]), |
| 720 | 720 | person: Person.from_map(m["person"]), |
| 721 | 721 | phone: m["phone"], |
Test case
1 generated file · +1 −1test/inputs/schema/accessors.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -68,7 +68,7 @@ defmodule TopLevel do | ||
| 68 | 68 | barre: m["bar"], |
| 69 | 69 | enumerification: EnumEnum.decode(m["enum"]), |
| 70 | 70 | foo: m["foo"], |
| 71 | - unionization: m["union"], | |
| 71 | + unionization: Map.fetch!(m, "union"), | |
| 72 | 72 | } |
| 73 | 73 | end |
Test case
1 generated file · +3 −3test/inputs/schema/bool-string.schema
Mschema-elixirdefault / QuickType.ex+3 −3
| @@ -31,11 +31,11 @@ defmodule TopLevel do | ||
| 31 | 31 | %TopLevel{ |
| 32 | 32 | arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), |
| 33 | 33 | arr_one: m["arrOne"], |
| 34 | - nullable: m["nullable"], | |
| 34 | + nullable: Map.fetch!(m, "nullable"), | |
| 35 | 35 | one: m["one"], |
| 36 | 36 | optional: m["optional"], |
| 37 | - union_with_bool: m["unionWithBool"], | |
| 38 | - union_with_bool_and_enum: m["unionWithBoolAndEnum"], | |
| 37 | + union_with_bool: Map.fetch!(m, "unionWithBool"), | |
| 38 | + union_with_bool_and_enum: Map.fetch!(m, "unionWithBoolAndEnum"), | |
| 39 | 39 | } |
| 40 | 40 | end |
Test case
1 generated file · +1 −1test/inputs/schema/description.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -125,7 +125,7 @@ defmodule TopLevel do | ||
| 125 | 125 | enum: EnumEnum.decode(m["enum"]), |
| 126 | 126 | foo: m["foo"], |
| 127 | 127 | object_or_string: decode_object_or_string(m["object-or-string"]), |
| 128 | - union: m["union"], | |
| 128 | + union: Map.fetch!(m, "union"), | |
| 129 | 129 | } |
| 130 | 130 | end |
Test case
1 generated file · +3 −3test/inputs/schema/integer-string.schema
Mschema-elixirdefault / QuickType.ex+3 −3
| @@ -31,11 +31,11 @@ defmodule TopLevel do | ||
| 31 | 31 | %TopLevel{ |
| 32 | 32 | arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), |
| 33 | 33 | arr_one: m["arrOne"], |
| 34 | - nullable: m["nullable"], | |
| 34 | + nullable: Map.fetch!(m, "nullable"), | |
| 35 | 35 | one: m["one"], |
| 36 | 36 | optional: m["optional"], |
| 37 | - union_with_int: m["unionWithInt"], | |
| 38 | - union_with_int_and_enum: m["unionWithIntAndEnum"], | |
| 37 | + union_with_int: Map.fetch!(m, "unionWithInt"), | |
| 38 | + union_with_int_and_enum: Map.fetch!(m, "unionWithIntAndEnum"), | |
| 39 | 39 | } |
| 40 | 40 | end |
Test case
1 generated file · +1 −1test/inputs/schema/minmaxlength.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -23,7 +23,7 @@ defmodule TopLevel do | ||
| 23 | 23 | def from_map(m) do |
| 24 | 24 | %TopLevel{ |
| 25 | 25 | intersection: m["intersection"], |
| 26 | - in_union: m["inUnion"], | |
| 26 | + in_union: Map.fetch!(m, "inUnion"), | |
| 27 | 27 | maxlength: m["maxlength"], |
| 28 | 28 | minlength: m["minlength"], |
| 29 | 29 | min_max_intersection: m["minMaxIntersection"], |
Test case
1 generated file · +39 −0test/inputs/schema/strict-optional.schema
Aschema-elixirdefault / QuickType.ex+39 −0
| @@ -0,0 +1,39 @@ | ||
| 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 TopLevel do | |
| 9 | + @enforce_keys [:foo] | |
| 10 | + defstruct [:foo] | |
| 11 | + | |
| 12 | + @type t :: %__MODULE__{ | |
| 13 | + foo: float() | nil | |
| 14 | + } | |
| 15 | + | |
| 16 | + def from_map(m) do | |
| 17 | + %TopLevel{ | |
| 18 | + foo: Map.fetch!(m, "foo"), | |
| 19 | + } | |
| 20 | + end | |
| 21 | + | |
| 22 | + def from_json(json) do | |
| 23 | + json | |
| 24 | + |> Jason.decode!() | |
| 25 | + |> from_map() | |
| 26 | + end | |
| 27 | + | |
| 28 | + def to_map(struct) do | |
| 29 | + %{ | |
| 30 | + "foo" => struct.foo, | |
| 31 | + } | |
| 32 | + end | |
| 33 | + | |
| 34 | + def to_json(struct) do | |
| 35 | + struct | |
| 36 | + |> to_map() | |
| 37 | + |> Jason.encode!() | |
| 38 | + end | |
| 39 | +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: m["value"], | |
| 18 | + 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
| @@ -30,7 +30,7 @@ defmodule TopLevel do | ||
| 30 | 30 | %TopLevel{ |
| 31 | 31 | arr_nullable: m["arrNullable"] && Enum.map(m["arrNullable"], &decode_arr_nullable_element/1), |
| 32 | 32 | arr_one: m["arrOne"], |
| 33 | - nullable: m["nullable"], | |
| 33 | + nullable: Map.fetch!(m, "nullable"), | |
| 34 | 34 | one: m["one"], |
| 35 | 35 | optional: m["optional"], |
| 36 | 36 | union_with_enum: m["unionWithEnum"], |
Test case
1 generated file · +1 −1test/inputs/schema/vega-lite.schema
Mschema-elixirdefault / QuickType.ex+1 −1
| @@ -4504,7 +4504,7 @@ defmodule ConditionalValueDef do | ||
| 4504 | 4504 | def from_map(m) do |
| 4505 | 4505 | %ConditionalValueDef{ |
| 4506 | 4506 | test: decode_test(m["test"]), |
| 4507 | - value: m["value"], | |
| 4507 | + value: Map.fetch!(m, "value"), | |
| 4508 | 4508 | selection: decode_selection(m["selection"]), |
| 4509 | 4509 | } |
| 4510 | 4510 | end |
No generated files match these filters.