Skip to content
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

Library converts underscores to hyphens against spec #24

Open
jimbobhickville opened this issue Aug 20, 2016 · 3 comments
Open

Library converts underscores to hyphens against spec #24

jimbobhickville opened this issue Aug 20, 2016 · 3 comments

Comments

@jimbobhickville
Copy link

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 vs data.attributes['some-field']

http://jsonapi.org/format/#document-member-names-allowed-characters

@ColtonProvias
Copy link
Owner

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.

@ColtonProvias
Copy link
Owner

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.

@jimbobhickville
Copy link
Author

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.

jimbobhickville pushed a commit to jimbobhickville/sqlalchemy-jsonapi that referenced this issue Aug 27, 2016
The spec doesn't require it, although it is recommended.
I personally don't want the behavior because I want
my client attributes to match those in the database.

Fixes ColtonProvias#24
jimbobhickville pushed a commit to jimbobhickville/sqlalchemy-jsonapi that referenced this issue Aug 28, 2016
The spec doesn't require it, although it is recommended.
I personally don't want the behavior because I want
my client attributes to match those in the database.

Fixes ColtonProvias#24
jimbobhickville pushed a commit to jimbobhickville/sqlalchemy-jsonapi that referenced this issue Aug 28, 2016
The spec doesn't require it, although it is recommended.
I personally don't want the behavior because I want
my client attributes to match those in the database.

Fixes ColtonProvias#24
jimbobhickville pushed a commit to jimbobhickville/sqlalchemy-jsonapi that referenced this issue Aug 28, 2016
The spec doesn't require it, although it is recommended.
I personally don't want the behavior because I want
my client attributes to match those in the database.

Fixes ColtonProvias#24
jimbobhickville pushed a commit to jimbobhickville/sqlalchemy-jsonapi that referenced this issue Mar 8, 2017
The spec doesn't require it, although it is recommended.
I personally don't want the behavior because I want
my client attributes to match those in the database.

Fixes ColtonProvias#24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants