mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
56 lines
1.4 KiB
Swift
56 lines
1.4 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
@testable import DivKit
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
import enum DivKit.Expression
|
|
|
|
public final class EntityWithRequiredProperty: Sendable {
|
|
public static let type: String = "entity_with_required_property"
|
|
public let property: Expression<String> // at least 1 char
|
|
|
|
public func resolveProperty(_ resolver: ExpressionResolver) -> String? {
|
|
resolver.resolveString(property)
|
|
}
|
|
|
|
static let propertyValidator: AnyValueValidator<String> =
|
|
makeStringValidator(minLength: 1)
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
property: try dictionary.getExpressionField("property", validator: Self.propertyValidator, context: context)
|
|
)
|
|
}
|
|
|
|
init(
|
|
property: Expression<String>
|
|
) {
|
|
self.property = property
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension EntityWithRequiredProperty: Equatable {
|
|
public static func ==(lhs: EntityWithRequiredProperty, rhs: EntityWithRequiredProperty) -> Bool {
|
|
guard
|
|
lhs.property == rhs.property
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension EntityWithRequiredProperty: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["type"] = Self.type
|
|
result["property"] = property.toValidSerializationValue()
|
|
return result
|
|
}
|
|
}
|