GraphQL Relay Specification #Facebook Relay文档翻译#
2015-09-26 16:01
555 查看
原文地址
上一篇 Babel Relay Plugin
Relay文档翻译目录
The three core assumptions that Relay makes about a GraphQL server are that it
provides:
Relay使用的GraphQL server得满足以下三点核心假设:
A mechanism for refetching an object.
重新获取对象的机制
A description of how to page through connections.
如何在connection上进行分页描述
Structure around mutations to make them predictable.
对mutation进行结构化,让他们变得可预测
This example demonstrates all three of these assumptions.
下面的例子说明了这三点假设。
This example is not comprehensive, but it is designed to quickly introduce
these core assumptions, to provide some context before diving into
the more detailed specification or the library.
这个例子并不深刻,只是给你可以快速的预览,有助于你日后深入了解。
The premise of the example is that we want to use GraphQL to query for
information about ships and factions in the original Star Wars
trilogy.
例子的前提是我们希望用GraphQL来查询在星球大战三部曲中ships和factions的信息。
It is assumed that the reader is already familiar with GraphQL; if not,
the README for GraphQL.js is a
good place to start.
这里假设您已经熟悉GraphQL,如果不请阅读README GraphQL.js
It is also assumed that the reader is already familiar with Star Wars; if not,
the 1977 version of Star Wars is a good place to start, though the 1997
Special Edition will serve for the purposes of this document.
当然还希望您是了解星球大战的,如果不,1977、1997的版本您可以看看。
that a GraphQL server used by Relay should implement. The two core types
are a faction and a ship in the Star Wars universe, where a faction
has many ships associated with it. The schema below is the output of the
GraphQL.js
下面的schema被用于说明Relay使用的GraphQL server应该实现哪些功能。在星球大战中有两个核心类型faction和ship,一个faction可以有很多ship。以下schema是用过GraphQL.js
上一篇 Babel Relay Plugin
Relay文档翻译目录
The three core assumptions that Relay makes about a GraphQL server are that it
provides:
Relay使用的GraphQL server得满足以下三点核心假设:
A mechanism for refetching an object.
重新获取对象的机制
A description of how to page through connections.
如何在connection上进行分页描述
Structure around mutations to make them predictable.
对mutation进行结构化,让他们变得可预测
This example demonstrates all three of these assumptions.
下面的例子说明了这三点假设。
This example is not comprehensive, but it is designed to quickly introduce
these core assumptions, to provide some context before diving into
the more detailed specification or the library.
这个例子并不深刻,只是给你可以快速的预览,有助于你日后深入了解。
The premise of the example is that we want to use GraphQL to query for
information about ships and factions in the original Star Wars
trilogy.
例子的前提是我们希望用GraphQL来查询在星球大战三部曲中ships和factions的信息。
It is assumed that the reader is already familiar with GraphQL; if not,
the README for GraphQL.js is a
good place to start.
这里假设您已经熟悉GraphQL,如果不请阅读README GraphQL.js
It is also assumed that the reader is already familiar with Star Wars; if not,
the 1977 version of Star Wars is a good place to start, though the 1997
Special Edition will serve for the purposes of this document.
当然还希望您是了解星球大战的,如果不,1977、1997的版本您可以看看。
Schema
The schema described below will be used to demonstrate the functionalitythat a GraphQL server used by Relay should implement. The two core types
are a faction and a ship in the Star Wars universe, where a faction
has many ships associated with it. The schema below is the output of the
GraphQL.js
schemaPrinter.
下面的schema被用于说明Relay使用的GraphQL server应该实现哪些功能。在星球大战中有两个核心类型faction和ship,一个faction可以有很多ship。以下schema是用过GraphQL.js
schemaPrinter打印输出的。
interface Node { id: ID! } type Faction : Node { id: ID! name: String ships: ShipConnection } type Ship : Node { id: ID! name: String } type ShipConnection { edges: [ShipEdge] pageInfo: PageInfo! } type ShipEdge { cursor: String! node: Ship } type PageInfo { hasNextPage: Boolean! hasPreviousPage: Boolean! startCursor: String endCursor: String } type Query { rebels: Faction empire: Faction node(id: ID!): Node } input IntroduceShipInput { factionId: String! shipNamed: String! clientMutationId: String! } type IntroduceShipPayload { faction: Faction ship: Ship clientMutationId: String! } type Mutation { introduceShip(input: IntroduceShipInput!): IntroduceShipPayload }
相关文章推荐
- Facebook's New Real-time Messaging System: HBase to Store 135+ Billion Messages a Month
- Facebook获得TechCrunch Crunchies 2009最佳奖
- 网页上facebook分享功能具体实现
- JSONP获取Twitter和Facebook文章数的具体步骤
- iOS 5 cocos2d 游戏开发 3ff8 实战:第4章 你的第一个游戏
- 7月国外最新技术文章翻译汇总(IT技术)
- windows phone 8 的新特性
- Facebook图片存储架构技术全解析
- Facebook揭秘HipHop项目 PHP程序大提速
- 使用Html5开发Android和iOS应用:HBuilder、Html5Plus、MUI
- 基于 Facebook 的开发笔记
- Titanium 快速入门
- Titanium 用户界面之布局结构及核心代码块
- 月光微博客
- 月光微博客
- 月光微博客
- 月光微博客
- 月光微博客