Skip to main content

Rest Hooks 4.1 Released

· One min read
Nathaniel Tucker

4.1 comes with a more granular data definition hierarchy that will make it easier to write more API definitions. This marked by the introduction of a new member known as Entity. Entity only needs a pk() and get key(), as well as member declarations to integrate fully.

Entity

  • Useful for nested entities that don't have endpoints like LatestPrice.
  • Useful for non-REST style APIs like GraphQL.
  • Simplifies defining nested entities.

New hierarchy:

 SimpleRecord
|
Entity
|
SimpleResource
|
Resource

Deprecations:

  • Resource.getKey() -> Resource.key
  • Resource.getEntitySchema() -> Resource.asSchema()
  • Entity.define() -> override Entity.schema

Changes:

  • Normalizr: top level key sent to getId is undefined not null
  • pk() now takes additional parent, and key optional args
  • pk() no longer accepts number return value (run .toString())

Full set of 4.1 release commits