-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP adds apiV2 workflow put - execution support #85
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that the PR is marked as WIP.
I still did an early review so that you can address the requested changes before the final review.:smile:
* ), | ||
* @OA\Response( | ||
* response=200, | ||
* description="CI saved successfully", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the description.
Async workflow executions should return 202 Accepted instead.
* ), | ||
* @OA\Response( | ||
* response=400, | ||
* description="Workflow failed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
400 Bad Request shouldn't be used for failed workflows.
The client SHOULD NOT repeat the request without modifications.
This is not the case here.
The client did nothing wrong. This is an error that should be resolved on the server side, so 500 Internal Server Error is more appropriate here.
The status code should still be used and documented for request validations like incorrect startAt
format.
$result = $workflowService->startWorkflow($workflowRow[Db_Workflow::ID], $userId, $params, false, $forceAsync, $startAt); | ||
unset($result['log']); | ||
|
||
//TODO Return also the instance id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Friendly reminder for the TODO comment :)
} catch (Exception $e) { | ||
$this->logger->logf('Workflow failed: %s', Zend_Log::CRIT, $workflowName); | ||
$this->logger->log($e, Zend_Log::CRIT); | ||
$this->outputError('Executing workflow failed', null, 400); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated for the documentation above this should rather be status code 500.
No description provided.