comparePaths
Compares two paths of a schema according to the order in which children are defined in said schema. Returns a value > 0 if path1 is greater than path2, < 0 if path2 if greater than path1, or 0 otherwise.
Consider the following classes and schema:
data class Person(var name: String, var pets: List<Pet>)
data class Pet(var name: String, var age: Int)
val formSchema = ClassSchema {
Person::name { StringSchema() }
Person::pets {
ListSchema {
ClassSchema {
Pet::name { StringSchema() }
Pet::age { IntSchema() }
}
}
}
}Content copied to clipboard
For the above schema, all the following are true:
/name>//pets>/name/pets/1>/pets/0/pets/1/name>/pets/1/pets/1/age>/pets/1/name