Skip to content

fix(openapi): nullable default values in operation openapi definition #7321

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

Merged
merged 1 commit into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Metadata/Extractor/XmlResourceExtractor.php
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to fix the YamlResourceExtractor too ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably

Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ private function buildOpenapi(\SimpleXMLElement $resource): bool|OpenApiOperatio
in: $this->phpize($parameter, 'in', 'string'),
description: $this->phpize($parameter, 'description', 'string'),
required: $this->phpize($parameter, 'required', 'bool'),
deprecated: $this->phpize($parameter, 'deprecated', 'bool'),
allowEmptyValue: $this->phpize($parameter, 'allowEmptyValue', 'bool'),
schema: isset($parameter->schema->values) ? $this->buildValues($parameter->schema->values) : null,
deprecated: $this->phpize($parameter, 'deprecated', 'bool', false),
allowEmptyValue: $this->phpize($parameter, 'allowEmptyValue', 'bool', null),
schema: isset($parameter->schema->values) ? $this->buildValues($parameter->schema->values) : [],
style: $this->phpize($parameter, 'style', 'string'),
explode: $this->phpize($parameter, 'explode', 'bool'),
allowReserved: $this->phpize($parameter, 'allowReserved', 'bool'),
explode: $this->phpize($parameter, 'explode', 'bool', false),
allowReserved: $this->phpize($parameter, 'allowReserved', 'bool', null),
example: $this->phpize($parameter, 'example', 'string'),
examples: isset($parameter->examples->values) ? new \ArrayObject($this->buildValues($parameter->examples->values)) : null,
content: isset($parameter->content->values) ? new \ArrayObject($this->buildValues($parameter->content->values)) : null,
Expand Down
6 changes: 3 additions & 3 deletions src/OpenApi/Model/Parameter.php
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are this changes still needed as the MR #7315 has been merged ?

Otherwise, i realized than i have done partially the job (see: #7322).
If you want to integrate this changes here i can decline the MR.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class Parameter
{
use ExtensionTrait;

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)
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)
{
if (null === $style) {
if ('query' === $in || 'cookie' === $in) {
Expand Down Expand Up @@ -148,7 +148,7 @@ public function withDeprecated(bool $deprecated): self
return $clone;
}

public function withAllowEmptyValue(bool $allowEmptyValue): self
public function withAllowEmptyValue(?bool $allowEmptyValue): self
{
$clone = clone $this;
$clone->allowEmptyValue = $allowEmptyValue;
Expand Down Expand Up @@ -180,7 +180,7 @@ public function withExplode(bool $explode): self
return $clone;
}

public function withAllowReserved(bool $allowReserved): self
public function withAllowReserved(?bool $allowReserved): self
{
$clone = clone $this;
$clone->allowReserved = $allowReserved;
Expand Down
Loading