@@ -93,11 +93,14 @@ def _allow_controller_list(cls, value: Union[str, list]):
93
93
94
94
@model_validator (mode = "before" )
95
95
@classmethod
96
- def _allow_missing_controller (cls , values : dict ):
96
+ def _allow_missing_controller (cls , values : Union [ dict , "VerificationMethod" ] ):
97
97
"""Derive controller value from ID.
98
98
99
99
This validator handles a common DID Document mutation.
100
100
"""
101
+ if not isinstance (values , dict ):
102
+ values = values .__dict__
103
+
101
104
if "controller" not in values :
102
105
if "id" not in values :
103
106
raise ValueError (
@@ -113,8 +116,13 @@ def _allow_missing_controller(cls, values: dict):
113
116
114
117
@model_validator (mode = "before" )
115
118
@classmethod
116
- def _method_appears_to_contain_material (cls , values : dict ):
119
+ def _method_appears_to_contain_material (
120
+ cls , values : Union [dict , "VerificationMethod" ]
121
+ ):
117
122
"""Validate that the method appears to contain verification material."""
123
+ if not isinstance (values , dict ):
124
+ values = values .__dict__
125
+
118
126
if len (values ) < 4 :
119
127
raise ValueError (
120
128
"Key material expected, found: {}" .format (list (values .keys ()))
@@ -123,8 +131,11 @@ def _method_appears_to_contain_material(cls, values: dict):
123
131
124
132
@model_validator (mode = "after" )
125
133
@classmethod
126
- def _no_more_than_one_material_prop (cls , values : dict ):
134
+ def _no_more_than_one_material_prop (cls , values : Union [ dict , "VerificationMethod" ] ):
127
135
"""Validate that exactly one material property was specified on method."""
136
+ if not isinstance (values , dict ):
137
+ values = values .__dict__
138
+
128
139
set_material_properties = cls .material_properties & {
129
140
key for key , value in values .items () if value is not None
130
141
}
0 commit comments