title: Why are types in dto not visible in swagger?
body: <p>I'm setting up swagger document in my small Nest.js app according to this documentation: <a href="https://docs.nestjs.com/recipes/swagger" rel="nofollow noreferrer">https://docs.nestjs.com/recipes/swagger</a></p>
  <p>How do I setup dto to correctly show schema in swagger? To be more specific, nested types. It shows only top level keys. If one of the keys is of type of something, it shows it just as empty object. Here is what I mean:</p>
  <p>dto:</p>
  <pre><code>export class HealthCheckDataDto {
      serverStatus: {} // dont have it typed yet;
      dbStatus: MongoConnectionStateT;
  } 
  </code></pre>
  <p>swagger:</p>
  <pre><code>[
    {
      &quot;serverStatus&quot;: {},
      &quot;dbStatus&quot;: {}
    }
  ]
  </code></pre>
  <p>expected result in swagger example value:</p>
  <pre><code>[
    {
      &quot;serverStatus&quot;: {},
      &quot;dbStatus&quot;: {
        &quot;isOnline&quot;: true,
        &quot;msg&quot;: &quot;string&quot;
      }
    }
  ]
  </code></pre>
  <p>This is the function:</p>
  <pre><code>@ApiResponse({ status: 200, description: 'blabla', type: [HealthCheckDataDto] })
  @ApiResponse({ status: 500, description: 'blabla, but bad', type: [HealthCheckDataDto] })
  @Get('/api/healthcheck')
  healthCheckApp(@Res() res: Response&lt;HealthCheckDataDto&gt;) {
  
      // check HCs and setup status code
      const healthCheck: HealthCheckI = this.healthcheckService.getFullHealthCheck();
      const statusCode = (healthCheck.dbStatus.isOnline) ? HttpStatus.OK : HttpStatus.INTERNAL_SERVER_ERROR;
  
      // return that response
      res.status(statusCode).json(healthCheck);
  }
  </code></pre>
  <p>What I tried:</p>
  <ul>
  <li>When I replaced type for exact params in dto, it shows it properly in swagger.</li>
  <li>I did cross-check of dto against interface, where I added wrong field into 'isOnline' and it finds it and marks it, that it isnt good.</li>
  <li>Schema is displayed in swagger, but also only top level, not the typed part. So its not just example value.</li>
  <li>Checked Stack Overflow; found two related threads, but neither one solved it. One suggested to manually create sub-dtos instead of types. Well... I better not do that.</li>
  </ul>
  <p>I'm doing something wrong, or missed something in documentation. Or maybe parser of that swagger module is unable to extract type/interface when generating json.</p>