diff --git a/README.md b/README.md index fb390fb9..963397d9 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,6 @@ Under-the-hood `JSONAPI.EnsureSpec` relies on three individual plugs: config :jsonapi, host: "www.someotherhost.com", scheme: "https", - underscore_to_dash: true, # DEPRECATED field_transformation: :underscore, remove_links: false, json_library: Jason @@ -151,9 +150,6 @@ config :jsonapi, `"favorite-color": blue`). If your API uses dashed fields, set this value to `:dasherize`. If your API uses underscores (e.g. `"favorite_color": "red"`) set to `:underscore`. -- **underscore_to_dash**. This is a deprecated option that previously defaulted - to `false`. Please set the appropriate value on the `field_transformation` - configuration option. ## Other diff --git a/lib/jsonapi/deprecation.ex b/lib/jsonapi/deprecation.ex index ed769803..4d8b6d28 100644 --- a/lib/jsonapi/deprecation.ex +++ b/lib/jsonapi/deprecation.ex @@ -27,11 +27,4 @@ defmodule JSONAPI.Deprecation do Macro.Env.stacktrace(__ENV__) ) end - - def warn(:underscore_to_dash) do - IO.warn( - "`:underscore_to_dash` is deprecated. If you want underscored fields, set `:field_transformation` to :underscore. If you want your fields to be dashed, set to :dasherized", - Macro.Env.stacktrace(__ENV__) - ) - end end diff --git a/lib/jsonapi/utils/string.ex b/lib/jsonapi/utils/string.ex index 55ade066..0a1ec247 100644 --- a/lib/jsonapi/utils/string.ex +++ b/lib/jsonapi/utils/string.ex @@ -179,18 +179,6 @@ defmodule JSONAPI.Utils.String do fun.(value) end - defp normalized_underscore_to_dash_config(value) when is_boolean(value) do - Deprecation.warn(:underscore_to_dash) - - if value do - :dasherize - else - :underscore - end - end - - defp normalized_underscore_to_dash_config(value) when is_nil(value), do: value - @doc """ The configured transformation for the API's fields. JSON:API v1.1 recommends using camlized fields (e.g. "goodDog", versus "good_dog"). However, we don't hold a strong @@ -219,8 +207,7 @@ defmodule JSONAPI.Utils.String do ``` """ def field_transformation do - normalized_underscore_to_dash_config(Application.get_env(:jsonapi, :underscore_to_dash)) || - field_transformation(Application.get_env(:jsonapi, :field_transformation)) + field_transformation(Application.get_env(:jsonapi, :field_transformation)) end @doc false diff --git a/test/utils/string_test.exs b/test/utils/string_test.exs index 512f5fea..3f913a9a 100644 --- a/test/utils/string_test.exs +++ b/test/utils/string_test.exs @@ -6,36 +6,4 @@ defmodule JSONAPI.Utils.StringTest do import JSONAPI.Utils.String doctest JSONAPI.Utils.String - - describe "legacy configuration to dasherize fields" do - setup do - Application.put_env(:jsonapi, :underscore_to_dash, true) - - on_exit(fn -> - Application.delete_env(:jsonapi, :underscore_to_dash) - end) - - {:ok, []} - end - - test "#field_transformation/0 returns :dasherize" do - assert field_transformation() == :dasherize - end - end - - describe "legacy configuration to underscore fields" do - setup do - Application.put_env(:jsonapi, :underscore_to_dash, false) - - on_exit(fn -> - Application.delete_env(:jsonapi, :underscore_to_dash) - end) - - {:ok, []} - end - - test "#field_transformation/0 returns :underscore" do - assert field_transformation() == :underscore - end - end end