code: def test_json_openapi_components():
      assert JSON().openapi_components() == {}
  
      components = JSON(pydantic_model=BaseSchema).openapi_components()
  
      assert components
  
      schema: Schema = components["schemas"]["BaseSchema"]
  
      assert schema.properties == {
          "name": {"title": "Name", "type": "string"},
          "endpoints": {
              "title": "Endpoints",
              "type": "array",
              "items": {"type": "string"},
          },
      }
      assert schema.type == "object"
      assert schema.required == ["name", "endpoints"]
  
      nested = JSON(pydantic_model=Nested).openapi_components()
  
      assert nested
  
      assert all(
          a in nested["schemas"] for a in ["BaseSchema", "Nested"]
      )
      assert "$ref" in nested["schemas"]["Nested"].properties["nested"]
  
imports: from __future__ import annotations
  import asyncio
  import json
  import logging
  import typing
  from dataclasses import dataclass
  from functools import partial
  from typing import TYPE_CHECKING
  import attr
  import numpy
  import pandas
  import pydantic
  import pytest
  from bentoml._internal.io_descriptors.json import DefaultJsonEncoder
  from bentoml._internal.utils import LazyLoader
  from bentoml.exceptions import BadInput
  from bentoml.grpc.utils import import_generated_stubs
  from bentoml.io import JSON
label_desc: Use image node_id 9 for calling a global function with example usage: test_json_openapi_components() without return types