There's an irritating de-sync that has happened between object class attributes and object mutation/creation functions in arcpy. Many accessible objects have attributes that will take a string literal flag that also exists as an instance attribute of the returned type, but the strings are different for access and creation.
For example, a Domain object is defined this way:
class Domain:
codedValues: dict[ValueType, str]
description: str
domainType: Literal["CodedValue", "Range"]
mergePolicy: Literal["AreaWeighted", "DefaultValue", "SumValues"]
name: str
owner: str
range: tuple[ValueType, ValueType]
splitPolicy: Literal["DefaultValue", "Duplicate", "GeometryRatio"]
type: DomainFieldType
While the CreateDomain function expects arguments to be formatted this way:
def CreateDomain(
in_workspace: Unknown | None = None,
domain_name: Unknown | None = None,
domain_description: Unknown | None = None,
field_type: Literal['SHORT', 'LONG', 'BIGINTEGER', 'FLOAT', 'DOUBLE', 'TEXT', 'DATE', 'DATEONLY', 'TIMEONLY'] | None = None,
domain_type: Literal['CODED', 'RANGE'] | None = None,
split_policy: Literal['DEFAULT', 'DUPLICATE', 'GEOMETRY_RATIO'] | None = None,
merge_policy: Literal['DEFAULT', 'SUM_VALUES', 'AREA_WEIGHTED'] | None = None
) -> Result1[str]
This means that "copying" attributes from a Domain object to another place required a ton of manual attribute mapping (CodedValue -> CODED, etc.)
I know this is because the internal schema of the CIM is represented using the strings that are shown in the class definition, but is there a good reason to not allow either string value to be used in the function call? Ideally, these flags would accept either representation of the field state, or be typed in a way that allows either string flag to be used since there is no real overlap between the two.