Skip to content

Commit

Permalink
Fix openapi docs
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Jul 11, 2023
1 parent b7c3b50 commit 48c8206
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions core/Controller/LanguageModelApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function taskTypes(): DataResponse {
* @param string $type The task type
* @param string $appId The originating app ID
* @param string $identifier An identifier to identify this task
* @return DataResponse<Http::STATUS_OK, array{task: array{id: int, type: string, status: int, userId: string, appId: string, input: string, output: string, identifier: string}}, array{}>| DataResponse<Http::STATUS_PRECONDITION_FAILED|Http::STATUS_BAD_REQUEST, array{message: string}, array{}>
* @return DataResponse<Http::STATUS_OK, array{task: array{id: int|null, type: string, status: int, userId: string|null, appId: string, input: string, output: string|null, identifier: string}}, array{}>| DataResponse<Http::STATUS_PRECONDITION_FAILED|Http::STATUS_BAD_REQUEST, array{message: string}, array{}>
*
* 200: Task scheduled
* 400: Task type does not exist
Expand All @@ -86,8 +86,11 @@ public function schedule(string $input, string $type, string $appId, string $ide
try {
$this->languageModelManager->scheduleTask($task);

/** @var array{id: int|null, type: string, status: int, userId: string|null, appId: string, input: string, output: string|null, identifier: string} $json */
$json = $task->jsonSerialize();

return new DataResponse([
'task' => $task->jsonSerialize(),
'task' => $json,
]);
} catch (PreConditionNotMetException) {
return new DataResponse(['message' => $this->l->t('Necessary language model provider is not available')], Http::STATUS_PRECONDITION_FAILED);
Expand All @@ -100,7 +103,7 @@ public function schedule(string $input, string $type, string $appId, string $ide
*
* @PublicPage
* @param int $id The id of the task
* @return DataResponse<Http::STATUS_NOT_FOUND | Http::STATUS_INTERNAL_SERVER_ERROR, array{message:string}> | DataResponse<Http::STATUS_OK, array{task: array{id: int, type: string, status: int, userId: string, appId: string, input: string, output: string, identifier: string}}, array{}>
* @return DataResponse<Http::STATUS_NOT_FOUND | Http::STATUS_INTERNAL_SERVER_ERROR, array{message:string}, array{}> | DataResponse<Http::STATUS_OK, array{task: array{id: int|null, type: string, status: int, userId: string|null, appId: string, input: string, output: string|null, identifier: string}}, array{}>
*
* 200: Task returned
* 404: Task not found
Expand All @@ -114,8 +117,11 @@ public function getTask(int $id): DataResponse {
return new DataResponse(['message' => $this->l->t('Task not found')], Http::STATUS_NOT_FOUND);
}

/** @var array{id: int|null, type: string, status: int, userId: string|null, appId: string, input: string, output: string|null, identifier: string} $json */
$json = $task->jsonSerialize();

return new DataResponse([
'task' => $task->jsonSerialize(),
'task' => $json,
]);
} catch (NotFoundException $e) {
return new DataResponse(['message' => $this->l->t('Task not found')], Http::STATUS_NOT_FOUND);
Expand Down

0 comments on commit 48c8206

Please sign in to comment.