# Define a request

So start writing your own FormRequest (php artisan make:request ExampleRequest) and type-hint it on the method signature.

The only change you need to do in your existent request is to apply the #\[OpenApi\Request] attribute.

```php
use Hypnodev\OpenapiGenerator\Attributes\OpenApi;

#[OpenApi\Request(description: 'An example description of the request')]
class ExampleRequest extends FormRequest
{
    // ...
}
```

{% hint style="danger" %}
Be aware that attribute isn't supporting (yet) the notation.
{% endhint %}

Package will bring all the rules inside the requests and make the right definition.

## Example

```php
// ...

public function rules(): array
{
    return [
        'name' => ['required', 'string'],
        'email' => ['required', 'email'],
        'id' => ['required', 'uuid'],
        'url' => ['required', 'url'],
        'date' => ['required', 'date_format:Y-m-d', 'date'],
        'status' => ['bool'],
        'enum_as_string' => ['in:test'],
        'enum_as_closure' => [Rule::in(['test', ExampleEnum::Status1])],
        'array' => ['array'],
        'array.*' => ['string'],
        'object' => ['array'],
        'object.name' => ['string'],
    ];
}
```

<figure><img src="https://1002965136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgISDIutKGG1Na3azMoVZ%2Fuploads%2FD9rhpFguc4v9OowLJE24%2FScreenshot%202023-09-12%20at%2015.53.04.png?alt=media&#x26;token=e528ec3c-872a-4f20-8a11-af188c298313" alt=""><figcaption></figcaption></figure>
