diff --git a/README.md b/README.md index c5b069b..1151552 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ UserContract.conform(%{text: "HELLO"}) ### Atomized maps -You can define a schema that will atomize the input map using `atomize: true` option: +You can define a schema that will atomize the input map using `atomize: true` option. Only keys that you specified will be atomized, any unexpected key will be ignored. Here's an example: ```elixir defmodule UserContract do @@ -264,6 +264,8 @@ defmodule UserContract do end UserContract.conform(%{ + "unexpected" => "value", + "this" => "should not be here", "name" => "Jane", "age" => 21, "tags" => [ @@ -272,6 +274,13 @@ UserContract.conform(%{ %{"name" => "blue"} ] }) +# {:ok, +# %{ +# name: "Jane", +# age: 21, +# tags: [%{name: "red"}, %{name: "green"}, %{name: "blue"}] +# }} + # {:ok, # %{ # name: "Jane", diff --git a/examples/readme/schemas-07.ex b/examples/readme/schemas-07.ex index 563c660..f5756d4 100644 --- a/examples/readme/schemas-07.ex +++ b/examples/readme/schemas-07.ex @@ -14,6 +14,8 @@ defmodule UserContract do end UserContract.conform(%{ + "unexpected" => "value", + "this" => "should not be here", "name" => "Jane", "age" => 21, "tags" => [