-
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
Learn-Validation.md #56
Conversation
Signed-off-by: Jonir Rings <peterpuyi@live.cn>
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.
需要校对
site/learn/Learn-Validation.md
Outdated
@@ -91,8 +73,7 @@ Hero returns a `Character`, and we've been requesting fields like `name` and | |||
} | |||
``` | |||
|
|||
Similarly, if a field is a scalar, it doesn't make sense to query for | |||
additional fields on it, and doing so will make the query invalid: | |||
类似的,如果一个字段是标量,进一步查询它上面的字段也没有意义,这样做也会导致查询无效: |
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.
原文是副词,这里就用“类似地”就好吧
site/learn/Learn-Validation.md
Outdated
To start, let's take a complex valid query. This is a nested query, similar to | ||
an example from the previous section, but with the duplicated fields factored | ||
out into a fragment: | ||
对于我们的《星球大战》的案例,[starWarsValidation-test.js](https://github.com/graphql/graphql-js/blob/master/src/__tests__/starWarsValidation-test.js)这个文件包含一些查询,演示了各种无效查询,它也是一个测试文件,用于检测参考实现的验证器。 |
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.
- 链接和中文之间加上一个空格
- “包含一些查询,演示了各种无效查询” => “包含了若干对于各种无效查询的演示”
site/learn/Learn-Validation.md
Outdated
given type. So as `hero` returns a `Character`, we have to query for a field | ||
on `Character`. That type does not have a `favoriteSpaceship` field, so this | ||
query is invalid: | ||
查询字段的时候,我们只能查询给定类型上的字段。因此由于 `hero` 返回 `Character`类型,我们只能查询 `Character` 上的字段。因为这个类型上没有 `favoriteSpaceship` 字段,所以这个查询是无效的: |
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.
第一个Character
后加空格
site/learn/Learn-Validation.md
Outdated
or an enum, we need to specify what data we want to get back from the field. | ||
Hero returns a `Character`, and we've been requesting fields like `name` and | ||
`appearsIn` on it; if we omit that, the query will not be valid: | ||
当我们查询一个字段时,如果其返回值不是标量或者枚举型,那我们就需要指明想要从这个字段中获取的数据。`hero` 返回 `Character`类型,我们也请求了像是 `name` 和`appearsIn` 的字段;但如果将其省略,这个查询就变无效的了: | ||
|
||
```graphql | ||
# { "graphiql": true } |
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.
这里也有一句注释,下面还有几处,就不重复了
site/learn/Learn-Validation.md
Outdated
given type. So as `hero` returns a `Character`, we have to query for a field | ||
on `Character`. That type does not have a `favoriteSpaceship` field, so this | ||
query is invalid: | ||
查询字段的时候,我们只能查询给定类型上的字段。因此由于 `hero` 返回 `Character`类型,我们只能查询 `Character` 上的字段。因为这个类型上没有 `favoriteSpaceship` 字段,所以这个查询是无效的: | ||
|
||
```graphql | ||
# { "graphiql": true } |
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.
这里有一句注释也翻译一下吧
site/learn/Learn-Validation.md
Outdated
or an enum, we need to specify what data we want to get back from the field. | ||
Hero returns a `Character`, and we've been requesting fields like `name` and | ||
`appearsIn` on it; if we omit that, the query will not be valid: | ||
当我们查询一个字段时,如果其返回值不是标量或者枚举型,那我们就需要指明想要从这个字段中获取的数据。`hero` 返回 `Character`类型,我们也请求了像是 `name` 和`appearsIn` 的字段;但如果将其省略,这个查询就变无效的了: |
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.
- 第一个
Character
后加空格 - 我们也请求了“其中”像是……
- 这个查询就变“成”无效的了
site/learn/Learn-Validation.md
Outdated
@@ -91,8 +73,7 @@ Hero returns a `Character`, and we've been requesting fields like `name` and | |||
} | |||
``` | |||
|
|||
Similarly, if a field is a scalar, it doesn't make sense to query for | |||
additional fields on it, and doing so will make the query invalid: | |||
类似的,如果一个字段是标量,进一步查询它上面的字段也没有意义,这样做也会导致查询无效: |
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.
原文是副词,这里就用“类似地”就好吧
site/learn/Learn-Validation.md
Outdated
[validation](https://github.com/graphql/graphql-js/blob/master/src/validation) | ||
directory in GraphQL.js contains code implementing a | ||
specification-compliant GraphQL validator. | ||
这只是验正系统的冰山一角;事实上需要一大套验正规则才能保证 GraphQL 查询的语义意义。规范中的“验证”章节有关于本话题更详细的内容,GraphQL.js 的 [validation](https://github.com/graphql/graphql-js/blob/master/src/validation) 目录包含了规范兼容的 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.
“验正”=>“验证”,不是换成五笔了么😂
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.
换了,这可能是脑子没转过去。:joy:
已修正,有劳再次审核 |
site/learn/Learn-Validation.md
Outdated
[validation](https://github.com/graphql/graphql-js/blob/master/src/validation) | ||
directory in GraphQL.js contains code implementing a | ||
specification-compliant GraphQL validator. | ||
这只是验正系统的冰山一角;事实上需要一大套验证规则才能保证 GraphQL 查询的语义意义。规范中的“验证”章节有关于本话题更详细的内容,GraphQL.js 的 [validation](https://github.com/graphql/graphql-js/blob/master/src/validation) 目录包含了规范兼容的 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.
第五个字,还有一个“验正”
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>
pr晚了,有劳校对
close #12