Registered Connections should apply an Interface to the "from" Type signifying it has said connection #2027
Labels
Component: Connections
Issues related to connections
Component: Interfaces
Type: Enhancement
New feature or request
When registering a connection, it would be nice if the Type that the connection is coming from implemented an Interface to signify/document that the Type supports said connection.
Let's take Post Type and Taxonomy connections as an example.
We (as developers with prior WordPress experience) know that Posts have Categories and Tags, but we don't know what other Post Types (ContentNodes) have Category/Tag connections. And we also don't inherently know what other Post Types have connections with other Taxonomies. We can browse the Schema a bit to find out have to really know what we're looking for.
If each Post Type that had connections with Term Nodes implemented an Interface such as
NodeWithTermNodeConnection
we could search this type in a tool such as GraphiQL and find all Types that have connections with Terms.Let's look at this in SDL to better grasp the idea:
Then the Post Types that are connected with the Taxonomies could implement Interfaces like so:
Then we could query like so:
This would be a valid query. We could query nodes from the root and specify that we want the connected fields only if the node being returned had the connection we were interested in.
We would get a payload like so:
The text was updated successfully, but these errors were encountered: