code: def schema(
      models: Sequence[Type['main.BaseModel']],
      *,
      by_alias: bool = True,
      title: Optional[str] = None,
      description: Optional[str] = None,
      ref_prefix: Optional[str] = None,
  ) -> Dict[str, Any]:
      
      ref_prefix = ref_prefix or default_prefix
      flat_models = get_flat_models_from_models(models)
      model_name_map = get_model_name_map(flat_models)
      definitions = {}
      output_schema: Dict[str, Any] = {}
      if title:
          output_schema['title'] = title
      if description:
          output_schema['description'] = description
      for model in models:
          m_schema, m_definitions = model_process_schema(
              model, by_alias=by_alias, model_name_map=model_name_map, ref_prefix=ref_prefix
          )
          definitions.update(m_definitions)
          model_name = model_name_map[model]
          definitions[model_name] = m_schema
      if definitions:
          output_schema['definitions'] = definitions
      return output_schema
docs: Process a list of models and generate a single JSON Schema with all of them defined in the ``definitions``
      top-level JSON key, including their sub-models.
  
      :param models: a list of models to include in the generated JSON Schema
      :param by_alias: generate the schemas using the aliases defined, if any
      :param title: title for the generated schema that includes the definitions
      :param description: description for the generated schema
      :param ref_prefix: the JSON Pointer prefix for schema references with ``$ref``, if None, will be set to the
        default of ``#/definitions/``. Update it if you want the schemas to reference the definitions somewhere
        else, e.g. for OpenAPI use ``#/components/schemas/``. The resulting generated schemas will still be at the
        top-level key ``definitions``, so you can extract them from there. But all the references will have the set
        prefix.
      :return: dict with the JSON Schema with a ``definitions`` top-level key including the schema definitions for
        the models and sub-models passed in ``models``.