Currently this schema working properly and give required result
type Personal{
userId:String
name: String
email: String
}
type Contact{
mobile_no:String
email:String
}
type Address{
address:String
lat:String
long:String
}
getContact(userId: String): Contact
getPersonal(userId: String): Personal
getAddress(userId: String): Address
But I want to return
type Response {
status: Boolean
message: String
data: []
}
Return data with status and message key where data hold an array of Contact, Personal and Address objects.
without writing ResponseContact, ResponsePersonal and ResponseAddress
I have Idea to return scalar JSON
in data like this
scalar JSON
type Response {
status: Boolean
message: String
data: [JSON]
}
But the problem with this schema I can't use graphql second main point "Ask for what you want" Required result
type ResponseAddress {
status: Boolean
message: String
data: [Address]
}
type ResponsePersonal {
status: Boolean
message: String
data: [Personal]
}
type ResponseContact {
status: Boolean
message: String
data: [Contact]
}
getContact(userId: String): ResponseContact
getPersonal(userId: String): ResponsePersonal
getAddress(userId: String): ResponseAddress
without writing ResponseAddress, ResponsePersonal and ResponseContact.
Something like that
type Response {
status: Boolean
message: String
data: [Address|Personal|Contact]
}
getContact(userId: String): Response
getPersonal(userId: String): Response
getAddress(userId: String): Response
Of course above syntax are wrong.
Why:- Because I want to return this Response more places and don't want to long schema.
Point:- Is this possible or not?