I want to use graphql to replace an existing API and I am struggling with how to model the existing response. The API currently returns a list of things that can be of three types: Thing1, Thing2 or AlertThing. There may not be an AlertThing, but if there is, there is only one and it is the first item in the list.
Any suggestions how best to model this?
Should the schema enforce the list item types (and, if so, how??)?
Or should the schema be a a bit more relaxed and simply define the result list as being comprised of the three types and have the resolver enforce the "AlertThing-first-if-any" rule?
🤪