public function RpcResponseFactory::setOutputSchema in JSON-RPC 8
Same name and namespace in other branches
- 2.x src/Shaper/RpcResponseFactory.php \Drupal\jsonrpc\Shaper\RpcResponseFactory::setOutputSchema()
Sets the schema for the response output.
Parameters
array|null $result_schema: The array of the response.
1 call to RpcResponseFactory::setOutputSchema()
- RpcResponseFactory::doTransform in src/
Shaper/ RpcResponseFactory.php
File
- src/
Shaper/ RpcResponseFactory.php, line 71
Class
- RpcResponseFactory
- Creates RPC Response objects.
Namespace
Drupal\jsonrpc\ShaperCode
public function setOutputSchema($result_schema) {
$schema = Json::decode(file_get_contents(__DIR__ . '/response-schema.json'));
$schema['properties']['result'] = $result_schema;
$this->outputValidator = new JsonSchemaValidator($schema, $this->validator, Constraint::CHECK_MODE_TYPE_CAST);
}