Skip to content
Merged
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ 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]
## [0.3.0] - 2019-03-16
### Changed
- Huge BC-breaking refactoring in the Document model which propagated everywhere

### Added
- Resource attributes update
- Resource relationships update

## [0.2.0] - 2019-03-01
### Added
Expand All @@ -18,5 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Client: fetch resources, collections, related resources and relationships

[Unreleased]: https://github.com/f3ath/json-api-dart/compare/0.2.0...HEAD
[Unreleased]: https://github.com/f3ath/json-api-dart/compare/0.3.0...HEAD
[0.3.0]: https://github.com/f3ath/json-api-dart/compare/0.2.0...0.3.0
[0.2.0]: https://github.com/f3ath/json-api-dart/compare/0.1.0...0.2.0
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
# Implementation of [JSON:API v1.0](http://jsonapi.org) in Dart

## Warning! This is a work-in-progress. While at v0, the API is changing rapidly.

### Feature roadmap
The features here are roughly ordered by priority. Feel free to open an issue if you want to add another feature.

#### Client
- [x] Fetching single resources and resource collections
- [x] Collection pagination
- [x] Fetching relationships and related resources and collections
- [x] Fetching single resources
- [x] Creating resources
- [x] Deleting resources
- [x] Updating resource's attributes
- [x] Updating resource's relationships
- [ ] Updating relationships
- [x] Updating relationships
- [ ] Compound documents
- [ ] Related collection pagination
- [ ] Asynchronous processing
- [ ] Optional check for `Content-Type` header in incoming responses

#### Server (The Server API is not stable yet!)
#### Server
- [x] Fetching single resources and resource collections
- [x] Collection pagination
- [x] Fetching relationships and related resources and collections
- [x] Fetching single resources
- [x] Creating resources
- [x] Deleting resources
- [x] Updating resource's attributes
- [x] Updating resource's relationships
- [ ] Updating relationships
- [ ] Inclusion of related resources
- [x] Updating relationships
- [ ] Compound documents
- [ ] Sparse fieldsets
- [ ] Sorting, pagination, filtering
- [ ] Sorting, filtering
- [ ] Related collection pagination
- [ ] Asynchronous processing
- [ ] Optional check for `Content-Type` header in incoming requests
- [ ] Support annotations in resource mappers (?)

#### Document (The Document API is not stable yet!)
#### Document
- [x] Support relationship objects lacking the `data` member
- [ ] Compound documents
- [ ] Support `meta` members
- [ ] Support `jsonapi` members
- [ ] Structure Validation including compound documents
- [ ] Support relationship objects lacking the `data` member
- [ ] Structural Validation including compound documents
- [ ] Naming Validation
- [ ] JSON:API v1.1 features

Expand Down
35 changes: 0 additions & 35 deletions example/cars_client.dart

This file was deleted.

34 changes: 29 additions & 5 deletions example/cars_server.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:io';

import 'package:json_api/src/server/simple_server.dart';
import 'package:json_api/server.dart';

import 'cars_server/controller.dart';
import 'cars_server/dao.dart';
Expand All @@ -9,17 +10,20 @@ import 'cars_server/model.dart';
void main() async {
final addr = InternetAddress.loopbackIPv4;
final port = 8080;
await createServer().start(addr, port);
await createServer(addr, port);
print('Listening on ${addr.host}:$port');
}

SimpleServer createServer() {
Future<HttpServer> createServer(InternetAddress addr, int port) async {
final models = ModelDAO();
[
Model('1')..name = 'Roadster',
Model('2')..name = 'Model S',
Model('3')..name = 'Model X',
Model('4')..name = 'Model 3',
Model('5')..name = 'X1',
Model('6')..name = 'X3',
Model('7')..name = 'X5',
].forEach(models.insert);

final cities = CityDAO();
Expand All @@ -39,10 +43,30 @@ SimpleServer createServer() {
..name = 'BMW'
..headquarters = '1',
Company('3')..name = 'Audi',
Company('4')..name = 'Toyota',
].forEach(companies.insert);

return SimpleServer(CarsController(
{'companies': companies, 'cities': cities, 'models': models}));
final controller = CarsController(
{'companies': companies, 'cities': cities, 'models': models});

final routing = StandardRouting(Uri.parse('http://localhost:$port'));

final server = JsonApiServer(routing);

final httpServer = await HttpServer.bind(addr, port);

httpServer.forEach((request) async {
final route = await routing.getRoute(request.requestedUri);
if (route == null) {
request.response.statusCode = 404;
return request.response.close();
}
route.createRequest(request)
..bind(server)
..call(controller);
});

return httpServer;
}

class Url {
Expand Down
Loading