Skip to content

Commit 721506e

Browse files
committed
Feature: Introduce setSecurityForOperation - new way to mutate security in Operation
1 parent 6d7d67d commit 721506e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/SwaggerWrapper.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ protected function prepareOperation(Operation $operation)
8484
return $operation;
8585
}
8686

87+
/**
88+
* @param Operation $operation
89+
* @param array $security
90+
*/
91+
public function setSecurityForOperation(Operation $operation, array $security)
92+
{
93+
$operation->security = $security;
94+
95+
$this->addParametersFromSecurity($operation, true);
96+
}
8797

8898
/**
8999
* I don't known How will be better
@@ -226,11 +236,6 @@ public function findResponseByStatusCode(Operation $path, $statusCode = 200)
226236
*/
227237
public function assertHttpResponseForOperation(Response $httpResponse, Operation $path, $statusCode = 200)
228238
{
229-
// User can mutate Operation->security, and we should re-enable it
230-
if ($path->security) {
231-
$this->addParametersFromSecurity($path, true);
232-
}
233-
234239
$response = $this->findResponseByStatusCode($path, $statusCode);
235240
if ($response) {
236241
return $this->assertHttpResponseForOperationResponse(

0 commit comments

Comments
 (0)