OptionalenvelopeOptionalonWhat to do when a projection breaks the contract its resource publishes.
throw (the default) refuses to answer, because a caller cannot detect a broken contract and a
consumer generated from it breaks on the field that is missing. warn chooses availability over
integrity, explicitly, and puts the breach in the log.
OptionalparamsThe query parameters a caller uses to ask for a shape.
Configuration rather than convention: an API that already answers ?only= keeps its vocabulary
instead of gaining a second one. Defaults: fields, include, view.
OptionalregistryNamed resources a route can refer to by name, instead of importing them at the route.
blueprint.set('stone.resources.registry', { user: userResource })
// then, on the route: { resource: 'user' }
Naming a resource that is not registered fails loudly at request time rather than returning the model unshaped, because an unshaped model is exactly what a resource exists to prevent.
The envelope this application wraps its payloads in, if it wraps them at all.
A handler answering a page returns something like
{ items: [...], meta: { total } }, anditemsandmetaare not fields of a model: shaping that object would publish the wrapper as if it were the thing. Naming the word once is enough, and everything around the payload is left as it was, counts and cursors included.Undeclared by default, because guessing which key holds the payload would quietly mangle a model that happens to have one by that name.