-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Use form to validate API endpoint for site package generation (#…
…471)
- Loading branch information
1 parent
38e981b
commit 81813f6
Showing
9 changed files
with
214 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ | |
|
||
namespace App\Entity\Sitepackage; | ||
|
||
use OpenApi\Attributes as OA; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
/** | ||
|
@@ -33,23 +32,19 @@ class Author implements \JsonSerializable | |
{ | ||
#[Assert\NotBlank(message: "Please enter the authors' name.")] | ||
#[Assert\Length(min: 3)] | ||
#[OA\Property(type: 'string', example: 'J. Doe')] | ||
private string $name; | ||
|
||
#[Assert\NotBlank(message: "Please enter the authors' email address.")] | ||
#[Assert\Email(message: "The email '{{ value }}' is not a valid email.")] | ||
#[OA\Property(type: 'string', example: '[email protected]')] | ||
private string $email; | ||
|
||
#[Assert\NotBlank(message: "Please enter the authors' company.")] | ||
#[Assert\Length(min: 3)] | ||
#[Assert\Regex(pattern: '/^[A-Za-z0-9\x7f-\xff .:&-]+$/', message: 'Only letters, numbers and spaces are allowed')] | ||
#[OA\Property(type: 'string', example: 'TYPO3')] | ||
private string $company; | ||
|
||
#[Assert\NotBlank(message: "Please enter the authors' homepage URL.")] | ||
#[Assert\Url] | ||
#[OA\Property(type: 'string', example: 'https://typo3.com')] | ||
private string $homepage; | ||
|
||
public function getName(): string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,24 +40,36 @@ public function buildForm(FormBuilderInterface $builder, array $options) | |
'autocomplete' => 'off', | ||
'placeholder' => 'John Doe', | ||
], | ||
'documentation' => [ | ||
'example' => 'J. Doe', | ||
], | ||
]) | ||
->add('email', EmailType::class, [ | ||
'attr' => [ | ||
'autocomplete' => 'off', | ||
'placeholder' => '[email protected]', | ||
], | ||
'documentation' => [ | ||
'example' => '[email protected]', | ||
], | ||
]) | ||
->add('company', TextType::class, [ | ||
'attr' => [ | ||
'autocomplete' => 'off', | ||
'placeholder' => 'Company Inc.', | ||
], | ||
'documentation' => [ | ||
'example' => 'TYPO3', | ||
], | ||
]) | ||
->add('homepage', TextType::class, [ | ||
'attr' => [ | ||
'autocomplete' => 'off', | ||
'placeholder' => 'https://www.example.com', | ||
], | ||
'documentation' => [ | ||
'example' => 'https://typo3.com', | ||
], | ||
]); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.