json_api_assert
json_api_assert copied to clipboard
Serializer type defaults to underscore, not dash
This is a bit pedantic, but ja_serializer and ember-data default to dasherized types per json-api.org recommendation although the spec allows for both. I'm currently specifying the type with s/2 to get around this. Any reason for this? If not I'll throw a PR your way to add to my growing list. 😅
I'd prefer to not impose opinions on the serializer and have it just 1-to-1. However, we could offer an option to force to underscore
s(data, underscore: true)
We could take a step further and pull from the App config if you don't want to set this for every function call
config :json_api_assert, key_transform: fn(key) -> String.replace(key, "_", "-") end
I think I like the App config solution a bit more. I assume, possibly naively, that in most cases if someone has to change a serialized attribute once they'll have to do it multiple times.