Skip to content

Commit bb45a6f

Browse files
committed
Merge pull request #157 from facebook/re-chapter
Minor adjustments to chapter formatting
2 parents 3b08851 + 716bc0a commit bb45a6f

6 files changed

+115
-30
lines changed

spec/Section 2 -- Language.md

+30-20
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Note: GraphQL intentionally does not consider Unicode "Zs" category characters
5252
as white-space, avoiding misinterpretation by text editors and source
5353
control tools.
5454

55+
5556
### Line Terminators
5657

5758
LineTerminator ::
@@ -186,7 +187,7 @@ multiple operations to a GraphQL service, the name of the desired operation to
186187
be executed must also be provided.
187188

188189

189-
### Operations
190+
## Operations
190191

191192
OperationDefinition :
192193
- OperationType Name? VariableDefinitions? Directives? SelectionSet
@@ -231,7 +232,7 @@ For example, this unnamed query operation is written via query shorthand.
231232
Note: many examples below will use the query short-hand syntax.
232233

233234

234-
### Selection Sets
235+
## Selection Sets
235236

236237
SelectionSet : { Selection+ }
237238

@@ -255,7 +256,8 @@ under-fetching data.
255256
In this query, the `id`, `firstName`, and `lastName` fields form a selection
256257
set. Selection sets may also contain fragment references.
257258

258-
### Fields
259+
260+
## Fields
259261

260262
Field : Alias? Name Arguments? Directives? SelectionSet?
261263

@@ -312,7 +314,7 @@ unique identifier.
312314
```
313315

314316

315-
### Arguments
317+
## Arguments
316318

317319
Arguments : ( Argument+ )
318320

@@ -367,7 +369,7 @@ These two queries are semantically identical:
367369
```
368370

369371

370-
### Field Alias
372+
## Field Alias
371373

372374
Alias : Name :
373375

@@ -427,7 +429,7 @@ A field's response key is its alias if an alias is provided, and it is
427429
otherwise the field's name.
428430

429431

430-
### Fragments
432+
## Fragments
431433

432434
FragmentSpread : ... FragmentName Directives?
433435

@@ -517,7 +519,8 @@ fragment standardProfilePic on User {
517519
The queries `noFragments`, `withFragments`, and `withNestedFragments` all
518520
produce the same response object.
519521

520-
#### Type Conditions
522+
523+
### Type Conditions
521524

522525
TypeCondition : on NamedType
523526

@@ -576,7 +579,8 @@ will be present and `friends` will not.
576579
}
577580
```
578581

579-
#### Inline Fragments
582+
583+
### Inline Fragments
580584

581585
InlineFragment : ... TypeCondition? Directives? SelectionSet
582586

@@ -622,7 +626,7 @@ query inlineFragmentNoType($expandedInfo: Boolean) {
622626
```
623627

624628

625-
### Input Values
629+
## Input Values
626630

627631
Value[Const] :
628632
- [~Const] Variable
@@ -640,7 +644,8 @@ input values can be scalars, enumeration values, lists, or input objects.
640644
If not defined as constant (for example, in {DefaultValue}), input values can be
641645
specified as a variable. List and inputs objects may also contain variables (unless defined to be constant).
642646

643-
#### Int Value
647+
648+
### Int Value
644649

645650
IntValue :: IntegerPart
646651

@@ -656,7 +661,8 @@ NonZeroDigit :: Digit but not `0`
656661

657662
An Int number is specified without a decimal point or exponent (ex. `1`).
658663

659-
#### Float Value
664+
665+
### Float Value
660666

661667
FloatValue ::
662668
- IntegerPart FractionalPart
@@ -674,13 +680,15 @@ Sign :: one of + -
674680
A Float number includes either a decimal point (ex. `1.0`) or an exponent
675681
(ex. `1e50`) or both (ex. `6.0221413e23`).
676682

677-
#### Boolean Value
683+
684+
### Boolean Value
678685

679686
BooleanValue : one of `true` `false`
680687

681688
The two keywords `true` and `false` represent the two boolean values.
682689

683-
#### String Value
690+
691+
### String Value
684692

685693
StringValue ::
686694
- `""`
@@ -728,7 +736,7 @@ StringCharacter :: \ EscapedCharacter
728736
* Return the character value of {EscapedCharacter}.
729737

730738

731-
#### Enum Value
739+
### Enum Value
732740

733741
EnumValue : Name but not `true`, `false` or `null`
734742

@@ -740,7 +748,8 @@ necessary to supply an enumeration type name in the literal.
740748
An enum value cannot be "null" in order to avoid confusion. GraphQL
741749
does not supply a value literal to represent the concept {null}.
742750

743-
#### List Value
751+
752+
### List Value
744753

745754
ListValue[Const] :
746755
- [ ]
@@ -766,7 +775,8 @@ ListValue : [ Value+ ]
766775
* Append {value} to {inputList}.
767776
* Return {inputList}
768777

769-
#### Input Object Values
778+
779+
### Input Object Values
770780

771781
ObjectValue[Const] :
772782
- { }
@@ -814,7 +824,7 @@ ObjectValue : { ObjectField+ }
814824
* Return {inputObject}
815825

816826

817-
### Variables
827+
## Variables
818828

819829
Variable : $ Name
820830

@@ -857,7 +867,7 @@ size `60` width:
857867
}
858868
```
859869

860-
#### Variable use within Fragments
870+
** Variable use within Fragments **
861871

862872
Query variables can be used within fragments. Query variables have global scope
863873
with a given operation, so a variable used within a fragment must be declared
@@ -866,7 +876,7 @@ a variable is referenced in a fragment and is included by an operation that does
866876
not define that variable, the operation cannot be executed.
867877

868878

869-
### Input Types
879+
## Input Types
870880

871881
Type :
872882
- NamedType
@@ -907,7 +917,7 @@ Type : Type !
907917
* Return {type}
908918

909919

910-
### Directives
920+
## Directives
911921

912922
Directives : Directive+
913923

spec/Section 3 -- Type System.md

+22-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ any built in types (including Scalar and Introspection types).
2222
All directives within a GraphQL schema must have unique names. A directive
2323
and a type may share the same name, since there is no ambiguity between them.
2424

25+
2526
## Types
2627

2728
The fundamental unit of any GraphQL Schema is the type. There are eight kinds
@@ -59,6 +60,7 @@ Finally, oftentimes it is useful to provide complex structs as inputs to
5960
GraphQL queries; the `Input Object` type allows the schema to define exactly
6061
what data is expected from the client in these queries.
6162

63+
6264
### Scalars
6365

6466
As expected by the name, a scalar represents a primitive value in GraphQL.
@@ -113,13 +115,14 @@ and floating-point values, they are interpreted as an integer input value if
113115
they have an empty fractional part (ex. `1.0`) and otherwise as floating-point
114116
input value.
115117

116-
#### Built-in Scalars
118+
**Built-in Scalars**
117119

118120
GraphQL provides a basic set of well-defined Scalar types. A GraphQL server
119121
should support all of these types, and a GraphQL server which provide a type by
120122
these names must adhere to the behavior described below.
121123

122-
##### Int
124+
125+
#### Int
123126

124127
The Int scalar type represents a signed 32-bit numeric non-fractional values.
125128
Response formats that support a 32-bit integer or a number type should use
@@ -143,7 +146,8 @@ Note: Numeric integer values larger than 32-bit should either use String or a
143146
custom-defined Scalar type, as not all platforms and transports support
144147
encoding integer numbers larger than 32-bit.
145148

146-
##### Float
149+
150+
#### Float
147151

148152
The Float scalar type represents signed double-precision fractional values
149153
as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).
@@ -165,7 +169,8 @@ other input values, including strings with numeric content, must raise a query
165169
error indicating an incorrect type. If the integer input value represents a
166170
value not representable by IEEE 754, a query error should be raised.
167171

168-
##### String
172+
173+
#### String
169174

170175
The String scalar type represents textual data, represented as UTF-8 character
171176
sequences. The String type is most often used by GraphQL to represent free-form
@@ -185,7 +190,8 @@ When expected as an input type, only valid UTF-8 string input values are
185190
accepted. All other input values must raise a query error indicating an
186191
incorrect type.
187192

188-
##### Boolean
193+
194+
#### Boolean
189195

190196
The Boolean scalar type represents `true` or `false`. Response formats should
191197
use a built-in boolean type if supported; otherwise, they should use their
@@ -202,7 +208,8 @@ otherwise they must raise a field error. Examples of this may include returning
202208
When expected as an input type, only boolean input values are accepted. All
203209
other input values must raise a query error indicating an incorrect type.
204210

205-
##### ID
211+
212+
#### ID
206213

207214
The ID scalar type represents a unique identifier, often used to refetch an
208215
object or as key for a cache. The ID type is serialized in the same way as
@@ -444,6 +451,7 @@ executor, so this is covered in that section of the spec.
444451

445452
Objects are never valid inputs.
446453

454+
447455
#### Object Field Arguments
448456

449457
Object fields are conceptually functions which yield values. Occasionally object
@@ -484,13 +492,15 @@ May yield the result:
484492

485493
The type of an object field argument can be any Input type.
486494

495+
487496
#### Object Field deprecation
488497

489498
Fields in an object may be marked as deprecated as deemed necessary by the
490499
application. It is still legal to query for these fields (to ensure existing
491500
clients are not broken by the change), but the fields should be appropriately
492501
treated in documentation and tooling.
493502

503+
494504
#### Object type validation
495505

496506
Object types have the potential to be invalid if incorrectly defined. This set
@@ -618,6 +628,7 @@ is the same as the result coercion of the object.
618628

619629
Interfaces are never valid inputs.
620630

631+
621632
#### Interface type validation
622633

623634
Interface types have the potential to be invalid if incorrectly defined.
@@ -699,6 +710,7 @@ same as the result coercion of the object.
699710

700711
Unions are never valid inputs.
701712

713+
702714
#### Union type validation
703715

704716
Union types have the potential to be invalid if incorrectly defined.
@@ -793,6 +805,7 @@ the only item in the list. This is to allow inputs that accept a "var args"
793805
to declare their input type as a list; if only one argument is passed (a common
794806
case), the client can just pass that value rather than constructing the list.
795807

808+
796809
### Non-Null
797810

798811
By default, all types in GraphQL are nullable; the {null} value is a valid
@@ -858,6 +871,7 @@ engine supports.
858871

859872
GraphQL implementations should provide the `@skip` and `@include` directives.
860873

874+
861875
### @skip
862876

863877
The `@skip` directive may be provided for fields, fragment spreads, and
@@ -873,6 +887,7 @@ query myQuery($someTest: Boolean) {
873887
}
874888
```
875889

890+
876891
### @include
877892

878893
The `@include` directive may be provided for fields, fragment spreads, and
@@ -891,7 +906,7 @@ query myQuery($someTest: Boolean) {
891906
In the case that both the `@skip` and `@include` directives are provided in the same context, the field or fragment *must* be queried only if the `@skip` condition is false *and* the `@include` condition is true. Stated conversely, the field/fragment must *not* be queried if either the `@skip` condition is true *or* the `@include` condition is false.
892907

893908

894-
## Starting types
909+
## Initial types
895910

896911
A GraphQL schema includes types, indicating where query and mutation
897912
operations start. This provides the initial entry points into the

0 commit comments

Comments
 (0)