I’ve been running Dgraph for a while in a PoC system, and I’m surprised to find that, in some data, some fields from a different type are in another type. In pseudocode, let say I have:
type Money {
o_amount: Int
o_currency: String
}
type Txn {
x_amount: Money
x_date: : String
}
type Message {
m_payload: String
}
The “bad” data I found:
Message:
m_payload: "Hello"
o_amount: 100
o_currency: "USD"
As you can see from the schema, o_*
are Money
fields, but for some reason exist in (some) Message
.
I’m sure it’s my code bug, but I’m only aware of this when I use expand(_all_)
(I usually spell out the fields I want).
My question:
How do I enforce schema so that an object can only use fields from its type?
Not only the field names, but also the type and whether it’s an array/not. I have another case where the data is an array []
instead of object {}
.