Open jimbobhickville opened 8 years ago
I personally prefer underscores over dasherized. However, some of the community around JSON API (especially Ember Data) has taken to using hyphens instead of underscores. As the majority of the users of this project use Ember Data, I went with hyphens just to ease setup.
Since 5.0.0 is the next major release and as it is a breaking release, I'll let it be more freeform on attribute names and such.
Actually, looking into it further, the use of hyphens is actually recommended.
http://jsonapi.org/recommendations/#naming
I'll make it overridable in the next version with default being hyphens.
Ah, I didn't see that. I can put up a PR to let you override the default behavior if that's cool with you. I have a fork where I just took out dasherize entirely because it was causing me a lot of pain (I'm not using Ember). I can fix it to make it configurable.
The spec allows for member names with underscores, but this library converts them to hyphens. I'd prefer that it at least be configurable to not do that, since it makes it annoying to pull the data out in Javascript:
data.attributes.some_field
vsdata.attributes['some-field']
http://jsonapi.org/format/#document-member-names-allowed-characters