forked from Somnia/SomniaRooms
Added Validation to API requests.
- Added Symfony Validation Lib. - Updated API DTOs to include validation constraints.
This commit is contained in:
@@ -2,16 +2,21 @@
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use DateTimeInterface;
|
||||
use OpenApi\Attributes as OA;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class SearchPricesForCategoryRequest
|
||||
{
|
||||
#[OA\Property(description: 'Room category ID')]
|
||||
#[Assert\NotBlank]
|
||||
public int $roomCategory;
|
||||
|
||||
#[OA\Property(description: 'Period start date')]
|
||||
public \DateTime $startDate;
|
||||
#[Assert\NotBlank]
|
||||
public DateTimeInterface $startDate;
|
||||
|
||||
#[OA\Property(description: 'Period end date')]
|
||||
public \DateTime $endDate;
|
||||
#[Assert\NotBlank]
|
||||
public DateTimeInterface $endDate;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user