-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
153 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenApiGenerator\Attributes; | ||
|
||
use Attribute; | ||
use JsonSerializable; | ||
use Symfony\Component\String\UnicodeString; | ||
|
||
#[Attribute(Attribute::TARGET_CLASS)] | ||
class Security implements JsonSerializable | ||
{ | ||
/** | ||
* Be aware that security scheme keys are the slugified names or the type of the security scheme. | ||
* An empty array means that security is optional: https://spec.openapis.org/oas/v3.1.0#fixed-fields | ||
*/ | ||
public function __construct(private array $securitySchemeKeys = []) | ||
{ | ||
// ... | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function jsonSerialize(): array | ||
{ | ||
if (empty($this->securitySchemeKeys)) { | ||
return [new \stdClass()]; | ||
} | ||
|
||
return array_map(fn (string $key) => [$key => []], $this->securitySchemeKeys); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters