8000 Merge branch 'release/1.0.0-rc.1' · jpaniorte/laravel-json-api@0673f19 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0673f19

Browse files
committed
Merge branch 'release/1.0.0-rc.1'
2 parents b94180d + d568987 commit 0673f19

File tree

169 files changed

+10831
-4275
lines changed

Some content is hidden

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

169 files changed

+10831
-4275
lines changed

CHANGELOG.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,69 @@
22
All notable changes to this project will be documented in this file. This project adheres to
33
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
44

5+
## [1.0.0-rc.1] - 2019-01-30
6+
7+
### Added
8+
- [#271](https://github.com/cloudcreativity/laravel-json-api/issues/271)
9+
Can now validate delete resource requests.
10+
- [#196](https://github.com/cloudcreativity/laravel-json-api/issues/196)
11+
Can now add custom actions to resource controllers. Refer to the [Routing](./docs/basics/routing.md) and
12+
[Controllers](./docs/basics/controllers.md) chapters.
13+
- [#242](https://github.com/cloudcreativity/laravel-json-api/issues/242)
14+
Can now override the default controller for an API. Refer to the [Controllers](./docs/basics/controllers.md)
15+
chapter for details.
16+
- [#289](https://github.com/cloudcreativity/laravel-json-api/pull/289)
17+
Can now opt-in to Laravel validation failure data being added to the `meta` member of JSON API
18+
error objects.
19+
20+
### Changed
21+
- [#254](https://github.com/cloudcreativity/laravel-json-api/pull/254)
22+
Refactored content negotiation so that multiple media types can be supported. Refer to the
23+
[Media Types](./docs/features/media-types.md) documentation for details.
24+
- Simplified the validator classes into a single class: `Validators\Validator`.
25+
- Renamed a lot of classes in the `Routing` namespace. They are also marked as `final` because they
26+
are not meant to be extended.
27+
- Modified the abstract `mount` method that package providers use to add routes to an API.
28+
Also added PHP 7 type-hinting to all methods in the abstract class.
29+
30+
### Fixed
31+
- [#280](https://github.com/cloudcreativity/laravel-json-api/issues/280)
32+
Validation error objects for relationship objects now have correct source pointers.
33+
- [#284](https://github.com/cloudcreativity/laravel-json-api/issues/284)
34+
Content negotiation middleware no longer causes a container binding exception when the Kernel
35+
is terminated.
36+
37+
### Removed
38+
- The following classes in the `Validation` namespace were removed as the `Validation\Validator`
39+
class can be used instead, or validators can be constructed via the factory instead:
40+
- `AbstractValidator`
41+
- `ResourceValidator`
42+
- `QueryValidator`
43+
- The deprecated `EloquentController` was removed - extend `JsonApiController` directly.
44+
- The `Store\EloquentAdapter` was removed - extend `Eloquent\AbstractAdapter` directly.
45+
- The following previously deprecated methods/properties were removed from the `EloquentAdapter`:
46+
- public method `queryRelation()`: renamed `queryToMany()`.
47+
- protected property `$with`: renamed `$defaultWith`.
48+
- protected method `keyForAttribute()`: renamed `modelKeyForField()`.
49+
- protected method `columnForField()`: renamed `getSortColumn()`.
50+
- protected method `all()`: renamed `searchAll()`.
51+
- protected method `extractIncludePaths()`: overload the `getQueryParameters()` method instead.
52+
- protected method `extractFilters()`: overload the `getQueryParameters()` method instead.
53+
- protected method `extractPagination()`: overload the `getQueryParameters()` method instead.
54+
- The previously deprecated `Eloquent\Concerns\AbstractRelation` class was removed.
55+
Extend `Adapter\AbstractRelationshipAdapter` and use the `Eloquent\Concerns\QueriesRelations` trait.
56+
- Removed the deprecated `Contracts\Utils\ConfigurableInterface` as this has not been in use for
57+
some time.
58+
- Removed the deprecated `createResourceDocumentValidator()` method from the factory.
59+
- Removed the following previously deprecated methods from the `TestResponse` class:
60+
- `assertJsonApiResponse()`: use `jsonApi()`.
61+
- `normalizeIds()` and `normalizeId()` as these are not in use by the refactored test implementation.
62+
- Removed the following previously deprecated methods from the JSON API service/facade:
63+
- `report()`: no longer supported for access via the service.
64+
- `requestOrFail()`: no longer required.
65+
- Removed the previously deprecated `Schema\ExtractsAttributesTrait` as it has not been used for
66+
some time.
67+
568
## [1.0.0-beta.6] - 2019-01-03
669

770
### Added

README.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,42 @@
22

33
# cloudcreativity/laravel-json-api
44

5-
Add [jsonapi.org](http://jsonapi.org) compliant APIs to your Laravel 5 application.
6-
Based on the framework agnostic package [neomerx/json-api](https://github.com/neomerx/json-api).
5+
Build feature-rich and standards-compliant APIs in Laravel.
6+
7+
This package provides all the capabilities you need to add [JSON API](http://jsonapi.org)
8+
compliant APIs to your application. Extensive support for the specification, including:
9+
10+
- Fetching resources
11+
- Fetching relationships
12+
- Inclusion of related resources (compound documents)
13+
- Sparse fieldsets.
14+
- Sorting.
15+
- Pagination.
16+
- Filtering
17+
- Creating resources.
18+
- Updating resources.
19+
- Updating relationships.
20+
- Deleting resources.
21+
- Validation of:
22+
- JSON API documents; and
23+
- Query parameters.
24+
25+
The following additional features are also supported:
26+
27+
- Full support for Eloquent resources, with features such as:
28+
- Automatic eager loading when including related resources.
29+
- Easy relationship end-points.
30+
- Soft-deleting and restoring Eloquent resources.
31+
- Page and cursor based pagination.
32+
- Asynchronous processing.
33+
- Support multiple media-types within your API.
34+
- Generators for all the classes you need to add a resource to your API.
35+
36+
Installation instructions and documentation are available on
37+
[Read the Docs](http://laravel-json-api.readthedocs.io/en/latest/).
38+
39+
> Credit where credit is due: this package is based on the framework agnostic package
40+
[neomerx/json-api](https://github.com/neomerx/json-api).
741

842
## What is JSON API?
943

@@ -26,9 +60,9 @@ A demo application is available at [here](https://github.com/cloudcreativity/dem
2660

2761
| Laravel | This Package | EOL? |
2862
| --- | --- | --- |
29-
| 5.7.* | `1.0.0-beta.6` | - |
30-
| 5.6.* | `1.0.0-beta.6` | - |
31-
| 5.5.* | `1.0.0-beta.6` | - |
63+
| 5.7.* | `1.0.0-rc.1` | - |
64+
| 5.6.* | `1.0.0-rc.1` | - |
65+
| 5.5.* | `1.0.0-rc.1` | - |
3266
| 5.4.* | `1.0.0-beta.3` | EOL |
3367

3468
Make sure you consult the [Upgrade Guide](http://laravel-json-api.readthedocs.io/en/latest/upgrade/)

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
},
5959
"autoload-dev": {
6060
"psr-4": {
61-
"DummyApp\\": "tests/dummy/app",
6261
"CloudCreativity\\LaravelJsonApi\\Tests\\": "tests/lib",
62+
"DummyApp\\": "tests/dummy/app",
63+
"DummyApp\\Tests\\": "tests/dummy/tests",
6364
"DummyPackage\\": "tests/package/src"
6465
}
6566
},

docs/basics/adapters.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ class Adapter extends AbstractAdapter
395395
}
396396
```
397397

398-
> The `morphMany` implementation currently has some limitations that we are hoping to resolve during our
399-
beta releases. If you have problems using it, please create an issue as this will help us out.
398+
> The `morphMany` implementation currently has some limitations that we are hoping to resolve during future
399+
releases. If you have problems using it, please create an issue as this will help us out.
400400

401401
#### Queries-One and Queries-Many
402402

docs/basics/api.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -229,36 +229,36 @@ The `name` setting applies the specified prefix to all route names that are regi
229229
example, if the `name` is `api:v1:`, then the route name for the index of the `posts` resource will be
230230
`api:v1:posts.index`.
231231

232-
## Content Negotiation
233-
234-
The JSON API spec defines [content negotiation](http://jsonapi.org/format/#content-negotiation) that must occur
235-
between the client and the server. This is handled by this package based on your API's `codecs` configuration.
236-
237-
The generated API file contains a sensible default, for example:
238-
239-
``` php
240-
'codecs' => [
241-
'encoders' => [
242-
'application/vnd.api+json',
243-
'text/plain' => JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES,
244-
],
245-
'decoders' => [
246-
'application/vnd.api+json',
247-
],
248-
],
249-
```
232+
## Media Types
233+
234+
The generated API file contains the default encoding and decoding media types required to support
235+
the JSON API media type. If you want to change how JSON API documents are JSON-encoded, you can add
236+
options to the `encoding` configuration.
250237

251-
### Encoders
238+
The options are the same as those used with PHP's `json_encode` function. For example, change this:
252239

253-
In the example, the config tells the codec matcher that the `application/vnd.api+json` and
254-
`text/plain` are valid `Accept` headers, along with how to encode responses for each type. If the client sends an
255-
`Accept` media type that is not recognised, a `406 Not Acceptable` response will be sent.
240+
```php
241+
return [
242+
// ...
243+
244+
'encoding' => [
245+
'application/vnd.api+json',
246+
],
247+
];
248+
```
256249

257-
> The options for how to encode responses for each media type are the same as the options for PHP's `json_encode()`
258-
function.
250+
To this:
259251

260-
### Decoders
252+
```php
253+
return [
254+
// ...
255+
256+
'encoding' => [
257+
'application/vnd.api+json' => JSON_PRESERVE_ZERO_FRACTION,
258+
],
259+
],
260+
```
261261

262-
In the example, the config tells the codec matcher that the `application/vnd.api+json` is the only acceptable
263-
`Content-Type` that a client can submit. If a different media type is received, a `415 Unsupported Media Type`
264-
response will be sent.
262+
You will not need to make any other changes to the `encoding` or `decoding` configuration unless
263+
you need to add support for other media types. See the
264+
[Media Types (Content Negotiation)](../features/media-types.md) chapter for full details.

0 commit comments

Comments
 (0)
0