Resources should always use weak validators because Naptime does not guarantee byte-equality between responses.
Error responses.
Error responses. Note: these error responses work by throwing special exceptions that are caught by the framework. They are not designed to work outside the framework.
Contains all of the information relating to a facet in a sophisticated search.
Contains all of the information relating to a facet in a sophisticated search.
An ordered (potentially partial) list of facet entries.
Not all potential values for this facet may be included. The fieldCardinality is the count of all possible different values for this facet.
Information about one particular choice of value for one particular facet.
Information about one particular choice of value for one particular facet.
The id or code for this facet value.
The display name for this facet value.
The number of results for this facet.
Contains all the required information related to a resource's fields.
Contains all the required information related to a resource's fields.
The type of the resource in the collection.
The default fields that should be included in a response.
A function that, given a request header, determines if particular fields are to be included in the response. This function can be used to hide particular fields depending on arbitrary information about the request. (e.g. Sensitive fields can be made unavailable in certain contexts. (e.g. CORS, 3rd party requests to APIs, JSONP, etc.) IMPORTANT NOTE: this functionality is not fully implemented yet! WORK IN PROGRESS. DO NOT USE YET!
A map of field name to related resource's name and version pair. This
configuration is used to automatically join related resources as requested. For
example, if we have an "author" id field that references the "userBasicProfile"
v1 resource, and a "post" id field that references a "discoursePost" v1 the map
would look like: Map("author" -> ("userBasicProfile", 1), "post" ->
("discoursePost", 1))
.
The JSON serialization formatter for the resource.
Throw to break out of a Naptime action body on error.
Configure the defaults for pagination.
Marker trait to try and hide access to the underlying Play request.
Marker trait to try and hide access to the underlying Play request.
Passed to Resources so if there are certain fields that require more work to fetch, they can skip that work if the request does not include it.
Passed to Resources so if there are certain fields that require more work to fetch, they can skip that work if the request does not include it.
Note: the API is intentionally severely constrained to allow for future flexibility and internal changes to the Naptime framework.
Passed to Resources so if there are certain related objects that require more work to fetch, they can skip that work if the request does not ask for those related resources.
Passed to Resources so if there are certain related objects that require more work to fetch, they can skip that work if the request does not ask for those related resources.
Note: the API is intentionally severely constrained to allow for future flexibility and internal changes to the Naptime framework.
Calculates the request pagination.
Calculates the request pagination.
TODO: URL-safe base64 encoding
The structured name + version + path of a resource.
The structured name + version + path of a resource.
The first top level name.
The version of the top level resource.
The names of path selectors.
If there are subsequent pages, include a next 'pointer'.
If there are subsequent pages, include a next 'pointer'. This is opaque to clients.
TODO: consider base64 encoding over the wire for safety.
If present, a map of field name to facet information.
All the contextual information about a naptime request.
Install this singleton module into your service to configure Naptime defaults to ensure a successful boot.
Install this singleton module into your service to configure Naptime defaults to ensure a successful boot.
install(NaptimeModule)
Note: as of writing this comment, there is no need to install this module in your service for correct operation.
This ari defines the key abstractions for automatic resource inclusion as well as GraphQL.
This ari defines the key abstractions for automatic resource inclusion as well as GraphQL.
The system is split up into 3 distinct layers:
+---------------------------------------------------------------------+ | Presentation Layer | | GraphQL | Naptime HTTP | +------------------------------+--------------------------------------+ | | | Inclusion Engine | | | +---------------------------------------------------------------------+ | Data fetching | | Local execution | remote execution | +=====================================================================+ | | | Unmodified Naptime APIs | | | +---------------------------------------------------------------------+
A request enters the system via the presentation layer (typically parsed from the network). The presentation layer constructs a org.coursera.naptime.ari.Request and passes that to engine. The engine performs a number of validations against the schema, and then makes a number of requests to to the Data Fetching layer to assemble all of the (available) data required to construct a response. This is passed back to the presentation layer, which constructs a response to be sent out on the wire.
The API between the presentation layer and the inclusion engine is the org.coursera.naptime.ari.EngineApi
The API between the inclusion engine and the data fetching layer is defined by org.coursera.naptime.ari.FetcherApi.
BEWARE: This code is currently in a high state of flux. Do not depend upon it unless you are prepared for breakages!
Resources should always use weak validators because Naptime does not guarantee byte-equality between responses. See ETag.Weak.