code: def test_doc_with_examples(ctxt_manager, include_gateway):
      if ctxt_manager == "flow" and include_gateway:
          return
      import random
      import string
  
      random_example = "".join(
          random.choices(string.ascii_letters, k=10)
      )
      random_description = "".join(
          random.choices(string.ascii_letters, k=10)
      )
      from pydantic.fields import Field
  
      class MyDocWithExample(BaseDoc):
          """This test should be in description"""
  
          t: str = Field(
              examples=[random_example], description=random_description
          )
  
          class Config:
              title: str = "MyDocWithExampleTitle"
              schema_extra: Dict = {"extra_key": "extra_value"}
  
      class MyExecDocWithExample(Executor):
          @requests
          def foo(
              self, docs: DocList[MyDocWithExample], **kwargs
          ) -> DocList[MyDocWithExample]:
              pass
  
      port = random_port()
  
      if ctxt_manager == "flow":
          ctxt = Flow(protocol="http", port=port).add(
              uses=MyExecDocWithExample
          )
      else:
          ctxt = Deployment(
              uses=MyExecDocWithExample,
              protocol="http",
              port=port,
              include_gateway=include_gateway,
          )
  
      with ctxt:
          import requests as general_requests
  
          resp = general_requests.get(
              f"http://localhost:{port}/openapi.json"
          )
          resp_str = str(resp.json())
          assert random_example in resp_str
          assert random_description in resp_str
          assert "This test should be in description" in resp_str
          assert "MyDocWithExampleTitle" in resp_str
          assert "extra_key" in resp_str
  
imports: import os
  import time
  from typing import Any, AsyncGenerator, AsyncIterator, Dict, Generator, Iterator, List, Optional, Union
  import numpy
  import pytest
  from docarray import BaseDoc, DocList
  from docarray.documents import ImageDoc, TextDoc
  from docarray.documents.legacy import LegacyDocument
  from docarray.typing import AnyTensor, ImageUrl, NdArray
  from jina import Client, Deployment, Executor, Flow, dynamic_batching, requests
  from jina.excepts import RuntimeFailToStart
  from jina.helper import random_port
  import uuid
label_desc: Use image node_id 41 for calling a global function with example usage: test_doc_with_examples(ctxt_manager, include_gateway) without return types