#
Entity Reference
This section only contains entity types defined by the core Rosetta platform. Those defined in plugins are listed in their respective plugin pages.
#
View
#
data
Entity Kind: View
Type: data
The default view type is a data view, which performs the following steps:
- Transform the incoming HTTP request object using the specified request glyphs
- Execute the resulting transformed object as a DataServiceRequest using the root profile specified in config
- Transform the raw DataServiceResponse using the specified response glyphs
- Respond using the transform output as the final response body and the configured media type (the default
is
application/json)
The following is an example config snippet for a single data view:
rosetta:
view:
views:
- name: my-example-view
paths:
- /my/example/path
methods:
- GET
profile: example-profile
transforms:
request:
policy: list
names:
- example-view-request-transform
response:
policy: list
names:
- example-view-response-transform
Note this example view depends on the existence of a profile called example-profile and two glyphs with names example-view-request-transform
and example-view-response-transform.
#
Properties
See DataView.
#
data-multi
Entity Kind: View
Type: data-multi
A data-multi view is similar to a data
- Transform the incoming HttpDataRequest into a map whose keys are arbitrary and each value is a DataServiceRequest.
- Execute each
DataServiceRequestin turn and construct a new map from the resulting DataServiceResponse objects, associating each with the corresponding key from step 1). - Transform the map of
DataServiceResponseobjects into the final response body. - Respond using the final response body and configured media type.
#
Properties
See DataView.
#
transform-only
Entity Kind: View
Type: transform-only
A transform-only view is perhaps the simplest type of view, as it simply transforms the incoming HTTP request
using the specified glyphs and responds with the output.
The following is a simple example transform-only view, along with config for the double-my-arg glyph used by the view:
rosetta:
view:
views:
- name: example-transform-only
type: transform-only
paths:
- /example/transform/only
methods:
- GET
glyphs:
policy: list
names:
- double-my-arg
transform:
glyphs:
- name: double-my-arg
type: proteus
properties:
spec: /rosetta/config/proteus/double-my-arg.json
File: /rosetta/config/proteus/double-my-arg.json
{
"result": {
"#type": "maths",
"expression": "2*{$.query.arg}"
}
}
With this config deployed on a Rosetta server running on port 4923, the request GET http://localhost:4923/example/transform/only?arg=7
would respond with:
{
"result": 14
}
In the above, we can see that the arg query string parameter has been dynamically marshalled into the input of a maths
Proteus component via the $.query.arg JSONPath expression, which doubles the value of this parameter and places the result
under the result top-level key of the JSON output.
#
Properties
As BaseView but with the following additional properties.
#
Profile
Unlike other kinds of entity, Profiles do not have types and have a fixed schema, which is described in the Profile section of the data structures page.
#
Provider
No providers are defined in core Rosetta (see plugins).
#
Glyph
#
to-generic-search
Entity Kind: Glyph
Type: to-generic-search
Input Model: HttpDataRequest
Output Model: DataServiceRequest<GenericSearchRequest>
The to-generic-search Glyph transforms an HttpDataRequest into a DataServiceRequest whose request field
is populated by a GenericSearchRequest, either using query string parameters or the request body.
If the query string parameters are used, then each parameter string value will be parsed into their respective fields of GenericSearchRequest according to the following rules:
- The parameter
qis parsed as the sole item within thequeriesfield. - The parameters
idsandaggsare converted into their respective array fields by splitting on the,character. - The parameters
fieldandautocompleteare interpreted as maps where each entry is delimited by the;character and the key and value are separated by the:character. - The parameter
filtertakes the following form:where eachfilter_1:((value_1),(value_2),...,(value_n));filter_2:(value_i,value_ii,...,value_m)filter_xis the name of a searchable field and eachvalue_yis a value for that field. - The parameter
sorttakes the following form:where eachsort_1:direction_1,sort_2:direction_2,...,sort_n:direction_nsort_xis the name of a searchable field and eachdirection_xcan be eitherascordescfor ascending and descending order, respectively. - The parameters
fromandsizeare interpreted literally.
If the request body is used instead, then the body is literally interpreted as a GenericSearchRequest.
#
Properties
#
Example
name: my-glyph
type: to-generic-search
properties:
types:
- query
- body
#
to-simple-data-response
Entity Kind: Glyph
Type: to-simple-data-response
Input Model: DataServiceResponse
Output Model: SimpleDataResponse
The to-simple-data-response Glyph converts a DataServiceResponse to a SimpleDataResponse
by selecting the sole result set available in the input and rendering it in isolation.
If multiple result sets are found in the input (e.g. if multiple providers are configured in the profile), then an exception will be thrown.
#
Properties
This Glyph has no properties.
#
Example
name: my-glyph
type: to-simple-data-response