code: def test_create_empty_doc_list_from_schema(transformation):
      from typing import Optional
  
      from docarray import BaseDoc, DocList
      from docarray.documents import TextDoc
      from docarray.typing import AnyTensor, ImageUrl
  
      from jina.serve.runtimes.helper import (
          _create_aux_model_doc_list_to_list,
          _create_pydantic_model_from_schema,
      )
  
      class CustomDoc(BaseDoc):
          tensor: Optional[AnyTensor]
          url: ImageUrl
          class_var: ClassVar[str] = "class_var_val"
          lll: List[List[List[int]]] = [[[5]]]
          fff: List[List[List[float]]] = [[[5.2]]]
          single_text: TextDoc
          texts: DocList[TextDoc]
          d: Dict[str, str] = {"a": "b"}
          di: Optional[Dict[str, int]] = None
          u: Union[str, int]
          lu: List[Union[str, int]] = [0, 1, 2]
          tags: Optional[Dict[str, Any]] = None
          lf: List[float] = [3.0, 4.1]
  
      CustomDocCopy = _create_aux_model_doc_list_to_list(CustomDoc)
      new_custom_doc_model = _create_pydantic_model_from_schema(
          CustomDocCopy.schema(), "CustomDoc", {}
      )
  
      original_custom_docs = DocList[CustomDoc]()
      if transformation == "proto":
          custom_partial_da = DocList[
              new_custom_doc_model
          ].from_protobuf(original_custom_docs.to_protobuf())
          original_back = DocList[CustomDoc].from_protobuf(
              custom_partial_da.to_protobuf()
          )
      elif transformation == "json":
          custom_partial_da = DocList[new_custom_doc_model].from_json(
              original_custom_docs.to_json()
          )
          original_back = DocList[CustomDoc].from_json(
              custom_partial_da.to_json()
          )
  
      assert len(custom_partial_da) == 0
      assert len(original_back) == 0
  
      class TextDocWithId(BaseDoc):
          ia: str
  
      TextDocWithIdCopy = _create_aux_model_doc_list_to_list(
          TextDocWithId
      )
      new_textdoc_with_id_model = _create_pydantic_model_from_schema(
          TextDocWithIdCopy.schema(), "TextDocWithId", {}
      )
  
      original_text_doc_with_id = DocList[TextDocWithId]()
      if transformation == "proto":
          custom_da = DocList[new_textdoc_with_id_model].from_protobuf(
              original_text_doc_with_id.to_protobuf()
          )
          original_back = DocList[TextDocWithId].from_protobuf(
              custom_da.to_protobuf()
          )
      elif transformation == "json":
          custom_da = DocList[new_textdoc_with_id_model].from_json(
              original_text_doc_with_id.to_json()
          )
          original_back = DocList[TextDocWithId].from_json(
              custom_da.to_json()
          )
  
      assert len(original_back) == 0
      assert len(custom_da) == 0
  
      class ResultTestDoc(BaseDoc):
          matches: DocList[TextDocWithId]
  
      ResultTestDocCopy = _create_aux_model_doc_list_to_list(
          ResultTestDoc
      )
      new_result_test_doc_with_id_model = (
          _create_pydantic_model_from_schema(
              ResultTestDocCopy.schema(), "ResultTestDoc", {}
          )
      )
      result_test_docs = DocList[ResultTestDoc]()
  
      if transformation == "proto":
          custom_da = DocList[
              new_result_test_doc_with_id_model
          ].from_protobuf(result_test_docs.to_protobuf())
          original_back = DocList[ResultTestDoc].from_protobuf(
              custom_da.to_protobuf()
          )
      elif transformation == "json":
          custom_da = DocList[
              new_result_test_doc_with_id_model
          ].from_json(result_test_docs.to_json())
          original_back = DocList[ResultTestDoc].from_json(
              custom_da.to_json()
          )
  
      assert len(original_back) == 0
      assert len(custom_da) == 0
  
file_path: jina/tests/unit/serve/runtimes/test_helper.py
imports: from typing import Any, Dict, List, Optional, Tuple, Union, ClassVar
  from unittest.mock import Mock
  import pytest
  from jina._docarray import docarray_v2
  from jina.serve.helper import get_default_grpc_options
  from jina.serve.runtimes.helper import _get_name_from_replicas_name, _is_param_for_specific_executor, _parse_specific_params, _spit_key_and_executor_name
label_desc: Use image node_id 7 for calling a global function with example usage: test_create_empty_doc_list_from_schema(transformation) without return types