Skip to content

Commit

Permalink
Update oauth description with used flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Jibbarth committed Jan 11, 2020
1 parent 5727a1c commit d05fad2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/Swagger/Serializer/DocumentationNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,10 @@ private function computeDoc(bool $v3, Documentation $documentation, \ArrayObject

$securityDefinitions['oauth'] = [
'type' => $this->oauthType,
'description' => 'OAuth client_credentials Grant',
'description' => sprintf(
'OAuth 2.0 %s Grant',
strtolower(preg_replace('/[A-Z]/', ' \\0', lcfirst($this->oauthFlow)))
),
];

if ($v3) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Swagger/Serializer/DocumentationNormalizerV2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ interface_exists(AdvancedNameConverterInterface::class)
'securityDefinitions' => [
'oauth' => [
'type' => 'oauth2',
'description' => 'OAuth client_credentials Grant',
'description' => 'OAuth 2.0 application Grant',
'flow' => 'application',
'tokenUrl' => '/oauth/v2/token',
'authorizationUrl' => '/oauth/v2/auth',
Expand Down
6 changes: 3 additions & 3 deletions tests/Swagger/Serializer/DocumentationNormalizerV3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ private function doTestNormalizeWithNameConverter(bool $legacy = false): void
$legacy ? $nameConverter : null,
true,
'oauth2',
'application',
'authorizationCode',
'/oauth/v2/token',
'/oauth/v2/auth',
['scope param'],
Expand Down Expand Up @@ -554,9 +554,9 @@ private function doTestNormalizeWithNameConverter(bool $legacy = false): void
'securitySchemes' => [
'oauth' => [
'type' => 'oauth2',
'description' => 'OAuth client_credentials Grant',
'description' => 'OAuth 2.0 authorization code Grant',
'flows' => [
'application' => [
'authorizationCode' => [
'tokenUrl' => '/oauth/v2/token',
'authorizationUrl' => '/oauth/v2/auth',
'scopes' => ['scope param'],
Expand Down

0 comments on commit d05fad2

Please sign in to comment.