Skip to main content

Resolvers

Resolvers are a fundamental part of the platform's API mesh capabilities. They are configuration blocks that declare how to connect to a service, and how to make a request using information from the context provided by a query.

Definitions

Types

Below are the broad resolver types. Click through to read in detail about the capabilities of a specific type of resolver, or read on for an overview.

Sample of a resolver

Below is a snippet of a query with a resolver that fulfills the request by accessing the Rick and Morty API.

{
"RickAndMorty_characters": {
"shape": {
"type": "array",
"items": { "$ref": "#/shapes/RickAndMorty_Character/schema" }
},
"resolver": {
"name": "rest:get",
"service": "rick",
"searchParams": {
"ops": [
{ "path": "$", "mapping": "$args.filter" },
{ "path": "page", "mapping": "$args.page" }
]
},
"options": { "path": "character/" },
"results": {
"ops": [
{ "path": "$", "mapping": "$finalStep.results" },
{
"path": "[*].firstName",
"mapping": [
["jsonPath", { "path": "$loop.item.name" }],
["replace", { "regexp": "[^\\s]+$", "replacement": "" }],
["trim", {}]
]
},
{
"path": "[*].lastName",
"mapping": [
["jsonPath", { "path": "$loop.item.name" }],
["replace", { "regexp": "^[^\\s]+", "replacement": "" }],
["trim", {}]
]
},
{ "path": "[*].name", "op": "remove" },
{ "path": "[1,3].plucked", "mapping": "$loopIndex" },
{ "path": "[0:3].sliced", "mapping": "$loopKey" }
]
}
},
"description": "Returns a list of characters.",
"args": {
"type": "object",
"properties": {
"page": { "type": "number" },
"filter": {
"type": "object",
"properties": {
"status": { "type": "string" },
"species": { "type": "string" },
"type": { "type": "string" },
"gender": { "type": "string" }
}
}
}
}
}
}