yury-dymov / json-api-normalizer

Normalize JSON API data for redux applications
MIT License
576 stars 40 forks source link

Support "meta" data on "resources" #26

Closed GregPeden closed 6 years ago

GregPeden commented 6 years ago

This adds support for "meta" property on a relationship, improving support per the API spec. It is included as part of the normalized result.

"camelCase" is applied to the relationship metadata. I note that it is NOT applied to the resource-level "meta" property. To me it seems inconsistent to apply this to everything except the meta fields, however to change the existing on the resource-level "meta" would be a breaking change. So I have not applied it there but I would endorse it and would be willing to implement it myself.

Handling of array structures within "camelizeNestedKeys" is added. I note this because this change is hidden within the simultaneous move of the function up the script to pass one of the lint tests.

I also implemented cross-env on the npm scripts so that I could run them in Windows. This should not materially affect anything and is good practice when chaining terminal commands, which is not natively supported in Windows.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.03%) to 99.213% when pulling 3d68c0baa8ee9b0aa7afbad229df6fbb65f1252c on SirLamer:feature/relationship-metadata into 7de592e5383e08fb976b9d67f1963e95f75d928c on yury-dymov:master.

GregPeden commented 6 years ago

See: https://github.com/yury-dymov/json-api-normalizer/issues/25

yury-dymov commented 6 years ago

Looks great, thank you!