parameters: (ctxt, idl_type, syntax_type)
return_statement: return True
docstring: Validate bson serialization type(s) is correct for a type.
docstring_summary: Validate bson serialization type(s) is correct for a type.
docstring_tokens: Validate bson serialization type ( s ) is correct for a type .
function: def _validate_bson_types_list(ctxt, idl_type, syntax_type):
      # type: (errors.ParserContext, Union[syntax.Type, ast.Type], str) -> bool
      """Validate bson serialization type(s) is correct for a type."""
  
      bson_types = idl_type.bson_serialization_type
      if len(bson_types) == 1:
          return _validate_single_bson_type(ctxt, idl_type, syntax_type)
  
      for bson_type in bson_types:
          if bson_type in ["any", "chain"]:
              ctxt.add_bad_any_type_use_error(idl_type, bson_type, syntax_type, idl_type.name)
              return False
  
          if not bson.is_valid_bson_type(bson_type):
              ctxt.add_bad_bson_type_error(idl_type, syntax_type, idl_type.name, bson_type)
              return False
  
          if not isinstance(idl_type, syntax.VariantType):
              if bson_type == "bindata":
                  ctxt.add_bad_bson_type_error(idl_type, syntax_type, idl_type.name, bson_type)
                  return False
  
              # Cannot mix non-scalar types into the list of types
              if not bson.is_scalar_bson_type(bson_type):
                  ctxt.add_bad_bson_scalar_type_error(idl_type, syntax_type, idl_type.name, bson_type)
                  return False
  
      return True
function_tokens: def _validate_bson_types_list ( ctxt , idl_type , syntax_type ) : # type: (errors.ParserContext, Union[syntax.Type, ast.Type], str) -> bool bson_types = idl_type . bson_serialization_type if len ( bson_types ) == 1 : return _validate_single_bson_type ( ctxt , idl_type , syntax_type ) for bson_type in bson_types : if bson_type in [ "any" , "chain" ] : ctxt . add_bad_any_type_use_error ( idl_type , bson_type , syntax_type , idl_type . name ) return False if not bson . is_valid_bson_type ( bson_type ) : ctxt . add_bad_bson_type_error ( idl_type , syntax_type , idl_type . name , bson_type ) return False if not isinstance ( idl_type , syntax . VariantType ) : if bson_type == "bindata" : ctxt . add_bad_bson_type_error ( idl_type , syntax_type , idl_type . name , bson_type ) return False # Cannot mix non-scalar types into the list of types if not bson . is_scalar_bson_type ( bson_type ) : ctxt . add_bad_bson_scalar_type_error ( idl_type , syntax_type , idl_type . name , bson_type ) return False return True