class_docstr: Defines functionality for the available slot mappings.
class_docstr_tok: ["Defines","functionality","for","the","available","slot","mappings","."]
docstr: Validates a slot mapping.
  
  Args:
      mapping: The mapping which is validated.
      slot_name: The name of the slot which is mapped by this mapping.
  
  Raises:
      InvalidDomain: In case the slot mapping is not valid.
docstr_tok: ["Validates","a","slot","mapping",".","Args",":","mapping",":","The","mapping","which","is","validated",".","slot_name",":","The","name","of","the","slot","which","is","mapped","by","this","mapping",".","Raises",":","InvalidDomain",":","In","case","the","slot","mapping","is","not","valid","."]
code: def validate(mapping: Dict[Text, Any], slot_name: Text) -> None:
      """Validates a slot mapping.
  
      Args:
          mapping: The mapping which is validated.
          slot_name: The name of the slot which is mapped by this mapping.
  
      Raises:
          InvalidDomain: In case the slot mapping is not valid.
      """
      from rasa.shared.core.domain import InvalidDomain
  
      if not isinstance(mapping, dict):
          raise InvalidDomain(
              f"Please make sure that the slot mappings for slot '{slot_name}' in "
              f"your domain are valid dictionaries. Please see "
              f"{DOCS_URL_SLOTS} for more information."
          )
  
      try:
          mapping_type = SlotMappingType(mapping.get(MAPPING_TYPE))
      except ValueError:
          raise InvalidDomain(
              f"Your domain uses an invalid slot mapping of type "
              f"'{mapping.get(MAPPING_TYPE)}' for slot '{slot_name}'. Please see "
              f"{DOCS_URL_SLOTS} for more information."
          )
  
      validations: Dict[SlotMappingType, List[Text]] = {
          SlotMappingType.FROM_ENTITY: ["entity"],
          SlotMappingType.FROM_INTENT: ["value"],
          SlotMappingType.FROM_TRIGGER_INTENT: ["value"],
          SlotMappingType.FROM_TEXT: [],
          SlotMappingType.CUSTOM: [],
      }
  
      required_keys = validations[mapping_type]
      for required_key in required_keys:
          if mapping.get(required_key) is None:
              raise InvalidDomain(
                  f"You need to specify a value for the key "
                  f"'{required_key}' in the slot mapping of type '{mapping_type}' "
                  f"for slot '{slot_name}'. Please see "
                  f"{DOCS_URL_SLOTS} for more information."
              )
  
file_path: rasa/rasa/shared/core/slot_mappings.py
imports: from typing import Text, Dict, Any, List, Optional, TYPE_CHECKING
  from rasa.shared.constants import DOCS_URL_SLOTS, IGNORED_INTENTS
  import rasa.shared.utils.io
  from rasa.shared.nlu.constants import ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_ROLE, ENTITY_ATTRIBUTE_GROUP, INTENT, NOT_INTENT, INTENT_NAME_KEY
  from rasa.shared.core.constants import SLOT_MAPPINGS, MAPPING_TYPE, SlotMappingType, MAPPING_CONDITIONS
label_desc: Use image node_id 1 for calling the SlotMapping obj's underlying member method code with example usage: obj.validate(mapping, slot_name) without return types