-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APIReference-Utilities.md #70
Conversation
Signed-off-by: Jonir Rings <peterpuyi@live.cn>
@@ -40,37 +39,37 @@ var { introspectionQuery } = require('graphql'); // CommonJS | |||
<li> | |||
<a href="#buildschema"> | |||
<pre>function buildSchema</pre> | |||
Builds a Schema object from GraphQL schema language. | |||
基于 GraphQL schema languag 构建一个 Schema 对象。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
language 少了一个 e
@@ -81,7 +80,7 @@ var { introspectionQuery } = require('graphql'); // CommonJS | |||
<li> | |||
<a href="#typeinfo"> | |||
<pre>class TypeInfo</pre> | |||
Tracks type and field definitions during a visitor AST traversal.. | |||
在 visitor 遍历 AST 时追踪类型和字段定义。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visitor 可以翻译的吧?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我翻成了 访问方法,可以讨论统一一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
……这个不译比较好,是一个ast遍历用的类的实例。更多像是访问器吧?其实更像是个遍历用的游标?
@@ -92,13 +91,13 @@ var { introspectionQuery } = require('graphql'); // CommonJS | |||
<li> | |||
<a href="#isvalidjsvalue"> | |||
<pre>function isValidJSValue</pre> | |||
Determins if a JavaScript value is valid for a GraphQL type. | |||
判断一个 JavaScript 值是否是有效的 GraphQL 类型。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“值是有效的类型”有歧义,最后改成“……类型的值”如何
</a> | ||
</li> | ||
<li> | ||
<a href="#isvalidliteralvalue"> | ||
<pre>function isValidLiteralValue</pre> | ||
Determins if a literal value from an AST is valid for a GraphQL type. | ||
判断一个 AST 中的字面量值是否是有效的 GraphQL 类型。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
|
||
*Introspection* | ||
|
||
<ul class="apiIndex"> | ||
<li> | ||
<a href="#introspectionquery"> | ||
<pre>var introspectionQuery</pre> | ||
A GraphQL introspection query containing enough information to reproduce a type system. | ||
GraphQL 内省查询,包含足够的信息以重建类型系统。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“reproduce”翻译成“重现”比较好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可行
tools, but cannot be used to execute a query, as introspection does not | ||
represent the "resolver", "parse" or "serialize" functions or any other | ||
server-internal mechanisms. | ||
假设客户端有运行内省查询的结果,创建并返回了一个 GraphQLSchema 实例,这个实例可以用于所有的 GraphQL.js工具,但不能用于执行查询,因为内省并不代表有“解析器”、“分析”或者“序列化”函数,或者其他服务器内部机制。 | ||
|
||
## Schema Representation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
漏翻了
@@ -138,23 +132,23 @@ server-internal mechanisms. | |||
function buildSchema(source: string | Source): GraphQLSchema { | |||
``` | |||
|
|||
Creates a GraphQLSchema object from GraphQL schema language. The schema will use default resolvers. For more detail on the GraphQL schema language, see the [schema language docs](/learn/schema/) or this [schema language cheat sheet](https://wehavefaces.net/graphql-shorthand-notation-cheatsheet-17cd715861b6#.9oztv0a7n). | |||
基于 GraphQL schema language 创建一个 GraphQLSchema 对象。schema 将会使用默认解析器。关于 GraphQL schema language 的更多细节,请查看 [schema language 文档](/learn/schema/) 或者 [schema language 速查表](https://wehavefaces.net/graphql-shorthand-notation-cheatsheet-17cd715861b6#.9oztv0a7n)。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者后边多了一个空格
TypeInfo is a utility class which, given a GraphQL schema, can keep track | ||
of the current field and type definitions at any point in a GraphQL document | ||
AST during a recursive descent by calling `enter(node)` and `leave(node)`. | ||
TypeInfo 是一个工具类,在 GraphQL 文档 AST 的递归分析中的任何位置上,调用 `enter(node)` 和 `leave(node)` 的时候,可以追踪当前字段和类型定义。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given a GraphQL schema 漏了
Given a JavaScript value and a GraphQL type, determine if the value will be | ||
accepted for that type. This is primarily useful for validating the | ||
runtime values of query variables. | ||
给定一个 JavaScript 值和 GraphQL 类型,判断这个值是否能被这个类型接受。这个功能在验证运行时查询参数的时候特别有用。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runtime values 的 values 漏了
|
||
Note that this only validates literal values, variables are assumed to | ||
provide values of the correct type. | ||
注意,这个功能只验证字面量值,并假设变量值的是正确的类型。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“值的是”=>“指的是”?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“的”多余
Signed-off-by: Jonir Rings <peterpuyi@live.cn>
9003a3a
to
b595bc8
Compare
permalink: /graphql-js/utilities/ | ||
sublinks: astFromValue,buildASTSchema,buildClientSchema,buildSchema,introspectionQuery,isValidJSValue,isValidLiteralValue,printIntrospectionSchema,printSchema,typeFromAST,TypeInfo | ||
next: /graphql-js/validation/ | ||
--- | ||
|
||
The `graphql/utilities` module contains common useful computations to use with | ||
the GraphQL language and type objects. You can import either from the `graphql/utilities` module, or from the root `graphql` module. For example: | ||
`graphql/utilities` 模块包含用于 GraphQL 语言和类型对象的常用计算。你可以从 `graphql/utilities` 模块或是根 `graphql` 模块引入。如下: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
『根 graphql
模块』这里翻译成『根模块 graphql
』或者『graphql
根模块』是不是更通顺一点捏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后者吧~~
Signed-off-by: Jonir Rings <peterpuyi@live.cn>
@ydfzgyj 如果没什么疑问的话来 approve 一下吧。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visitor 的问题,请 @jonirrings @llp0574 你们两位用到这个词的商议一下怎么统一吧
@jonirrings 那就统一为不译吧 |
嗯嗯。@llp0574 。有劳修改 |
resolve #19 有劳审校