Skip to content

Commit 07ca7ee

Browse files
committed
GraphQL: TMP add data (old changes)
1 parent 725d8f7 commit 07ca7ee

File tree

4 files changed

+119
-2
lines changed

4 files changed

+119
-2
lines changed

content/languages/graphql/idl/index.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ InputValueDefinition:
225225
Description* Name : Type DefaultValue* Directives*
226226
```
227227

228+
at least one field
229+
228230
- `NamedType` in `ImplementsInterfaces` must be name of an interface, see Abstract types
229231
- `Type` in `InputValueDefinition` must be an input type, see Input Type
230232

@@ -233,6 +235,9 @@ InputValueDefinition:
233235

234236
- interface: abstract object type
235237

238+
??? ~~restricts type hierarchies to a single level~~ can be multiple
239+
~~no inheritance~~ limited inheritance
240+
236241
```plaintext
237242
InterfaceTypeDefinition:
238243
Description* "interface" Name ImplementsInterfaces* Directives* FieldsDefinition*
@@ -392,6 +397,10 @@ InputFieldsDefinition:
392397

393398
## Directive
394399

400+
a way to extend the language
401+
allow tools to add custom behavior
402+
to just about any aspect of the type system
403+
395404
```plaintext
396405
DirectiveDefinition
397406
Description* "directive" @ Name ArgumentsDefinition* "on" DirectiveLocations
@@ -413,9 +422,16 @@ TypeSystemDirectiveLocation:
413422

414423
- name of directive must be unique, not start with two underscores since reserved for introspection
415424
- directive can't use other directive in argument that creates a cyclic reference, e.g. itself
425+
???
426+
can mark as `repeatable` to use multiple times
427+
order matters
416428
- built-in directives in any schema engine:
417429
- `@deprecated(reason: String)` on field or enum: marks field or enum value as deprecated in schema
418-
- beware: currently spec doesn't include `@deprecated` on argument, see [#525](https://github.com/graphql/graphql-spec/pull/525)
430+
@specifiedBy(url:) url of format of custom scalar
431+
??? Allows to use same name for multiple different types
432+
433+
434+
??? beware: currently spec doesn't include `@deprecated` on argument, see [#525](https://github.com/graphql/graphql-spec/pull/525)
419435

420436

421437

content/languages/graphql/index.md

+73-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,76 @@ tags:
99

1010
- API query language and IDL
1111
- API query language is designed for JSON responses
12-
- IDL makes documentation first-class, e.g. via introspection
12+
- IDL makes documentation first-class, e.g. via introspection
13+
14+
//// nordicapis
15+
16+
predetermined, knowable format
17+
18+
application layer query language
19+
20+
interprets strings from the client, and returns data in an understandable, predictable, pre-defined manner
21+
-> client specifiers what wants, gets what specifies
22+
23+
client defines the expected data format
24+
25+
single endpoint
26+
variable request call
27+
eliminates ad hoc endpoints and roundtrip object retrievals
28+
29+
layer between data and client, can transform, aggregate, bridge the gap, without either side having to sacrifice flexibility
30+
31+
single request, no n+1 problem
32+
automatically joins
33+
34+
allows to select subset
35+
allows to alias names
36+
37+
server publishes clear and explicit rules, types
38+
can validate query ahead of time against schema
39+
40+
introspect schema, understand API better, self-documenting
41+
42+
/// spec
43+
44+
a query language and execution engine
45+
46+
47+
///// ?
48+
49+
can save static query on server, just send identifier and variables from client
50+
51+
//// Lee Byron talk
52+
53+
- fast
54+
bundle multiple request and response in one
55+
describes what needs upfront
56+
single round trip
57+
can only get subset of what needs
58+
- robust
59+
response shape guarantees
60+
no crashes because unexpected format
61+
static types, schema
62+
- self-documenting
63+
no manual out-of-date documentation
64+
static analysis locally
65+
- faster development
66+
additional layer, decouples client further from server, aliasing, etc.
67+
68+
no need to version
69+
70+
//// benjie talk
71+
72+
tooling, linting, code generation works with any GraphQL API thanks to schema
73+
74+
//// meta guys talk
75+
76+
layer makes looser coupling, constant endpoint, etc.
77+
78+
separate problems of server from problems of client
79+
80+
/// yelp guy
81+
82+
if field is unexpectedly null, then sets parent to null, walks up the tree until fiends nullable field, never sends null where expected non-null
83+
84+
null in non-null field bubbles up to next nullable field

content/languages/graphql/introduction/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ ExecutableDefinition:
2323

2424
- beware: differs from spec, spec allows for partial documents and mixes of query language and IDL, here assume document contains either executable operations or single schema, see [#788](https://github.com/graphql/graphql-spec/issues/788#issuecomment-721298885) ⚠️
2525

26+
spec has multiple documents, i.e. grammar has multiple root nodes, doesn't make sense, should just have one root node and say can implement only some of the options, currently this is implcit outside the spec in the word "GraphQL" which might refer to any one of those 4 without further clarification
27+
2628

2729

2830
### Grammar

content/languages/graphql/query-language/index.md

+27
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,33 @@ query getUser ($showAge: Boolean) {
456456
- fragment can't use other fragment that creates a cyclic reference, e.g. itself
457457

458458

459+
@defer and @stream
460+
461+
for lowering time to response of expensive operations
462+
client says what isn't as important, what can be sent later, what can be deprioritized
463+
additional patches get sent over same connection
464+
?? errors stop the stream
465+
466+
over HTTP multipart response with chunked encoding
467+
see GraphQL over HTTP spec ?!?!
468+
469+
response object gets `hasNext` property, subsequent responses also a `path` where to apply the patch in previously received data
470+
471+
only on fragment spread or inline fragment
472+
can use fragment spread with single field
473+
474+
not allowed on root mutation field because would change the order
475+
476+
act as null boundaries, can't bubble up null since already sent previous patches
477+
sets whole data to null !?!
478+
also the error then stops the streaming !?!
479+
480+
481+
## Subscription
482+
483+
for long running events
484+
485+
459486

460487
## Resources
461488

0 commit comments

Comments
 (0)