We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would be nice to have something akin to the
%{"nestedField" => %{id: 1}} |> Poison.decode! as: %Model{nested_field: [%Nested{}]}
See https://github.com/devinus/poison/pull/58/files
The text was updated successfully, but these errors were encountered:
Hi, and thanks for the feature request! I like the syntax you've proposed, so I am going to use this as the active issue for this feature.
Sorry, something went wrong.
Did this feature ever land?
It never did -- it wasn't a pain point here at Appcues, so we never ended up implementing this directly.
Since the constructor created by ExConstructor is marked by defoverridable, the super keyword can be used to the same effect:
defoverridable
super
iex(3)> defmodule Inner do ...(3)> defstruct [:b] ...(3)> use ExConstructor ...(3)> end {:module, Inner, <<...>>, :ok} iex(4)> defmodule Outer do ...(4)> defstruct [:a, :inner] ...(4)> use ExConstructor ...(4)> def new(map) do ...(4)> struct = super(map) ...(4)> %{struct | inner: Inner.new(struct.inner)} ...(4)> end ...(4)> end {:module, Outer, <<...>>, :ok} iex(5)> Outer.new(%{a: 1, inner: %{b: 99}}) %Outer{a: 1, inner: %Inner{b: 99}}
No branches or pull requests
Would be nice to have something akin to the
See https://github.com/devinus/poison/pull/58/files
The text was updated successfully, but these errors were encountered: