Closed ttskch closed 23 hours ago
[!NOTE] Is this a new feature? If so, we can close this PR and go to #6395.
In the schema for the request body of application/merge-patch+json PATCH operation, all required properties should be output as optional.
application/merge-patch+json
See here: https://datatracker.ietf.org/doc/html/rfc7386#section-3
This PR fixes the SchemaFactory for the 'json' format to output required properties as optional only for input context of PATCH operations.
'json'
For example, for the following entity, the output of the OpenAPI document will change as follows:
#[ORM\Entity(repositoryClass: TodoRepository::class)] #[ApiResource] class Todo { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] #[Assert\NotBlank] #[Assert\Length(max: 255)] private ?string $title = null; #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $description = null; #[ORM\Column] #[Assert\NotNull] private ?bool $done = null;
I think that we can make this a bug fix as it won't break any current implementations
In the schema for the request body of
application/merge-patch+json
PATCH operation, all required properties should be output as optional.This PR fixes the SchemaFactory for the
'json'
format to output required properties as optional only for input context of PATCH operations.For example, for the following entity, the output of the OpenAPI document will change as follows: