How to Inherit or Extend typeDefs in GraphQL

风格不统一 提交于 2019-12-01 04:23:33

extend is great if you have a base schema and want to build two or more usable schemas based on it. You can, for example, define a root Query type with queries shared by all schemas, and then extend it within each individual schema to add queries specific to that schema. It's meant as a mechanism to add functionality to existing types, rather than creating new types.

GraphQL does not inherently support inheritance. There is a library out there, however, that does add this functionality, if you're using GraphQL-JS. Link here. It adds both generic types and a way for types to inherit from another type.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!