fix php ordering issue for CodegenSecurity (#5001)

This commit is contained in:
Sebastien Rosset 2020-01-14 22:39:04 -08:00 committed by Esteban Gehring
parent 50f7e14a99
commit fe8775a5a5
2 changed files with 15 additions and 11 deletions

View File

@ -386,7 +386,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
operations.put("controllerName", toControllerName((String) operations.get("pathPrefix")));
operations.put("symfonyService", toSymfonyService((String) operations.get("pathPrefix")));
HashSet<CodegenSecurity> authMethods = new HashSet<>();
List<CodegenSecurity> authMethods = new ArrayList<CodegenSecurity>();
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
for (CodegenOperation op : operationList) {
@ -431,7 +431,11 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
// Add operation's authentication methods to whole interface
if (op.authMethods != null) {
authMethods.addAll(op.authMethods);
for (CodegenSecurity am : op.authMethods) {
if (!authMethods.contains(am)) {
authMethods.add(am);
}
}
}
}

View File

@ -43,15 +43,6 @@ use OpenAPI\Server\Model\Pet;
interface PetApiInterface
{
/**
* Sets authentication method api_key
*
* @param string $value Value of the api_key authentication method.
*
* @return void
*/
public function setapi_key($value);
/**
* Sets authentication method petstore_auth
*
@ -61,6 +52,15 @@ interface PetApiInterface
*/
public function setpetstore_auth($value);
/**
* Sets authentication method api_key
*
* @param string $value Value of the api_key authentication method.
*
* @return void
*/
public function setapi_key($value);
/**
* Operation addPet
*