Configure type detection strategies for PolymorphicEmbed
masterThe :types option in polymorphic_embeds_one/2 or polymorphic_embeds_many/2 defines how the library identifies which schema to use. There are two main strategies:
Explicit Type Parameter: Map an atom to a module. The library expects a
"__type__"(or:__type__) parameter in the input data containing the type atom (e.g.,"email"). Example:[sms: MyApp.Channel.SMS]Field-based Identification: Map an atom to a keyword list containing the module and
identify_by_fields. The library determines the type based on the presence of these fields in the data, removing the need for a"__type__"parameter. Example:[email: [module: MyApp.Channel.Email, identify_by_fields: [:address, :confirmed]]]
Note: A "__type__" parameter will take precedence over field-based identification.