Skip to content
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

Remove "oauth2" scheme from openapi security scheme #4073

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@
* Mercure: Do not use data in options when deleting (#4056)
* Doctrine: Support for foreign identifiers
* SchemaFactory: Allow generating documentation when property and method start from "is" (property `isActive` and method `isActive`)
* OpenApiFactory: Do not set scheme to oauth2 when generating securitySchemes
alanpoulain marked this conversation as resolved.
Show resolved Hide resolved

## 2.6.2

Expand Down
2 changes: 1 addition & 1 deletion src/OpenApi/Factory/OpenApiFactory.php
Expand Up @@ -460,7 +460,7 @@ private function getOauthSecurityScheme(): Model\SecurityScheme
throw new \LogicException('OAuth flow must be one of: implicit, password, clientCredentials, authorizationCode');
}

return new Model\SecurityScheme($this->openApiOptions->getOAuthType(), $description, null, null, 'oauth2', null, new Model\OAuthFlows($implicit, $password, $clientCredentials, $authorizationCode), null);
return new Model\SecurityScheme($this->openApiOptions->getOAuthType(), $description, null, null, null, null, new Model\OAuthFlows($implicit, $password, $clientCredentials, $authorizationCode), null);
}

private function getSecuritySchemes(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/OpenApi/Factory/OpenApiFactoryTest.php
Expand Up @@ -253,7 +253,7 @@ public function testInvoke(): void
$this->assertEquals($components->getSchemas(), new \ArrayObject(['Dummy' => $dummySchema->getDefinitions()]));

$this->assertEquals($components->getSecuritySchemes(), new \ArrayObject([
'oauth' => new Model\SecurityScheme('oauth2', 'OAuth 2.0 authorization code Grant', null, null, 'oauth2', null, new Model\OAuthFlows(null, null, null, new Model\OAuthFlow('/oauth/v2/auth', '/oauth/v2/token', '/oauth/v2/refresh', new \ArrayObject(['scope param'])))),
'oauth' => new Model\SecurityScheme('oauth2', 'OAuth 2.0 authorization code Grant', null, null, null, null, new Model\OAuthFlows(null, null, null, new Model\OAuthFlow('/oauth/v2/auth', '/oauth/v2/token', '/oauth/v2/refresh', new \ArrayObject(['scope param'])))),
'header' => new Model\SecurityScheme('apiKey', 'Value for the Authorization header parameter.', 'Authorization', 'header'),
'query' => new Model\SecurityScheme('apiKey', 'Value for the key query parameter.', 'key', 'query'),
]));
Expand Down