graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

Automatically show description from interface

Open olivernybroe opened this issue 3 years ago • 5 comments

When implementing an interface it would be nice to automatically see the description of that interface on the implementation. This should only be shown if the implemented field does not have its own description.

This should be fairly simple when dealing with a single interface, the biggest problem is what to do when multiple interfaces has the same field with different descriptions. I would suggest as the first implementation of this to simply do nothing in that case or to take the first interface and use that.

olivernybroe avatar Jun 20 '22 09:06 olivernybroe

In order to be consistent and avoid ambiguity, I would always mark descriptions coming from an implemented interface explicitly as such. Here is a quick & dirty visual mockup I made:

image

spawnia avatar Jun 20 '22 10:06 spawnia

@sgrove from onegraph suggested this very idea years ago, I agree - it‘s a natural choice!

acao avatar Jun 20 '22 11:06 acao

At least currently this means we need to copy/paste descriptions from interfaces to implementation for making a better user experience, but with this, that would be unneeded 👀

olivernybroe avatar Jun 20 '22 12:06 olivernybroe

@olivernybroe this was also in @orta's original redesign from 2019/2020! There was resounding support for this then. There are forked versions of graphiql that do this as well.

We should target this for a 2.x version if not 2.0.0 itself. I would like to add it to the legacy DocExplorer as well, which will continue to be shipped from @graphiql/react

acao avatar Jun 25 '22 09:06 acao

@dotansimha @n1ru4l isn't this something y'all have implemented in your modular graphiql fork?

acao avatar Jun 25 '22 09:06 acao