在 GraphQL 模式文档注释中,你如何 link 到一个类型?
In a GraphQL schema documentation comment, how do you link to a type?
GraphQL 模式中的注释在 Markdown 中,因此您可以在其中放置 links。我希望注释中的 link 指向另一种类型,这样文档的读者就可以从一种类型浏览到另一种类型。
例如,我试过这个:
"""
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 中,这被正确地转换为 link 但目的地是错误的。
恐怕这不太可能,但我还是想问问! :)
如果您静态生成文档,您可能会包含在该上下文中有效的相关链接。但是,GraphiQL 目前不支持对特定类型的深度链接,因此无法实现。
GraphQL 模式中的注释在 Markdown 中,因此您可以在其中放置 links。我希望注释中的 link 指向另一种类型,这样文档的读者就可以从一种类型浏览到另一种类型。
例如,我试过这个:
"""
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 中,这被正确地转换为 link 但目的地是错误的。
恐怕这不太可能,但我还是想问问! :)
如果您静态生成文档,您可能会包含在该上下文中有效的相关链接。但是,GraphiQL 目前不支持对特定类型的深度链接,因此无法实现。