@@ -187,15 +187,15 @@ def generate_build_input_code(expr, type, wrap: true)
187
187
end
188
188
end
189
189
190
- def deserialize_value_code ( field_name , expr , type , untyped : true )
190
+ def deserialize_value_code ( class_name , field_name , expr , type , untyped : true )
191
191
statements = ""
192
192
193
193
if untyped
194
194
json_type = swift_json_type ( type . unwrap_non_null , non_null : true )
195
195
statements << "if #{ expr } is NSNull { return nil }\n " unless type . non_null?
196
196
statements << <<-SWIFT
197
197
guard let value = #{ expr } as? #{ json_type } else {
198
- throw SchemaViolationError(type: type(of: self) , field: fieldName, value: fieldValue)
198
+ throw SchemaViolationError(type: #{ class_name } . self, field: fieldName, value: fieldValue)
199
199
}
200
200
SWIFT
201
201
expr = 'value'
@@ -208,7 +208,7 @@ def deserialize_value_code(field_name, expr, type, untyped: true)
208
208
when 'LIST'
209
209
untyped = !type . of_type . non_null?
210
210
rethrow = "try " if %w( OBJECT INTERFACE UNION ) . include? ( type . unwrap . kind ) || untyped
211
- sub_statements = "#{ rethrow } #{ expr } .map { #{ deserialize_value_code ( field_name , '$0' , type . of_type , untyped : untyped ) } }"
211
+ sub_statements = "#{ rethrow } #{ expr } .map { #{ deserialize_value_code ( class_name , field_name , '$0' , type . of_type , untyped : untyped ) } }"
212
212
sub_statements += " as [Any?]" if untyped
213
213
sub_statements
214
214
when 'OBJECT'
0 commit comments