mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
69 lines
2.0 KiB
Swift
69 lines
2.0 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
public final class DivActionUpdateStructure: Sendable {
|
|
public static let type: String = "update_structure"
|
|
public let path: Expression<String> // regex: ^(?!/)(.+)(?<!/)$
|
|
public let value: DivTypedValue
|
|
public let variableName: Expression<String>
|
|
|
|
public func resolvePath(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(path)
|
|
}
|
|
|
|
public func resolveVariableName(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(variableName)
|
|
}
|
|
|
|
static let pathValidator: AnyValueValidator<String> =
|
|
makeStringValidator(regex: "^(?!/)(.+)(?<!/)$")
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
path: try dictionary.getExpressionField("path", validator: Self.pathValidator, context: context),
|
|
value: try dictionary.getField("value", transform: { (dict: [String: Any]) in try DivTypedValue(dictionary: dict, context: context) }, context: context),
|
|
variableName: try dictionary.getExpressionField("variable_name", context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
path: Expression<String>,
|
|
value: DivTypedValue,
|
|
variableName: Expression<String>
|
|
) {
|
|
self.path = path
|
|
self.value = value
|
|
self.variableName = variableName
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension DivActionUpdateStructure: Equatable {
|
|
public static func ==(lhs: DivActionUpdateStructure, rhs: DivActionUpdateStructure) -> Bool {
|
|
guard
|
|
lhs.path == rhs.path,
|
|
lhs.value == rhs.value,
|
|
lhs.variableName == rhs.variableName
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension DivActionUpdateStructure: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["type"] = Self.type
|
|
result["path"] = path.toValidSerializationValue()
|
|
result["value"] = value.toDictionary()
|
|
result["variable_name"] = variableName.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|