8000 [Refactor] Update package to use camel-case field names by lindyhopchris · Pull Request #530 · cloudcreativity/laravel-json-api · GitHub
[go: up one dir, main page]

Skip to content

[Refactor] Update package to use camel-case field names #530

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

Merged
merged 3 commits into from
Jul 23, 2020

Conversation

lindyhopchris
Copy link
Member

When this package was first being developed, the JSON API spec recommended dash-case (e.g. created-at) for resource member names. This recommendation has since changed, and camel-case is now recommended (e.g. createdAt).

This PR goes through the package an amends it to follow the most up-to-date recommendation of camel-case. There are actually very few implications on the package. These are:

  • For the SoftDeletesModel trait, the default soft deletes field is now the camel-case version of the model column, not the dash case. Developers can easily continue to use dash-case by setting the softDeleteField on their adapters.
  • The stub for the Eloquent schema now uses camel-case for createdAt and updatedAt. If the developer is using dash-case, it is exceptionally simple to amend those two field names once the resource is generated.

Because of the soft deletes change, this is a breaking change so will have to be released in the next major version (3.0).

Closes #393

@lindyhopchris lindyhopchris merged commit 239db6e into develop Jul 23, 2020
@lindyhopchris lindyhopchris deleted the camelize branch July 23, 2020 09:05
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

Successfully merging this pull request may close these issues.

Camel-case member names by default
1 participant
0