File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,22 @@ def __init__(
244244 self ._properties ["rangeElementType" ] = {"type" : range_element_type }
245245 if isinstance (range_element_type , FieldElementType ):
246246 self ._properties ["rangeElementType" ] = range_element_type .to_api_repr ()
247+ if isinstance (rounding_mode , RoundingMode ):
248+ self ._properties ["roundingMode" ] = rounding_mode .name
249+ if isinstance (rounding_mode , str ):
250+ self ._properties ["roundingMode" ] = rounding_mode
251+ if isinstance (foreign_type_definition , str ):
252+ self ._properties ["foreignTypeDefinition" ] = foreign_type_definition
253+
254+ # The order of operations is important:
255+ # If field_type is FOREIGN, then foreign_type_definition must be set.
256+ if field_type != "FOREIGN" :
257+ self ._properties ["type" ] = field_type
258+ else :
259+ if self ._properties .get ("foreignTypeDefinition" ) is None :
260+ raise ValueError (
261+ "If the 'field_type' is 'FOREIGN', then 'foreign_type_definition' is required."
262+ )
247263 if fields : # Don't set the property if it's not set.
248264 self ._properties ["fields" ] = [field .to_api_repr () for field in fields ]
249265
You can’t perform that action at this time.
0 commit comments