# Define a path (route)

You don't need to do something in particular, the path will be caught from routes of your application.

## Specify tags, summary or other definition

You can specify some particular OpenAPI property by using #\[OpenApi\Path] attribute.

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

// ...

#[OpenApi\Path(tags: ['Example'], summary: 'Example summary', description: 'Example description', operationId: 'example')]
public function index(): JsonResponse
{
    return response()->json();
}
```

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

## Define route parameters (or query)

Also here you don't need to do anything in the case of a route parameter, the package will take parameters out from the method signature. You only need to be sure about type-hinting of your parameters.

If your route param is expecting a model, then the parameter will be an it, here an example:

```php
public function show(Example $example): JsonResponse
{
    return response()->json($model);
}
```

The results will be:

<figure><img src="https://1002965136-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgISDIutKGG1Na3azMoVZ%2Fuploads%2Fc4QxVGduS25O7bhnhLXL%2FScreenshot%202023-09-12%20at%2015.37.55.png?alt=media&#x26;token=026cb8df-4fd4-4064-834c-7021d0ae759b" alt=""><figcaption></figcaption></figure>

If you have to declare a query param, you need to use Attribute or phpDoc:

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

// ...

/**
* @OpenApi\Query(name=q, required=false)
*/
public function index(Request $request): JsonResponse
{
    return response()->json([]);
}

// ... or

#[OpenApi\Query(name: 'q', required: false)]
public function index(Request $request): JsonResponse
{
    return response()->json([]);
}
```
