code: def EncoderDataclassField(
      model_type: str,
      feature_type: str,
      default: str,
      description: str = "",
      blocklist: List[str] = [],
  ) -> Field:
      """Custom dataclass field that when used inside a dataclass will allow the user to specify an encoder config.
  
      Returns: Initialized dataclass field that converts an untyped dict with params to an encoder config.
      """
      encoder_registry = get_encoder_classes(model_type, feature_type)
  
      class EncoderSelection(schema_utils.TypeSelection):
          def __init__(self):
              super().__init__(
                  registry=encoder_registry,
                  default_value=default,
                  description=description,
                  allow_str_value=True,
              )
  
          def get_schema_from_registry(
              self, key: str
          ) -> Type[schema_utils.BaseMarshmallowConfig]:
              return encoder_registry[key]
  
          def _jsonschema_type_mapping(self):
              # NOTE: Edit carefully if necessary! We want these enums to remain in a consistent order, so do not use sets
              # or other unordered data structures to chaperone the registry keys around.
              #
              # Also, note the placement inside this function - since this is a list, it will not update with any late
              # additions to the registry (e.g. in our tests)!
              enum = [
                  e
                  for e in encoder_registry.keys()
                  if e not in blocklist
              ]
  
              return {
                  "type": "object",
                  "properties": {
                      "type": {
                          "type": "string",
                          "enum": enum,
                          "enumDescriptions": get_encoder_descriptions(
                              model_type, feature_type
                          ),
                          "default": default,
                      },
                  },
                  "title": "encoder_options",
                  "allOf": get_encoder_conds(encoder_registry),
              }
  
      return EncoderSelection().get_default_field()
  
file_path: ludwig/ludwig/schema/encoders/utils.py
imports: from dataclasses import Field
  from typing import Any, Dict, List, Optional, Type, TYPE_CHECKING, Union
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import MODEL_ECD, TYPE
  from ludwig.schema import utils
  from ludwig.schema.metadata import ENCODER_METADATA
  from ludwig.schema.metadata.parameter_metadata import convert_metadata_to_json
  from ludwig.utils.registry import Registry
label_desc: Use image node_id 6 for calling a global function with example usage: EncoderDataclassField(model_type, feature_type, default, description, blocklist) and returns: EncoderSelection, encoder_registry, dict