> For the complete documentation index, see [llms.txt](https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/extra-module-3-openapi-specification/api-decorators.md).

# Api decorators

A lot is automated for us, but still some manual work is necessary.

Notice that the <mark style="color:blue;">`login()`</mark> route in the Swagger UI lacks information. This is because we could not use the <mark style="color:blue;">`@Body()`</mark> decorator in this route, and so Swagger cannot infer we are using the <mark style="color:blue;">`LoginDto`</mark> here. Nor can it infer the JWT cookie returned.

We should then go to the <mark style="color:blue;">`AuthController`</mark> and, over the <mark style="color:blue;">`login()`</mark> route, use the <mark style="color:blue;">`@ApiBody()`</mark> decorator to define the expected body.

```typescript
@ApiBody({ type: LoginDto })
```

For the cookie part, we have to use the <mark style="color:blue;">`@ApiResponse()`</mark> decorator for the <mark style="color:blue;">OK</mark> status, and then state that it will have the <mark style="color:blue;">`header`</mark> <mark style="color:blue;">Set-Cookie</mark>, while defining a proper <mark style="color:blue;">`type`</mark> and <mark style="color:blue;">`description`</mark> for the <mark style="color:blue;">`cookie`</mark>. We can then first define this <mark style="color:blue;">`header`</mark> in the file <mark style="color:purple;">auth</mark>/<mark style="color:purple;">swagger</mark>/<mark style="color:purple;">jwt-cookie.header</mark>.

```typescript
export const JwtCookieHeader: ApiResponseOptions['headers'] = {
  'Set-Cookie': { description: 'JWT cookie', schema: { type: 'string' } },
};
```

And then, use it in the decorator as mentioned.

```typescript
@ApiOkResponse({ headers: JwtCookieHeader })
```

We have then manually corrected these flaws, and can see the changes now.

<mark style="color:green;">**Commit**</mark> - Using swagger decorators to document manually
