Given the opaque nature of JSON data the following could work nicely as an alternative allowing effective introspection.
type Lead {
...
data: LeadData
}
interface LeadData {
firstName: String
lastName: String
email: String
phone: String
}
type Buyer implements LeadData {
firstName: String
lastName: String
email: String
phone: String
}
type Seller implements LeadData {
firstName: String
lastName: String
email: String
phone: String
address: String
city: String
state: String
zip: String
numBedrooms: Integer
numBathrooms: Integer
}
This would allow us to query like so:
query {
lead(nodeId: "123") {
data {
firstName
lastName
email
phone
}
... on Seller {
address
city
}
}
}