diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c5701c1..e9f1068f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.3.0] - 2020-07-30 +### Added +- `meta` parameter for createResourceAt() + ### Removed - Dropped support for Dart 2.6 @@ -106,14 +110,14 @@ is missing. Before in such cases a `FormatException` would be thrown ([pr](https ## [2.0.0] - 2019-07-12 ### Changed - This package now consolidates the Client, the Server and the Document in one single library. - It does not depend on `json_api_document` and `json_api_server` anymore, please remove these packages - from your `pubspec.yaml`. +It does not depend on `json_api_document` and `json_api_server` anymore, please remove these packages +from your `pubspec.yaml`. - The min Dart SDK version bumped to `2.3.0` - The Client requires an instance of HttpClient to be passed to the constructor explicitly. - Both the Document and the Server have been refactored with lots of **BREAKING CHANGES**. - See the examples and the functional tests for details. +See the examples and the functional tests for details. - Meta properties are not defensively copied, but set directly. Meta property behavior is unified across - the Document model. +the Document model. ### Removed - `JsonApiParser` is removed. Use the static `decodeJson` methods in the corresponding classes instead. @@ -172,7 +176,8 @@ is missing. Before in such cases a `FormatException` would be thrown ([pr](https ### Added - Client: fetch resources, collections, related resources and relationships -[Unreleased]: https://github.com/f3ath/json-api-dart/compare/4.2.2...HEAD +[Unreleased]: https://github.com/f3ath/json-api-dart/compare/4.3.0...HEAD +[4.3.0]: https://github.com/f3ath/json-api-dart/compare/4.2.2...4.3.0 [4.2.2]: https://github.com/f3ath/json-api-dart/compare/4.2.1...4.2.2 [4.2.1]: https://github.com/f3ath/json-api-dart/compare/4.2.0...4.2.1 [4.2.0]: https://github.com/f3ath/json-api-dart/compare/4.1.0...4.2.0 diff --git a/lib/src/client/json_api_client.dart b/lib/src/client/json_api_client.dart index 92f9f0fb..3195eced 100644 --- a/lib/src/client/json_api_client.dart +++ b/lib/src/client/json_api_client.dart @@ -67,7 +67,8 @@ class JsonApiClient { /// https://jsonapi.org/format/#crud-creating Future> createResourceAt(Uri uri, Resource resource, {Map headers, Map meta}) => - _call(_post(uri, headers, _resourceDoc(resource, meta: meta)), ResourceData.fromJson); + _call(_post(uri, headers, _resourceDoc(resource, meta: meta)), + ResourceData.fromJson); /// Deletes the resource. /// @@ -127,7 +128,8 @@ class JsonApiClient { final _api = Api(version: '1.0'); - Document _resourceDoc(Resource resource, {Map meta}) => + Document _resourceDoc(Resource resource, + {Map meta}) => Document(ResourceData.fromResource(resource), meta: meta, api: _api); Document _toManyDoc(Iterable identifiers) => diff --git a/pubspec.yaml b/pubspec.yaml index b3580ca0..11b32150 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,18 +1,21 @@ name: json_api -version: 4.2.2 -homepage: https://github.com/f3ath/json-api-dart -description: Framework-agnostic implementations of JSON:API Client (Flutter, Web and VM) and Server (VM). Supports JSON:API v1.0 (http://jsonapi.org) -environment: - sdk: '>=2.7.0 <3.0.0' +version: 4.3.0 +description: "Framework-agnostic implementations of JSON:API Client (Flutter, Web and VM) and Server (VM). Supports JSON:API v1.0 (http://jsonapi.org)" +homepage: "https://github.com/f3ath/json-api-dart" + dependencies: http: ^0.12.0 http_parser: ^3.1.4 + dev_dependencies: args: ^1.5.2 - pedantic: ^1.9.0 - test: ^1.9.2 json_matcher: ^0.2.3 + pedantic: ^1.9.0 + shelf: ^0.7.5 stream_channel: ^2.0.0 - uuid: ^2.0.1 + test: ^1.9.2 test_coverage: ^0.4.0 - shelf: ^0.7.5 + uuid: ^2.0.1 + +environment: + sdk: ">=2.7.0 <3.0.0" diff --git a/test/functional/crud/creating_resources_test.dart b/test/functional/crud/creating_resources_test.dart index 4c7579b8..ca55b94d 100644 --- a/test/functional/crud/creating_resources_test.dart +++ b/test/functional/crud/creating_resources_test.dart @@ -13,7 +13,7 @@ void main() async { final base = Uri(scheme: 'http', host: host, port: port); final routing = StandardRouting(base); - group('Server-genrated ID', () { + group('Server-generated ID', () { test('201 Created', () async { final repository = InMemoryRepository({ 'people': {}, @@ -53,7 +53,7 @@ void main() async { }); }); - group('Client-genrated ID', () { + group('Client-generated ID', () { JsonApiClient client; RoutingClient routingClient; setUp(() async {