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

v2: allowing a strict next to the human api #36

Merged
merged 62 commits into from
Mar 3, 2019
Merged

v2: allowing a strict next to the human api #36

merged 62 commits into from
Mar 3, 2019

Conversation

lode
Copy link
Owner

@lode lode commented Jan 13, 2019

This is a work-in-progress for an upcoming v2. The main feature is having a strict specification-based interface for building documents, next to keeping the human friendly interface for people who don't (want to get to) know the spec.

This will very probably be a backwards compatibility breaking release, although I'm thinking about a runtime migration.

It is also more ready for jsonapi 1.1, but that's not the purpose of this PR.

Any feedback is welcome! Both on what would be nice changes since we already break BC, and on how the v2 WIP could be improved.

use `AttributesObject` to manage attribute api
use `::fromX()` instead `->setX()` to fill with array
use `->toArray()` instead of guessing another object's structure
use `->add()` instead `->addData()` for adding primary properties
move validation and conversion to centralized place
fix ErrorsDocument containing an object with one ErrorObject instead of an array with multiple
fix sending http response body if status code was `204 No Content`
define interfaces for documents and objects
- simplify checking & marking used fields, testing showed forgetting marking, or mark+check in wrong order, gives unexpected results
- fix one use-statement bug
- use scripts to rule them all
also make it easier to add a self link at a resource document's root level
also make sure relationships output an empty data property if no resource(s) is set
also make clear included resources can be added when they can't be determined from the relations being added
also don't add a /errors/0/title for exceptions as we only used /errors/0/code before
indent left for diff readability, cleanup in next commit
start with a verb, tell what we do, not what we don't
@lode lode merged commit 399f5da into master Mar 3, 2019
@lode lode deleted the 2.0.0 branch March 3, 2019 11:20
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.

None yet

1 participant