title: Schema Generator cannot determine GraphQL output type for custom object within DTO
body: <p>Coming from a laravel background I try to get into node.js/graphQL/MongoDB and stumbled over <code>nest.js</code> framework which looks pretty nice. So I tried to set up a simple GraphQL API for testing and understanding how it all works. Therefore I created a mongoose Schema for a user as well as a model (<code>type-graphql</code>) and a <code>DTO</code> for creating such a user via mutation.</p>
  
  <p>This works pretty fine but then I wanted to add a nested object called settings within the user to try how this would work and I simply don't get it and also don't find any <code>nest.js</code> or <code>type-graphql</code> specific examples for such an implementation. Is this simply not feasible using the "code first" approach of <code>nest.js</code>? Because the schema generator always gives me an error while compilation saying :</p>
  
  <blockquote>
    <p><strong>"UnhandledPromiseRejectionWarning: Error: Cannot determine GraphQL output type for settings".</strong></p>
  </blockquote>
  
  <p>user.model.ts</p>
  
  <pre><code>import { Field, ID, ObjectType } from 'type-graphql'
  import UserSettingsType from './user.settings.type'
  
  @ObjectType()
  export class User {
    @Field((type) =&gt; ID)
    id: string
  
    @Field()
    email: string
  
    @Field((type) =&gt; UserSettingsType)
    settings: {}
  }
  </code></pre>
  
  <p>user.settings.type.ts</p>
  
  <pre><code>import { Field, ObjectType } from 'type-graphql'
  
  @ObjectType()
  export class UserSettings {
    @Field()
    theme: string
  
    @Field()
    description?: string
  
    @Field((type) =&gt; [String])
    visited: string[]
  }
  </code></pre>
  
  <p>new-user.input.ts</p>
  
  <pre><code>import { IsOptional, IsEmail, IsBoolean, Length, MaxLength, IsArray } from 'class-validator'
  import { Field, InputType } from 'type-graphql'
  import UserSettingsType from '../graphql/user.settings.type'
  
  @InputType()
  export class NewUserInput {
    @Field()
    @IsEmail()
    email: string
  
    @Field((type) =&gt; UserSettingsType)
    @IsOptional()
    @IsArray()
    settings: {}
  }
  
  </code></pre>
  
  <p>As you can see I defined a new type UserSettings in a separate file (following the best practices of <code>nest.js</code>) and allocated it as a type within the User model as well as the new-user DTO class. The error is thrown for the <code>DTO class</code> (NOT for the model) and if I change it there to something like [String] instead of UserSettingsType it is compiling.</p>
  
  <p>I'm not sure if you need the resolver or the service/mongoose logic for this actual problem if so I can also post that of course!</p>