What is the best way to define a polymorphic relationship? I created the models and they are inheriting from the same base class, but then how do I define a ToOne relationship?
I tried using the base class, like (where Group is my base class):
override open class var fields: [Field] {
return fieldsFromDictionary([
"group": ToOneRelationship(Group.self)
])
}
But then the deserializer gets the resourceType from the base class, even if I register only the child class.
What is the best way to define a polymorphic relationship? I created the models and they are inheriting from the same base class, but then how do I define a ToOne relationship?
I tried using the base class, like (where
Group
is my base class):But then the deserializer gets the
resourceType
from the base class, even if I register only the child class.