Closed urosgruber closed 3 years ago
API Platform version(s) affected: v2.6.4
Description When viewing API docs for POST method schema is set to the one defined with normalizationContext instead of denormalizationContext.
How to reproduce
Simple entity with basic groups setup.
<?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\SshKeyRepository; use Symfony\Component\Serializer\Annotation\Groups; use Doctrine\ORM\Mapping as ORM; /** * @ApiResource( * normalizationContext={"groups"={"read"}}, * denormalizationContext={"groups"={"write"}}, * ) * @ORM\Entity(repositoryClass=MyEntityRepository::class) */ class MyEntity { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) * @Groups({"write"}) */ private $name; /** * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"read", "write"}) */ private $value; /** * @ORM\Column(type="datetime") * @Groups({"read"}) */ private $createdAt; public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getValue(): ?string { return $this->value; } public function setValue(?string $value): self { $this->value = $value; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } }
Swagger shows MyEntity.jsonld-read as schema for POST, PUT and PATCH request.
MyEntity.jsonld-read
The same code was working fine on version 2.5.10
Additional Context
Isn't this fixed in #4247? Just waiting for a release...
Also mentioned in #4212 and #4284
API Platform version(s) affected: v2.6.4
Description
When viewing API docs for POST method schema is set to the one defined with normalizationContext instead of denormalizationContext.
How to reproduce
Simple entity with basic groups setup.
Swagger shows
MyEntity.jsonld-read
as schema for POST, PUT and PATCH request.The same code was working fine on version 2.5.10
Additional Context