polymorphic_embeds_one(:channel,
types: [
known_channel: ... # some atom
]
)
You will receive this error:
** (ArgumentError) errors were found at the given arguments:
* 1st argument: not an already existing atom
code: SomeSchema.load(invalid_payload)
stacktrace:
:erlang.binary_to_existing_atom("an_unknown_channel", :utf8)
(polymorphic_embed 3.0.3) lib/polymorphic_embed.ex:389: PolymorphicEmbed.maybe_to_existing_atom/1
(polymorphic_embed 3.0.3) lib/polymorphic_embed.ex:383: PolymorphicEmbed.get_metadata_for_type/2
(polymorphic_embed 3.0.3) lib/polymorphic_embed.ex:349: PolymorphicEmbed.do_get_polymorphic_module_for_type/2
(polymorphic_embed 3.0.3) lib/polymorphic_embed.ex:156: PolymorphicEmbed.cast_polymorphic_embeds_one/5
I believe this is due to the changes in 3.0.3 that introduce String.to_existing_atom(...). This raises on no found atom, but this library shouldn't raise an error unless you have on_not_found: :raise set.
Hello!
As of
3.0.3
, if I pass into a schema with:
You will receive this error:
I believe this is due to the changes in
3.0.3
that introduceString.to_existing_atom(...)
. This raises on no found atom, but this library shouldn't raise an error unless you haveon_not_found: :raise
set.