title: Excluding entities from Swagger model
body: <p>We are using Swagger to model our API with Spring annotations:</p>
  <pre><code>@Operation(summary = &quot;Creates a post for given user.&quot;)
  @PostMapping(&quot;/post&quot;)
  open fun createPost(
      @RequestParam(&quot;userId&quot;) user: User,
  )
  </code></pre>
  <p>The issue we are having is that Swagger does not know there is a logic behind and we are only passing <code>userId: Long</code> for which the user is loaded by Hibernate.</p>
  <p>The model of <code>User</code> contains several <code>@OneToOne</code>, <code>@ManyToOne</code>, <code>@OneToMany</code> relations to other entities and Swagger builds the model of <code>User</code> with all of them. This causes the model to be huge and some of our Swagger docs wouldn't even load in the browser as the model is in the size of megabytes.</p>
  <p>Is there a way to tell Swagger:</p>
  <ul>
  <li>to ignore specific entity/entities</li>
  <li>to enforce different type (in this case <code>Long</code>)</li>
  </ul>
  <p>Ideally something like:</p>
  <pre><code>@Operation(summary = &quot;Creates a post for given user.&quot;)
  @PostMapping(&quot;/post&quot;)
  open fun createPost(
      @SwaggerType(Long::class)
      @RequestParam(&quot;userId&quot;) 
      user: User,
  )
  </code></pre>