More ways to specify embedded schema module#18
More ways to specify embedded schema module#18pzingg wants to merge 1 commit intomathieuprog:masterfrom
Conversation
lookup_type tests
|
Quite some work had to be done before I could look into this PR. I think we're definitely interested into adding this PR in the codebase. That's some quality work. I guess you depend on your fork now? As there has been a lot of code refactoring in the meanwhile, would you be interested to bring these new functionalities into the current master code? |
|
This seems like a great feature that will make the library very dynamic. Any plans to merge this. What are the changes required to get this merged? |
|
The contributor created this PR while I was writing some major refactor when the library was in alpha. It was created in November 2020 so the code changed quite a lot since then. |
|
I haven't looked through this PR, but I would find it useful (and more common in my experience) if the field that qualified the polymorphism were outside the arguments. For example, I might have a database with columns for I worked around this by adding an This works, but it feels a bit awkward because it cannot rely on the usual |
I was working on a library that uses polymorphic embeds. Since it's a library that is used by applications, it cannot know all the polymorphic types ahead of time. This PR adds two more ways of specifying the
:typesoption for aPolymorphicEmbedEcto type: a lookup function that translates between "type" keys and schema modules, and a:by_modulemethod that means that the type key atom (or a string version) IS the module.Feel free to ignore, edit or implement this another way.
I added two more embeds to the test Reminder module, added a number of tests, and added instructions in the README file.