1
0
Fork 0
mirror of synced 2024-08-19 12:11:55 +12:00

WIP allow processing routes with no response

This commit is contained in:
Jake Barnby 2022-05-04 21:45:36 +12:00
parent 9d2aad1134
commit 7689f7ef6f
No known key found for this signature in database
GPG key ID: A4674EBC0E404657
2 changed files with 2 additions and 9 deletions

View file

@ -329,16 +329,10 @@ class Builder
$methodName = $namespace . \ucfirst($route->getLabel('sdk.method', '')); $methodName = $namespace . \ucfirst($route->getLabel('sdk.method', ''));
$responseModelNames = $route->getLabel('sdk.response.model', "none"); $responseModelNames = $route->getLabel('sdk.response.model', "none");
if ($responseModelNames === "none") {
continue;
}
$responseModels = \is_array($responseModelNames) $responseModels = \is_array($responseModelNames)
? \array_map(static fn($m) => $response->getModel($m), $responseModelNames) ? \array_map(static fn($m) => $response->getModel($m), $responseModelNames)
: [$response->getModel($responseModelNames)]; : [$response->getModel($responseModelNames)];
foreach ($responseModels as $responseModel) { foreach ($responseModels as $responseModel) {
$type = self::getModelTypeMapping($responseModel, $response); $type = self::getModelTypeMapping($responseModel, $response);
$description = $route->getDesc(); $description = $route->getDesc();

View file

@ -159,11 +159,10 @@ class GraphQLServerTest extends Scope
$errorMessage = 'User (role: guest) missing scope (users.write)'; $errorMessage = 'User (role: guest) missing scope (users.write)';
$this->assertEquals($errorMessage, $user['body']['errors'][0]['message']); $this->assertEquals($errorMessage, $user['body']['errors'][0]['message']);
$this->assertIsArray($user['body']['data']); $this->assertArrayNotHasKey('data', $user['body']);
$this->assertNull($user['body']['data']['users_deleteUser']);
/** /**
* Delete the user with the reqiured scopes * Delete the user with the required scopes
*/ */
$key = $this->getNewKey(['users.write']); $key = $this->getNewKey(['users.write']);
$user = $this->client->call(Client::METHOD_POST, '/graphql', array_merge([ $user = $this->client->call(Client::METHOD_POST, '/graphql', array_merge([