Skip to content

Commit 034391d

Browse files
committed
Rewrite
1 parent eba1d84 commit 034391d

File tree

185 files changed

+18816
-31666
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+18816
-31666
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.html]
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{yml,yaml}]
18+
indent_size = 2

.github/workflows/docs.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
name: Deploy Docs
22

33
on:
4+
workflow_dispatch: {}
45
push:
5-
branches: [ master ]
6+
branches: [main]
67

78
jobs:
8-
build-and-deploy:
9-
9+
deploy:
1010
runs-on: ubuntu-latest
11-
11+
permissions:
12+
pages: write
13+
id-token: write
14+
environment:
15+
name: github-pages
16+
url: ${{ steps.deployment.outputs.page_url }}
1217
steps:
13-
- uses: actions/checkout@v2
14-
15-
- name: vuepress-deploy
16-
uses: jenkey2011/vuepress-deploy@master
17-
env:
18-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
19-
TARGET_REPO: tobyzerner/json-api-server
20-
TARGET_BRANCH: gh-pages
21-
BUILD_SCRIPT: npm i && npm run docs:build
22-
BUILD_DIR: docs/.vuepress/dist/
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
- uses: actions/setup-node@v3
22+
with:
23+
node-version: 16
24+
cache: npm
25+
- run: npm ci
26+
- name: Build
27+
run: npm run docs:build
28+
- uses: actions/configure-pages@v2
29+
- uses: actions/upload-pages-artifact@v1
30+
with:
31+
path: docs/.vitepress/dist
32+
- name: Deploy
33+
id: deployment
34+
uses: actions/deploy-pages@v1

.github/workflows/php.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/prettier.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Prettier
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
prettier:
7+
runs-on: ubuntu-latest
8+
9+
permissions:
10+
contents: write
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
# Make sure the actual branch is checked out when running on pull requests
16+
ref: ${{ github.head_ref }}
17+
fetch-depth: 0
18+
19+
- uses: creyD/[email protected]
20+
with:
21+
prettier_options: --write .
22+
prettier_plugins: '@prettier/plugin-php'
23+
only_changed: true
24+
commit_message: 'Run Prettier'

.github/workflows/tests.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
php-versions: ['8.1', '8.2']
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ matrix.php-versions }}
20+
extensions: json
21+
coverage: none
22+
23+
- name: Install dependencies
24+
run: composer install --prefer-dist
25+
26+
- name: Run test suite
27+
run: composer run-script test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ composer.lock
22
vendor
33
node_modules
44
.phpunit.result.cache
5+
.vitepress/dist
6+
.vitepress/cache

.phpunit.cache/test-results

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
vendor
3+
pnpm-lock.yaml

.prettierrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"singleQuote": true,
3+
"printWidth": 100,
4+
"proseWrap": "always",
5+
"phpVersion": "8.1",
6+
"plugins": [
7+
"@prettier/plugin-php"
8+
],
9+
"overrides": [
10+
{
11+
"files": "docs/**/*",
12+
"options": {
13+
"printWidth": 80
14+
}
15+
}
16+
]
17+
}

CHANGELOG.md

Lines changed: 60 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,78 +6,99 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [0.2.0] - 2022-06-21
9+
910
### Fixed
10-
- Fix `EloquentAdapter::filterByIds()` getting key name from query model instead of adapter model
11-
- Fix deprecation notice on PHP 8.1
11+
12+
- Fix `EloquentAdapter::filterByIds()` getting key name from query model instead of adapter model
13+
- Fix deprecation notice on PHP 8.1
1214

1315
## [0.2.0-beta.6] - 2022-04-22
16+
1417
### Changed
15-
- Add support for `doctrine/inflector:^2.0`
18+
19+
- Add support for `doctrine/inflector:^2.0`
1620

1721
## [0.2.0-beta.5] - 2022-01-03
22+
1823
### Added
19-
- `Context::getBody()` method to retrieve the parsed JSON:API payload from the request
20-
- `Context::sortRequested()` method to determine if a sort field has been requested
24+
25+
- `Context::getBody()` method to retrieve the parsed JSON:API payload from the request
26+
- `Context::sortRequested()` method to determine if a sort field has been requested
2127

2228
### Fixed
23-
- `Laravel\rules()`: Fix regression disallowing use of advanced validation rules like callbacks and `Rule` instances. (@SychO9)
29+
30+
- `Laravel\rules()`: Fix regression disallowing use of advanced validation rules like callbacks and `Rule` instances. (@SychO9)
2431

2532
## [0.2.0-beta.4] - 2021-09-05
33+
2634
### Added
27-
- `Laravel\rules()`: Replace `{id}` placeholder in rules with the model's key.
28-
- This is useful for the `unique` rule, for example: `unique:users,email,{id}`
29-
- `Laravel\can()`: Pass through additional arguments to Gate check.
30-
- This is needed to use policy methods without models, for example: `can('create', Post::class)`
35+
36+
- `Laravel\rules()`: Replace `{id}` placeholder in rules with the model's key.
37+
- This is useful for the `unique` rule, for example: `unique:users,email,{id}`
38+
- `Laravel\can()`: Pass through additional arguments to Gate check.
39+
- This is needed to use policy methods without models, for example: `can('create', Post::class)`
3140

3241
### Changed
33-
- Get a fresh copy of the model to display after create/update to ensure consistency
34-
- Respond with `400 Bad Request` when attempting to filter on an attribute of a polymorphic relationship
42+
43+
- Get a fresh copy of the model to display after create/update to ensure consistency
44+
- Respond with `400 Bad Request` when attempting to filter on an attribute of a polymorphic relationship
3545

3646
## [0.2.0-beta.3] - 2021-09-03
47+
3748
### Fixed
38-
- Fix dependency on `http-accept` now that a version has been tagged
39-
- Change `EloquentAdapter` to load relationships using `load` instead of `loadMissing`, as they may need API-specific scopes applied
49+
50+
- Fix dependency on `http-accept` now that a version has been tagged
51+
- Change `EloquentAdapter` to load relationships using `load` instead of `loadMissing`, as they may need API-specific scopes applied
4052

4153
## [0.2.0-beta.2] - 2021-09-01
54+
4255
### Added
43-
- Content-Type validation and Accept negotiation
44-
- Include `jsonapi` object with `version` member in response
45-
- Validate implementation-specific query parameters according to specification
46-
- Added `Location` header to `201 Created` responses
47-
- Improved error responses when creating and updating resources
48-
- `Context::filter()` method to get the value of a filter
49-
- `ResourceType::applyScope()`, `applyFilter()` and `applySort()` methods
50-
- `ResourceType::url()` method to get the URL for a model
51-
- `Forbidden` error details for CRUD actions, useful when running Atomic Operations
52-
- `JsonApi::getExtensions()` method to get all registered extensions
53-
- `ConflictException` class
56+
57+
- Content-Type validation and Accept negotiation
58+
- Include `jsonapi` object with `version` member in response
59+
- Validate implementation-specific query parameters according to specification
60+
- Added `Location` header to `201 Created` responses
61+
- Improved error responses when creating and updating resources
62+
- `Context::filter()` method to get the value of a filter
63+
- `ResourceType::applyScope()`, `applyFilter()` and `applySort()` methods
64+
- `ResourceType::url()` method to get the URL for a model
65+
- `Forbidden` error details for CRUD actions, useful when running Atomic Operations
66+
- `JsonApi::getExtensions()` method to get all registered extensions
67+
- `ConflictException` class
5468

5569
### Changed
56-
- Renamed `$linkage` parameter in `AdapterInterface` methods to `$linkageOnly`
57-
- Renamed `Type::newModel()` to `model()` to be consistent with Adapter
70+
71+
- Renamed `$linkage` parameter in `AdapterInterface` methods to `$linkageOnly`
72+
- Renamed `Type::newModel()` to `model()` to be consistent with Adapter
5873

5974
### Fixed
60-
- Properly respond with meta information added to `Context` instance
75+
76+
- Properly respond with meta information added to `Context` instance
6177

6278
## [0.2.0-beta.1] - 2021-08-27
79+
6380
### Added
64-
- Preliminary support for Extensions
65-
- Support filtering by nested relationships/attributes (eg. `filter[relationship.attribute]=value`)
66-
- Add new methods to Context object: `getApi`, `getPath`, `fieldRequested`, `meta`
67-
- Eloquent adapter: apply scopes when including polymorphic relationships
68-
- Laravel validation helper: support nested validation messages
69-
- Allow configuration of sort and filter visibility
70-
- Add new `setId` method to `AdapterInterface`
81+
82+
- Preliminary support for Extensions
83+
- Support filtering by nested relationships/attributes (eg. `filter[relationship.attribute]=value`)
84+
- Add new methods to Context object: `getApi`, `getPath`, `fieldRequested`, `meta`
85+
- Eloquent adapter: apply scopes when including polymorphic relationships
86+
- Laravel validation helper: support nested validation messages
87+
- Allow configuration of sort and filter visibility
88+
- Add new `setId` method to `AdapterInterface`
7189

7290
### Changed
73-
- Change paradigm for eager loading relationships; allow fields to return `Deferred` values to be evaluated after all other fields, so that resource loading can be buffered.
74-
- Remove `on` prefix from field event methods
91+
92+
- Change paradigm for eager loading relationships; allow fields to return `Deferred` values to be evaluated after all other fields, so that resource loading can be buffered.
93+
- Remove `on` prefix from field event methods
7594

7695
### Removed
77-
- Removed `load` and `dontLoad` field methods
96+
97+
- Removed `load` and `dontLoad` field methods
7898

7999
### Fixed
80-
- Fix pagination next link appearing when it shouldn't
100+
101+
- Fix pagination next link appearing when it shouldn't
81102

82103
[0.2.0]: https://github.com/tobyzerner/json-api-server/compare/v0.2.0...v0.2.0-beta.6
83104
[0.2.0-beta.6]: https://github.com/tobyzerner/json-api-server/compare/v0.2.0-beta.6...v0.2.0-beta.5

0 commit comments

Comments
 (0)