parameters: (ctxt, idl_type, syntax_type)
docstring: Validate each type is correct.
docstring_summary: Validate each type is correct.
docstring_tokens: Validate each type is correct .
function: def _validate_type_properties(ctxt, idl_type, syntax_type):
      # type: (errors.ParserContext, Union[syntax.Type, ast.Type], str) -> None
      # pylint: disable=too-many-branches
      """Validate each type is correct."""
      # Validate bson type restrictions
      if not _validate_bson_types_list(ctxt, idl_type, syntax_type):
          return
  
      if len(idl_type.bson_serialization_type) == 1:
          bson_type = idl_type.bson_serialization_type[0]
  
          if bson_type == "any":
              # For 'any', a deserializer is required but the user can try to get away with the default
              # serialization for their C++ type.
              if idl_type.deserializer is None:
                  ctxt.add_missing_ast_required_field_error(idl_type, syntax_type, idl_type.name,
                                                            "deserializer")
          elif bson_type == "chain":
              _validate_chain_type_properties(ctxt, idl_type, syntax_type)
  
          elif bson_type == "string":
              # Strings support custom serialization unlike other non-object scalar types
              if idl_type.deserializer is None:
                  ctxt.add_missing_ast_required_field_error(idl_type, syntax_type, idl_type.name,
                                                            "deserializer")
  
          elif not bson_type in ["array", "object", "bindata"]:
              if idl_type.deserializer is None:
                  ctxt.add_missing_ast_required_field_error(idl_type, syntax_type, idl_type.name,
                                                            "deserializer")
  
              if idl_type.deserializer is not None and "BSONElement" not in idl_type.deserializer:
                  ctxt.add_not_custom_scalar_serialization_not_supported_error(
                      idl_type, syntax_type, idl_type.name, bson_type)
  
              if idl_type.serializer is not None:
                  ctxt.add_not_custom_scalar_serialization_not_supported_error(
                      idl_type, syntax_type, idl_type.name, bson_type)
  
          if bson_type == "bindata" and isinstance(idl_type, syntax.Type) and idl_type.default:
              ctxt.add_bindata_no_default(idl_type, syntax_type, idl_type.name)
  
      else:
          # Now, this is a list of scalar types
          if idl_type.deserializer is None:
              ctxt.add_missing_ast_required_field_error(idl_type, syntax_type, idl_type.name,
                                                        "deserializer")
  
      _validate_cpp_type(ctxt, idl_type, syntax_type)
function_tokens: def _validate_type_properties ( ctxt , idl_type , syntax_type ) : # type: (errors.ParserContext, Union[syntax.Type, ast.Type], str) -> None # pylint: disable=too-many-branches # Validate bson type restrictions if not _validate_bson_types_list ( ctxt , idl_type , syntax_type ) : return if len ( idl_type . bson_serialization_type ) == 1 : bson_type = idl_type . bson_serialization_type [ 0 ] if bson_type == "any" : # For 'any', a deserializer is required but the user can try to get away with the default # serialization for their C++ type. if idl_type . deserializer is None : ctxt . add_missing_ast_required_field_error ( idl_type , syntax_type , idl_type . name , "deserializer" ) elif bson_type == "chain" : _validate_chain_type_properties ( ctxt , idl_type , syntax_type ) elif bson_type == "string" : # Strings support custom serialization unlike other non-object scalar types if idl_type . deserializer is None : ctxt . add_missing_ast_required_field_error ( idl_type , syntax_type , idl_type . name , "deserializer" ) elif not bson_type in [ "array" , "object" , "bindata" ] : if idl_type . deserializer is None : ctxt . add_missing_ast_required_field_error ( idl_type , syntax_type , idl_type . name , "deserializer" ) if idl_type . deserializer is not None and "BSONElement" not in idl_type . deserializer : ctxt . add_not_custom_scalar_serialization_not_supported_error ( idl_type , syntax_type , idl_type . name , bson_type ) if idl_type . serializer is not None : ctxt . add_not_custom_scalar_serialization_not_supported_error ( idl_type , syntax_type , idl_type . name , bson_type ) if bson_type == "bindata" and isinstance ( idl_type , syntax . Type ) and idl_type . default : ctxt . add_bindata_no_default ( idl_type , syntax_type , idl_type . name ) else : # Now, this is a list of scalar types if idl_type . deserializer is None : ctxt . add_missing_ast_required_field_error ( idl_type , syntax_type , idl_type . name , "deserializer" ) _validate_cpp_type ( ctxt , idl_type , syntax_type )