def field_singleton_sub_fields_schema(
    sub_fields: Sequence[Field],
    *,
    by_alias: bool,
    model_name_map: Dict[Type['main.BaseModel'], str],
    schema_overrides: bool = False,
    ref_prefix: Optional[str] = None,
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
    """
    This function is indirectly used by ``field_schema()``, you probably should be using that function.

    Take a list of Pydantic ``Field`` from the declaration of a type with parameters, and generate their
    schema. I.e., fields used as "type parameters", like ``str`` and ``int`` in ``Tuple[str, int]``.
    """
    ref_prefix = ref_prefix or default_prefix
    definitions = {}
    sub_fields = [sf for sf in sub_fields if sf.include_in_schema()]
    if len(sub_fields) == 1:
        return field_type_schema(
            sub_fields[0],
            by_alias=by_alias,
            model_name_map=model_name_map,
            schema_overrides=schema_overrides,
            ref_prefix=ref_prefix,
        )
    else:
        sub_field_schemas = []
        for sf in sub_fields:
            sub_schema, sub_definitions = field_type_schema(
                sf,
                by_alias=by_alias,
                model_name_map=model_name_map,
                schema_overrides=schema_overrides,
                ref_prefix=ref_prefix,
            )
            definitions.update(sub_definitions)
            sub_field_schemas.append(sub_schema)
        return {'anyOf': sub_field_schemas}, definitions
def field_singleton_sub_fields_schema ( sub_fields : Sequence [ Field ] , * , by_alias : bool , model_name_map : Dict [ Type [ 'main.BaseModel' ] , str ] , schema_overrides : bool = False , ref_prefix : Optional [ str ] = None , ) -> Tuple [ Dict [ str , Any ] , Dict [ str , Any ] ] : ref_prefix = ref_prefix or default_prefix definitions = { } sub_fields = [ sf for sf in sub_fields if sf . include_in_schema ( ) ] if len ( sub_fields ) == 1 : return field_type_schema ( sub_fields [ 0 ] , by_alias = by_alias , model_name_map = model_name_map , schema_overrides = schema_overrides , ref_prefix = ref_prefix , ) else : sub_field_schemas = [ ] for sf in sub_fields : sub_schema , sub_definitions = field_type_schema ( sf , by_alias = by_alias , model_name_map = model_name_map , schema_overrides = schema_overrides , ref_prefix = ref_prefix , ) definitions . update ( sub_definitions ) sub_field_schemas . append ( sub_schema ) return { 'anyOf' : sub_field_schemas } , definitions
This function is indirectly used by ``field_schema()``, you probably should be using that function.

    Take a list of Pydantic ``Field`` from the declaration of a type with parameters, and generate their
    schema. I.e., fields used as "type parameters", like ``str`` and ``int`` in ``Tuple[str, int]``.