Skip to content

Commit b51ae9c

Browse files
committed
lots of small docs tweaks
1 parent b09ac26 commit b51ae9c

7 files changed

+28
-14
lines changed

site/docs/APIReference-Utilities.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: graphql/utilities
33
layout: ../_core/CodeLayout
44
category: API Reference
55
permalink: /docs/api-reference-utilities/
6-
sublinks: introspectionQuery,buildClientSchema,printSchema,printIntrospectionSchema,buildASTSchema,typeFromAST,astFromValue,TypeInfo,isValidJSValue,isValidLiteralValue
6+
sublinks: introspectionQuery,buildClientSchema,printSchema,printIntrospectionSchema,buildASTSchema,typeFromAST,astFromValue,TypeInfo,isValidJSValue,isValidLiteralValue,buildSchema
77
next: /docs/api-reference-validation/
88
---
99

@@ -37,6 +37,12 @@ var GraphQLUtilities = require('graphql/utilities'); // CommonJS
3737
*Schema Language*
3838

3939
<ul class="apiIndex">
40+
<li>
41+
<a href="#buildschema">
42+
<pre>function buildSchema</pre>
43+
Builds a Schema object from GraphQL schema language.
44+
</a>
45+
</li>
4046
<li>
4147
<a href="#printschema">
4248
<pre>function printSchema</pre>
@@ -126,6 +132,14 @@ server-internal mechanisms.
126132

127133
## Schema Representation
128134

135+
### buildSchema
136+
137+
```js
138+
function buildSchema(source: string | Source): GraphQLSchema {
139+
```
140+
141+
Creates a GraphQLSchema object from GraphQL schema language. 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).
142+
129143
### printSchema
130144
131145
```js

site/docs/Guides-ConstructingTypes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var fakeDatabase = {
4141
};
4242

4343
var root = {
44-
user: function({id}) {
44+
user: function ({id}) {
4545
return fakeDatabase[id];
4646
}
4747
};

site/docs/Tutorial-Authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function loggingMiddleware(req, res, next) {
3030
}
3131

3232
var root = {
33-
ip: function(args, request) {
33+
ip: function (args, request) {
3434
return request.ip;
3535
}
3636
};

site/docs/Tutorial-GraphQLClients.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ xhr.responseType = 'json';
3131
xhr.open("POST", "/graphql");
3232
xhr.setRequestHeader("Content-Type", "application/json");
3333
xhr.setRequestHeader("Accept", "application/json");
34-
xhr.onload = function() {
34+
xhr.onload = function () {
3535
console.log('data returned:', xhr.response);
3636
}
3737
xhr.send(JSON.stringify({query:"{ hello }"}));

site/docs/Tutorial-Mutations.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Both mutations and queries can be handled by root resolvers, so the root that im
2525
```javascript
2626
var fakeDatabase = {};
2727
var root = {
28-
setMessage: function({message}) {
28+
setMessage: function ({message}) {
2929
fakeDatabase.message = message;
3030
}
31-
getMessage: function() {
31+
getMessage: function () {
3232
return fakeDatabase.message;
3333
}
3434
};
@@ -87,16 +87,16 @@ var fakeDatabase = {};
8787

8888
// The root provides the top-level API endpoints
8989
var root = {
90-
getMessage: function({author}) {
90+
getMessage: function ({author}) {
9191
return fakeDatabase[author];
9292
},
93-
createMessage: function({message}) {
93+
createMessage: function ({message}) {
9494
if (fakeDatabase[message.author]) {
9595
throw new Error('a message already exists with this author');
9696
}
9797
fakeDatabase[message.author] = message.content;
9898
},
99-
updateMessage: function({message}) {
99+
updateMessage: function ({message}) {
100100
if (!fakeDatabase[message.author]) {
101101
throw new Error('no message exists with this author');
102102
}

site/docs/Tutorial-ObjectTypes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class RandomDie {
5050
}
5151

5252
var root = {
53-
getDie: function({numSides}) {
53+
getDie: function ({numSides}) {
5454
return new RandomDie(numSides || 6);
5555
}
5656
}
@@ -111,7 +111,7 @@ class RandomDie {
111111

112112
// The root provides the top-level API endpoints
113113
var root = {
114-
getDie: function({numSides}) {
114+
getDie: function ({numSides}) {
115115
return new RandomDie(numSides || 6);
116116
}
117117
}

site/docs/Tutorial-PassingArguments.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ So far, our resolver functions took no arguments. When a resolver takes argument
2828

2929
```javascript
3030
var root = {
31-
rollDice: function(args) {
31+
rollDice: function (args) {
3232
var output = [];
3333
for (var i = 0; i < args.numDice; i++) {
3434
output.push(1 + Math.floor(Math.random() * (args.numSides || 6)));
@@ -42,7 +42,7 @@ It's convenient to use [ES6 destructuring assignment](https://developer.mozilla.
4242

4343
```javascript
4444
var root = {
45-
rollDice: function({numDice, numSides}) {
45+
rollDice: function ({numDice, numSides}) {
4646
var output = [];
4747
for (var i = 0; i < numDice; i++) {
4848
output.push(1 + Math.floor(Math.random() * (numSides || 6)));
@@ -70,7 +70,7 @@ var schema = buildSchema(`
7070

7171
// The root provides a resolver function for each API endpoint
7272
var root = {
73-
rollDice: function({numDice, numSides}) {
73+
rollDice: function ({numDice, numSides}) {
7474
var output = [];
7575
for (var i = 0; i < numDice; i++) {
7676
output.push(1 + Math.floor(Math.random() * (numSides || 6)));

0 commit comments

Comments
 (0)