Skip to content

Commit

Permalink
make security the same for openapi and operation objects
Browse files Browse the repository at this point in the history
  • Loading branch information
romalytvynenko committed Feb 9, 2025
1 parent d8dbeb2 commit 3624b21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Support/Generator/OpenApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class OpenApi
/** @var Path[] */
public array $paths = [];

/** @var SecurityRequirement[] */
public array $security = [];
/** @var SecurityRequirement[]|null */
public array|null $security = [];

public function __construct(string $version)
{
Expand Down Expand Up @@ -91,7 +91,7 @@ public function toArray()
);
}

if (isset($this->security)) {
if ($this->security) {
$result['security'] = array_map(
fn (SecurityRequirement $sr) => $sr->toArray(),
$this->security,
Expand Down
6 changes: 3 additions & 3 deletions src/Support/Generator/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class Operation

public bool $deprecated = false;

/** @var array<SecurityRequirement> */
public array $security;
/** @var array<SecurityRequirement>|null */
public ?array $security = null;

public array $tags = [];

Expand Down Expand Up @@ -186,7 +186,7 @@ public function toArray()
$result['responses'] = $responses;
}

if (isset($this->security)) {
if ($this->security !== null) {
$result['security'] = array_map(
fn ($s) => $s->toArray(),
$this->security,
Expand Down

0 comments on commit 3624b21

Please sign in to comment.