ja_serializer icon indicating copy to clipboard operation
ja_serializer copied to clipboard

deep_format_keys implementation & mix release duplication error

Open jgelens opened this issue 4 years ago • 3 comments

I have been using the solution to implement nested formatting found here: #302 This is serving me very well for a while now.

However, just now I tried to release my app using mix release and ran in the following problem:

** (Mix) Duplicated modules:
        'Elixir.JaSerializer.Formatter.JaSerializer.Builder.Attribute' specified in foo_web and ja_serializer

Is there an easy way to fix or circumvent this?

jgelens avatar Sep 27 '19 00:09 jgelens

I admittedly have not tried the code suggested in the PR you referenced, so I'm not sure off-hand what the issue might be. What is foo_web? Is that defining a module with that name?

beerlington avatar Sep 27 '19 12:09 beerlington

That's the (censored) name of my Phoenix application. Tasks.Release (https://hexdocs.pm/mix/Mix.Tasks.Release.html) detects the conflict, probably because the same module is declared in different files in the same build (in my app and in ja_serializer itself). Running Phoenix the usual way (without using Releases) works fine.

Whenever I copy the code (same as in the referenced PR) to a forked version of ja_serializer mix release works perfectly as well.

The reason why I'm using the code in that PR is that ja_serializer does format a nested Map when reading the params: https://github.com/vt-elixir/ja_serializer/blob/master/lib/ja_serializer/param_parser.ex#L25. The other way around, however, doesn't apply the formatting for Map attributes.

jgelens avatar Sep 27 '19 12:09 jgelens

Maybe @broodfusion might know?

beerlington avatar Sep 27 '19 15:09 beerlington