> 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/comments-introspection.md).

# Comments introspection

Automatic documentation through comments.

As was already explained before, it is a nice practice to use good naming conventions in order to avoid unnecessary comments. However, it would be adequate to explain that the user <mark style="color:blue;">`password`</mark> should follow the rules defined previously. Due to this, let's add a description to it in the <mark style="color:blue;">`CreateUserDto`</mark> through a JSDoc, which we are already familiar with.

```typescript
/**
 * Requires:
 * 1. 8 to 20 characters
 * 2. At least one
 * - Lowercase letter
 * - Uppercase letter
 * - Number
 * - Special character
 */
```

There are two interesting options available in the Swagger plugin, they are:

* <mark style="color:blue;">`classValidatorShim`</mark> - class validator decorators are used to enrich the documentation
* <mark style="color:blue;">`introspectComments`</mark> - descriptions and examples are generated from comments

The first option is enabled by default, but not the second one. So, let's enable it now.

```json
"introspectComments": true
```

After restarting the application and refreshing the Swagger UI, we can notice the changes.

<mark style="color:green;">**Commit**</mark> - Using comment to describe a field in swagger
