|
12 | 12 | [jsonapi.org](http://jsonapi.org/) support for loopback. |
13 | 13 |
|
14 | 14 | ## Status |
15 | | -This project is a work in progress. Consider it beta software. For EmberJS users, the component |
16 | | -should now be basically feature complete. Please test and report any issues. |
17 | | -The functionality that is present is pretty well tested. 140+ integration tests and counting! |
18 | | - |
19 | | -Currently supported: |
20 | | -- Find all records via GET |
21 | | -- Find a record by ID via GET |
22 | | -- Create via POST |
23 | | -- Update a record via PATCH |
24 | | -- Delete a record via DELETE |
25 | | -- All errors have now been transformed into the correct JSON API format |
26 | | -- Find related records via GET eg. /posts/1/comments (belongsTo, hasMany, hasOne) |
27 | | -- Find relationships via GET eg. /posts/1/relationships/author (belongsTo, hasMany, hasOne) |
28 | | -- Creating resource relationship linkages during a resource create |
29 | | -- Updating/deleting resource relationship linkages during a resource update |
30 | | -- [Side loading data](http://jsonapi.org/format/#fetching-includes) via `include` param |
31 | | - |
32 | | -Not yet supported: |
33 | | -- manipulating relationships directly via: |
34 | | - - POST /:resource/relationships/:relatedResource |
35 | | - - PATCH /:resource/relationships/:relatedResource |
36 | | - - DELETE /:resource/relationships/:relatedResource |
37 | | - |
38 | | -## Requirements |
| 15 | + |
| 16 | +This project is now pretty stable and is used in production in a number of our projects. |
| 17 | +There are known issues (see below and the issue tracker) these can mostly be worked around or |
| 18 | +are pretty minor. Open an issue on the issue tracker if you need clarification on anything or |
| 19 | +need help. |
| 20 | + |
| 21 | +### Known issues |
| 22 | + |
| 23 | +This module doesn't do complex compound documents very well yet. This means that if you try to do complex |
| 24 | +includes in a single request you will likely run into trouble. |
| 25 | + |
| 26 | +We wrote another module called [loopback-jsonapi-model-serializer](https://www.npmjs.com/package/loopback-jsonapi-model-serializer) |
| 27 | +that does JSONAPI serialization very well (but nothing else) for loopback which you can use to get |
| 28 | +around such issues for now. The long term goal is to swap out the serialization layer in |
| 29 | +`loopback-component-jsonapi` with `loopback-jsonapi-model-serializer` |
| 30 | + |
| 31 | +## Tested against: |
| 32 | + |
| 33 | +- Node 4, 6 and 8 |
39 | 34 | - JSON API v1.0 |
40 | | -- loopback ^v2.0.0 |
41 | | -- strong-remoting ^v2.22.0 |
| 35 | +- loopback ^3.8.0 |
42 | 36 |
|
43 | 37 | ## Sample Project |
44 | 38 | We have created a sample project using [EmberJS](http://emberjs.com), [Loopback](http://loopback.io) and this compoment. It's called [emberloop](https://github.com/tsteuwer/emberloop). |
45 | 39 |
|
46 | 40 | ## Helping out |
47 | 41 | We are VERY interested in help. Get in touch via the [issue tracker](https://github.com/digitalsadhu/loopback-component-jsonapi/issues) |
| 42 | +Please read the following about contributing: |
| 43 | + |
| 44 | +### Semantic Release |
| 45 | + |
| 46 | +This project uses [Semantic Release](https://github.com/semantic-release/semantic-release) to manage the release process. |
| 47 | +This means that: |
| 48 | +A. There is no semver project version in `package.json`. This is managed in CI. |
| 49 | +B. Commit messages need to follow conventions. See [here](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit) for commit message guidelines. |
| 50 | +The important things to remember are: |
| 51 | +A. If you are fixing a bug prefix your commit message with `fix(<thing being fixed goes here>):` |
| 52 | +B. If you are adding a non breaking feature, prefix your commit with `feat(<name of feature goes here>):` |
| 53 | +C. If you are making a breaking change of any kind, prefix additional information on the 3rd line of the commit message with: `BREAKING CHANGE:` |
| 54 | +See examples of this on the [Semantic Release](https://github.com/semantic-release/semantic-release) github pages. |
| 55 | +And don't hesitate to reach out on our [issue tracker](https://github.com/digitalsadhu/loopback-component-jsonapi/issues) |
| 56 | +if you want further clarification. |
| 57 | + |
| 58 | +### Standard js and "prettier standard" |
| 59 | + |
| 60 | +This project is follows the [Standard js](https://standardjs.com/) styleguide. Linting happens on CI and any time you run tests via `npm test` |
| 61 | +You can run the linting on its own with `npm run lint` |
| 62 | + |
| 63 | +Additionally, code formatting is done whenever you run git commit. This is made possibly by [lint-staged](https://github.com/okonet/lint-staged) and [husky](https://github.com/typicode/husky) with actual formatting done by |
| 64 | +[prettier](https://github.com/prettier/prettier) |
| 65 | + |
| 66 | +### Pull requests and code review |
| 67 | + |
| 68 | +All code is reviewed by one or more of the project maintainers before merging. Before becoming a maintainer, contributers |
| 69 | +need to fork the master branch of this repo, make their changes and submit a pull request. |
| 70 | + |
| 71 | +Once a contributor becomes a maintainer, it is preferred that they create new branches on the loopback-component-jsonapi |
| 72 | +repo and submit those as pull requests |
| 73 | + |
| 74 | +### Tests |
| 75 | + |
| 76 | +We take testing seriously. The project contains over 200 tests at time of writing this. In most cases we wont merge |
| 77 | +anything without tests. (Within reason of course) |
| 78 | + |
| 79 | +### Project maintainers |
| 80 | + |
| 81 | +We follow the principle of "Open open source" which means if you contribute even a single PR to the project, we make you |
| 82 | +a project maintainer. |
| 83 | + |
| 84 | +## Debugging |
| 85 | +You can enable debug logging by setting an environment variable: |
| 86 | +`DEBUG=loopback-component-jsonapi` |
| 87 | + |
| 88 | +#### example: |
| 89 | +``` |
| 90 | +DEBUG=loopback-component-jsonapi node . |
| 91 | +``` |
| 92 | + |
| 93 | +# API Documentation |
| 94 | + |
| 95 | +## Getting started |
48 | 96 |
|
49 | | -## Usage |
50 | 97 | In your loopback project: |
51 | 98 |
|
52 | 99 | 1. `npm install --save loopback-component-jsonapi` |
@@ -630,12 +677,3 @@ module.exports = function (MyModel) { |
630 | 677 | ##### function parameters |
631 | 678 | - `options` All config options set for the serialization process |
632 | 679 | - `callback` Callback to call with modified serialized records |
633 | | - |
634 | | -## Debugging |
635 | | -You can enable debug logging by setting an environment variable: |
636 | | -`DEBUG=loopback-component-jsonapi` |
637 | | - |
638 | | -#### example: |
639 | | -``` |
640 | | -DEBUG=loopback-component-jsonapi node . |
641 | | -``` |
|
0 commit comments