title: How to add JSON request and response examples in Swagger (OpenApi)?
body: <p>I have an API endpoint in my Symfony 4 application, that I want to document with NelmioApiDocBundle and Swagger. The endpoint takes JSON as a request data and also returns some custom JSON as the response. How can I add examples of them to the documentation, using annotations? I can't see any of the examples on the documentation page, only the description.</p>
  <pre><code>/**
   * @Route(&quot;/order/import&quot;, methods={&quot;POST&quot;}, name=&quot;order_import&quot;)
   * @OA\RequestBody (
   *     request=&quot;order&quot;,
   *     description=&quot;Order data in JSON format&quot;,
   *     @OA\Schema(
   *        type=&quot;object&quot;,
   *        example={&quot;hello&quot;: &quot;world&quot;}
   *     )
   * )
   * @OA\Response(
   *     response=200,
   *     description=&quot;Returns the JSON data after import&quot;,
   *     @OA\Schema(
   *        type=&quot;object&quot;,
   *        example={&quot;foo&quot;: &quot;bar&quot;}
   *     )
   * )
   * @OA\Tag(name=&quot;import&quot;)
  </code></pre>