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
Pluralized types global opt-in #225
Pluralized types global opt-in #225
Conversation
Reference issue: #118 Allow API to produce pluralized types rather than having to configure each serializer one by one.
@@ -212,19 +212,23 @@ defmodule JaSerializer.Serializer do | |||
|
|||
defp define_default_type(module) do | |||
type_from_module = module | |||
|> Atom.to_string | |||
|> String.split(".") | |||
|> Module.split() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a small refactor here
|> List.last | ||
|> String.replace("Serializer", "") | ||
|> String.replace("View", "") | ||
|> JaSerializer.Formatter.Utils.format_type | ||
|> JaSerializer.Formatter.Utils.format_type() | ||
|> pluralize_type(Application.get_env(:ja_serializer, :pluralize_types)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could debate on if the pluralization should happen before or after the formatting
Your up early! I am totally fine with making this configurable, thanks @bcardarella. |
@alanpeabody can we get a release cut for this? Last time a release was deployed was Feb 19. |
🙏 @alanpeabody a new release on hex.pm would be a great help |
Reference issue: #118
Allow API to produce pluralized types rather than having to configure
each serializer one by one.