- All resource descriptions must now be passed at the time of construction, as an object whose keys are the type names. Passing an array to the constructor is no longer supported.
- All setter methods have been removed. Please set all your data before initializing the Registry.
- Resource type descriptions now inherit from the descriptions of their
parentType. So if type B extends A, B will use A'sbeforeSave,beforeRender,info, etc. by default. The only exception is thatlabelMappersare not inherited. Among other things, this means that the JSON generated for sub-types now better reflects anyinfostored on the parent type's fields. (Addresses #93 and #18.) - The
ResourceTypeRegistry.types()method has been renamed toResourceTypeRegistry.typeNames() - For more details on the above, see the relevant commit.
- If you were relying on the RelationshipObject class: the class has been renamed to simply "Relationship", and its fields
selfURIandrelatedURIhave been renamed toselfURITemplateandrelatedURITemplaterespectively. - URI Templates specified on a single Relationship instance now take precedence over resource-level templates during serialization
-
Please don't use versions 2.11 and 2.12; the new features outlined below were tweaked repeatedly over those versions, and 2.13 is their (more) stable iteration. Moreover, it's just as easy to upgrade from 2.10 to 2.13 as it would be to upgrade to 2.11 or 2.12.
-
HTTP Strategies: If you are using your own HTTP strategy (including extending the built-in Express one), you must make sure that your strategy calls the Documentation controller's
handle()method with two additional arguments: the request and response objects from the framework your strategy is for (i.e. from express, koa, etc). The built-in express strategy has already been patched to support this change. -
Documentation controller: If you are using your own subclass of the Documentation controller, you must update it to be compatible with some small changes made there. In particular, a fourth constructor argument was added, and
handle()now additionally calls the newtransformTypeInfo()method. See the updated file for details.
- Very subtle changes to how the request body is parsed and stored on the request object. You almost certainly don’t need to care about these changes.
- APIController.responseFromExternalError() has a changed API
- Errors caused in the Express handler while building the Request object are now sent in a JSON API-compliant format. Before, only the status was sent or, in some cases, the app hung/crashed. See ethanresnick#61
- Babel's polyfills are no longer loaded globally, so, if you were relying on them, you'll need to re-include them yourself. See http://babeljs.io/docs/usage/polyfill/
- Some error objects in 4xx and 5xx responses may be different, as we now expose fewer error details by default (for security reasons). See the relevant commit for more information.
- In relationship objects,
selfandrelatedlinks now properly show up under thelinkskey. Closes #36.
- The
locationproperty on theResponseclass is now atresponse.headers.locationinstead ofresponse.location.
- Sort fields (in the
sortquery parameter) no longer need to be prefixed by a "+" to trigger ascending order, per JSON API 1.0.
-
Mongoose 4 is now required.
-
The MongooseAdapter is now at a different export path:
require("json-api").dbAdapters.MongooseAdapter. Update your references to the adapter accordingly. -
Resource type descriptions now use a
dbAdapterproperty instead ofadapter. -
The Front Controller has been replaced with an ExpressStrategy, which is exported at
require("json-api").httpStrategies.Express). The API is the same as for the old Front Controller, with the addition of some new options. -
The new payload's resource object format complies with JSON API 1.0, meaning it uses the
relationshipscontainer, rather putting relationships underlinks, and uses adatamember instead oflinkagewithin relationships. -
In auto-generated documentation’s JSON, many names were dasherized or tweaked:
-
field.kind.isArray => field.kind.is-array;
-
field.kind.targetModel => target-model;
-
field.kind.targetType => field.kind.target-type
-
field.friendlyName => field.friendly-name
-
field.validation.readOnly => field.validation.read-only;
-
field.validation.allowedHtml => field.validation.allowed-html
-
field.kind.name => field.kind.base-type;
- "Link fields" get field.kind.base-type =
"Relationship"rather than"Link" - field.validation.oneOf => field.validation.enum;
- "Link fields" get field.kind.base-type =
-