简体   繁体   English

GraphQL和Relay中架构之间的区别

[英]Difference between schemas in GraphQL and Relay

The schemas of GraphQL and Relay differ a bit, like Relay has connections for example. GraphQL和Relay的架构略有不同,例如Relay具有连接。 Is it still possible to do queries to these nodes with cURL, for instance, on a Relay schema with connections? 是否仍然可以使用cURL对这些节点进行查询,例如,在具有连接的中继模式上? Or what is the best way to check if the schema is working accordingly? 还是检查模式是否相应工作的最佳方法是什么?

The schemas of GraphQL and Relay differ a bit GraphQL和Relay的架构略有不同

This isn't really a valid statement. 这实际上不是有效的声明。 GraphQL server defines a GraphQL schema, and Relay (a GraphQL client) uses that schema. GraphQL服务器定义一个GraphQL模式,然后Relay(一个GraphQL客户端)使用该模式。 It doesn't have any special version of it. 它没有任何特殊版本。

The Nodes, Connections and Object Mutations are Relay-specific extensions to the GraphQL schema. 节点,连接和对象突变是GraphQL模式的中继特定扩展 It means that if you want to use Relay, your schema needs to implement the GraphQL-Relay spec in addition to the raw GraphQL spec. 这意味着,如果要使用中继,则除了原始的GraphQL规范外,您的架构还需要实现GraphQL-Relay规范。 You can read more about them in the docs , or see the specs for the GraphQL Schema and the Nodes , Connections and Object Mutations extensions. 您可以在docs中阅读有关它们的更多信息,或查看GraphQL SchemaNodesConnectionsObject Mutations扩展的规范。

As for the second part of the question, you can interact with Relay-compliant GraphQL server the same way as with a pure GraphQL server. 至于问题的第二部分,您可以与与中继兼容的GraphQL服务器进行交互,方法与与纯GraphQL服务器相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM