-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
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
Custom type doesn't work as the inner type of a map. #3062
Comments
Unfortunately this is expected behaviour. Map types are serialized using the JSON encoder directly - they don't go through the regular I also don't believe this is a regression - the behaviour in this area didn't change between Ecto 2 and Ecto 3. Lines 1473 to 1484 in 854d58e
|
@lucasmazza has also requested this feature and it is also an issue here: danielberkompas/cloak#84 My proposed solution is to introduce a new |
This is now in master. |
Environment
Current behavior
When I migrated our project from Ecto 2 to 3 I ran into one issue. I can't use a custom Ecto type as the
inner_type
of a map in{:map, inner_type}
. It used to work well with Ecto 2 and I think it might be a regression bug. The custom type that I made stupidly gets rid of NULL bytes from string inputs. I created a small application with tests that reproduces it: https://github.com/mrcnkoba/ecto_3_maybe_bug. In order to reproduce it please:My custom type is here: https://github.com/mrcnkoba/ecto_3_maybe_bug/blob/master/lib/ecto3customtypemap/pgstring.ex
As a result I'm getting:
Expected behavior
Record should be inserted into the database without a NULL byte.
The text was updated successfully, but these errors were encountered: