Skip to content

Commit e2f2df1

Browse files
committed
fix(openapi): nullable default values in operation openapi definition
1 parent 347c27e commit e2f2df1

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

src/Metadata/Extractor/XmlResourceExtractor.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,12 @@ private function buildOpenapi(\SimpleXMLElement $resource): bool|OpenApiOperatio
224224
in: $this->phpize($parameter, 'in', 'string'),
225225
description: $this->phpize($parameter, 'description', 'string'),
226226
required: $this->phpize($parameter, 'required', 'bool'),
227-
deprecated: $this->phpize($parameter, 'deprecated', 'bool'),
228-
allowEmptyValue: $this->phpize($parameter, 'allowEmptyValue', 'bool'),
229-
schema: isset($parameter->schema->values) ? $this->buildValues($parameter->schema->values) : null,
227+
deprecated: $this->phpize($parameter, 'deprecated', 'bool', false),
228+
allowEmptyValue: $this->phpize($parameter, 'allowEmptyValue', 'bool', false),
229+
schema: isset($parameter->schema->values) ? $this->buildValues($parameter->schema->values) : [],
230230
style: $this->phpize($parameter, 'style', 'string'),
231-
explode: $this->phpize($parameter, 'explode', 'bool'),
232-
allowReserved: $this->phpize($parameter, 'allowReserved', 'bool'),
231+
explode: $this->phpize($parameter, 'explode', 'bool', false),
232+
allowReserved: $this->phpize($parameter, 'allowReserved', 'bool', false),
233233
example: $this->phpize($parameter, 'example', 'string'),
234234
examples: isset($parameter->examples->values) ? new \ArrayObject($this->buildValues($parameter->examples->values)) : null,
235235
content: isset($parameter->content->values) ? new \ArrayObject($this->buildValues($parameter->content->values)) : null,

src/OpenApi/Model/Parameter.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,21 @@ final class Parameter
1717
{
1818
use ExtensionTrait;
1919

20-
public function __construct(private string $name, private string $in, private string $description = '', private bool $required = false, private bool $deprecated = false, private bool $allowEmptyValue = false, private array $schema = [], private ?string $style = null, private bool $explode = false, private bool $allowReserved = false, private $example = null, private ?\ArrayObject $examples = null, private ?\ArrayObject $content = null)
21-
{
20+
public function __construct(
21+
private string $name,
22+
private string $in,
23+
private string $description = '',
24+
private bool $required = false,
25+
private bool $deprecated = false,
26+
private bool $allowEmptyValue = false,
27+
private array $schema = [],
28+
private ?string $style = null,
29+
private bool $explode = false,
30+
private bool $allowReserved = false,
31+
private $example = null,
32+
private ?\ArrayObject $examples = null,
33+
private ?\ArrayObject $content = null,
34+
) {
2235
if (null === $style) {
2336
if ('query' === $in || 'cookie' === $in) {
2437
$this->style = 'form';

0 commit comments

Comments
 (0)