[new Assert\NotBlank()], 'email' => [new Assert\NotBlank(), new Assert\Email()], 'name' => new Assert\Optional(), 'biography' => new Assert\Optional(), 'location' => new Assert\Optional(), 'website' => new Assert\Optional(new Assert\Url()), 'birth_date' => new Assert\Optional(new Assert\DateTime(format: "Y-m-d")) ]); $data = json_decode($request->getContent(), true); $violations = $this->validator->validate($data, $constraint); if (count($violations) > 0) { return $this->json($violations, Response::HTTP_BAD_REQUEST); } try { $author = $this->authorApplicationService->signUp( Uuid::uuid4()->toString(), $data['username'], $data['email'], $data['name'], $data['biography'], $data['location'], $data['website'], $data['birth_date'] ); } catch (AuthorAlreadyExists) { throw new HttpException(statusCode: Response::HTTP_CONFLICT); } return $this->json( data: AuthorDto::assembleFrom($author), status: Response::HTTP_CREATED ); } }