0.5.0: Entity inheritance
Entity definitions can now be split across multiple types:
Add the ability to extend subclasses of JsonapiEntity
, whilst drawing annotated properties from the prototype chain.
Prior to this release, if you attempt to create a common superclass that extends JsonapiEntity
, then extend with child @entity
classes, the only properties to be deserialised are those declared in the subclass.
For example, the @entity
class Cat
:
extends the (abstract) Animal
:
so you would expect a deserialised Cat
to contain all the Animal
fields and the Cat
fields.
This release adds the ability to pull inherited JSON:API fields from the parent type, by making attribute
, link
, meta
, and relationship
traverse up the prototype chain.
However, this release does not attempt to allow full OO extensions: it is not permitted to have an @entity
subtype of a class that is, itself, and @entity
(due to the odd prototype chain).