code: def test_default_endpoint(protocols):
      class Input1(BaseDoc):
          img: ImageDoc
  
      class Output1(BaseDoc):
          embedding: AnyTensor
  
      class Output2(BaseDoc):
          a: str
  
      class Exec1Default(Executor):
          @requests()
          def bar(
              self, docs: DocList[Input1], **kwargs
          ) -> DocList[Output1]:
              docs_return = DocList[Output1](
                  [
                      Output1(embedding=np.zeros((100, 1)))
                      for _ in range(len(docs))
                  ]
              )
              return docs_return
  
      class Exec2Default(Executor):
          @requests()
          def bar(
              self, docs: DocList[Output1], **kwargs
          ) -> DocList[Output2]:
              docs_return = DocList[Output2](
                  [
                      Output2(
                          a=f"shape input {docs[0].embedding.shape[0]}"
                      )
                      for _ in range(len(docs))
                  ]
              )
              return docs_return
  
      ports = [random_port() for _ in protocols]
      with Flow(port=ports, protocol=protocols).add(
          uses=Exec1Default
      ).add(uses=Exec2Default):
          for port, protocol in zip(ports, protocols):
              c = Client(port=port, protocol=protocol)
              docs = c.post(
                  on="/default",
                  inputs=Input1(
                      img=ImageDoc(tensor=np.zeros((3, 224, 224)))
                  ),
                  return_type=DocList[Output2],
              )
              assert len(docs) == 1
              assert docs[0].a == "shape input 100"
  
          if len(protocols) == 1 and protocols[0] == "grpc":
              import grpc
              from docarray.documents.legacy import LegacyDocument
              from google.protobuf.json_format import MessageToDict
  
              from jina.proto import jina_pb2
              from jina.proto.jina_pb2_grpc import (
                  JinaDiscoverEndpointsRPCStub,
              )
              from jina.serve.executors import (
                  __default_endpoint__,
                  __dry_run_endpoint__,
              )
              from jina.serve.runtimes.helper import (
                  _create_aux_model_doc_list_to_list,
                  _create_pydantic_model_from_schema,
              )
  
              channel = grpc.insecure_channel(f"0.0.0.0:{ports[0]}")
              stub = JinaDiscoverEndpointsRPCStub(channel)
              res = stub.endpoint_discovery(
                  jina_pb2.google_dot_protobuf_dot_empty__pb2.Empty(),
              )
              schema_map = MessageToDict(res.schemas)
              assert set(schema_map.keys()) == {
                  __dry_run_endpoint__,
                  __default_endpoint__,
              }
              v = schema_map[__dry_run_endpoint__]
              assert v["input"] == LegacyDocument.schema()
              assert v["output"] == LegacyDocument.schema()
              v = schema_map[__default_endpoint__]
              assert (
                  v["input"]
                  == _create_pydantic_model_from_schema(
                      _create_aux_model_doc_list_to_list(
                          Input1
                      ).schema(),
                      "Input1",
                      {},
                  ).schema()
              )
              assert (
                  v["output"]
                  == _create_pydantic_model_from_schema(
                      _create_aux_model_doc_list_to_list(
                          Output2
                      ).schema(),
                      "Output2",
                      {},
                  ).schema()
              )
  
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 8 for calling a global function with example usage: test_default_endpoint(protocols) and returns: docs_return, docs_return