vt-elixir / ja_serializer

JSONAPI.org Serialization in Elixir.
Other
640 stars 148 forks source link

deep_format_keys implementation & mix release duplication error #330

Open jgelens opened 5 years ago

jgelens commented 5 years ago

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?

beerlington commented 5 years ago

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?

jgelens commented 5 years ago

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.

beerlington commented 5 years ago

Maybe @broodfusion might know?