在 GraphQL 模式文档注释中,如何链接到类型?



GraphQL 模式中的注释位于 Markdown 中,因此您可以在其中放置链接。我希望在注释中为一种类型提供一个指向另一种类型的链接,以便文档的读者可以从一种类型浏览到另一种类型。

例如,我试过这个:

"""
A written or printed work consisting of pages glued or sewn together along one side and bound in covers.
A book has an [Author](Author).
"""
type Book {
id: ID
name: String
author: Author
}

在 GraphiQL 中,这被正确地转换为链接,但目的地是错误的。

恐怕这是不可能的,但我想我还是会问! :)

如果您静态生成文档,则可以包含在该上下文中工作的相对链接。但是,GraphiQL 目前不支持特定类型的深度链接,因此无法使其正常工作。

最新更新