Skip to content

Commit a2335f6

Browse files
xperiandriclaude
andcommitted
Updated client provider samples to the current sample server schemas
Regenerated `swapi_schema.json` and the chat app `schema-snapshot.json` from the sample servers with the standard introspection query. The previous files predated the `DateTimeOffset`, `DateOnly` and `TimeOnly` scalars and, for the Star Wars schema, `Human.friends` being a Relay connection. `documentId` is no longer stored: it is a per-process randomized hash of the query, not part of the schema. Updated `field_aliases.fsx` and the README example to query `friends` through `edges` and `node`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent f13549b commit a2335f6

4 files changed

Lines changed: 475 additions & 104 deletions

File tree

‎README.md‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,17 @@ let operation =
191191
appearsIn
192192
homePlanet
193193
friends {
194-
... on Human {
195-
name
196-
homePlanet
197-
}
198-
... on Droid {
199-
name
200-
primaryFunction
194+
edges {
195+
node {
196+
... on Human {
197+
name
198+
homePlanet
199+
}
200+
... on Droid {
201+
name
202+
primaryFunction
203+
}
204+
}
201205
}
202206
}
203207
}
@@ -225,8 +229,8 @@ printfn "Custom data: %A\n" result.CustomData
225229
// {Name = Some "Darth Vader";
226230
// AppearsIn = [|NewHope; Empire; Jedi|];
227231
// HomePlanet = Some "Tatooine";
228-
// Friends = [|Some {Name = Some "Wilhuff Tarkin";
229-
// HomePlanet = <null>;}|];};}
232+
// Friends = {Edges = [|{Node = {Name = Some "Wilhuff Tarkin";
233+
// HomePlanet = <null>;};}|];};};}
230234
231235
// Errors: <null>
232236

‎samples/chat-app/client/TestData/schema-snapshot.json‎

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{
2525
"kind": "SCALAR",
2626
"name": "String",
27-
"description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",
27+
"description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The `String` type is most often used by GraphQL to represent free-form human-readable text.",
2828
"fields": null,
2929
"inputFields": null,
3030
"interfaces": null,
@@ -54,7 +54,7 @@
5454
{
5555
"kind": "SCALAR",
5656
"name": "ID",
57-
"description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.",
57+
"description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The `ID` type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.",
5858
"fields": null,
5959
"inputFields": null,
6060
"interfaces": null,
@@ -63,8 +63,28 @@
6363
},
6464
{
6565
"kind": "SCALAR",
66-
"name": "Date",
67-
"description": "The `Date` scalar type represents a Date value with Time component. The Date type appears in a JSON response as a String representation compatible with ISO-8601 format.",
66+
"name": "DateTimeOffset",
67+
"description": "The `DateTimeOffset` scalar type represents a Date value with Time component. The `DateTimeOffset` type appears in a JSON response as a String representation compatible with ISO-8601 format.",
68+
"fields": null,
69+
"inputFields": null,
70+
"interfaces": null,
71+
"enumValues": null,
72+
"possibleTypes": null
73+
},
74+
{
75+
"kind": "SCALAR",
76+
"name": "DateOnly",
77+
"description": "The `DateOnly` scalar type represents a Date value without Time component. The `DateOnly` type appears in a JSON response as a `String` representation of full-date value as specified by [IETF 3339](https://www.ietf.org/rfc/rfc3339.txt).",
78+
"fields": null,
79+
"inputFields": null,
80+
"interfaces": null,
81+
"enumValues": null,
82+
"possibleTypes": null
83+
},
84+
{
85+
"kind": "SCALAR",
86+
"name": "TimeOnly",
87+
"description": "The `TimeOnly` scalar type represents a Time value without Date component. The `TimeOnly` type appears in a JSON response as a `String` representation of full-time value as specified by [IETF 3339](https://www.ietf.org/rfc/rfc3339.txt).",
6888
"fields": null,
6989
"inputFields": null,
7090
"interfaces": null,
@@ -74,7 +94,7 @@
7494
{
7595
"kind": "SCALAR",
7696
"name": "URI",
77-
"description": "The `URI` scalar type represents a string resource identifier compatible with URI standard. The URI type appears in a JSON response as a String.",
97+
"description": "The `URI` scalar type represents a string resource identifier compatible with URI standard. The `URI` type appears in a JSON response as a String.",
7898
"fields": null,
7999
"inputFields": null,
80100
"interfaces": null,
@@ -411,7 +431,7 @@
411431
"name": "Boolean",
412432
"ofType": null
413433
},
414-
"defaultValue": "False"
434+
"defaultValue": "false"
415435
}
416436
],
417437
"type": {
@@ -442,7 +462,7 @@
442462
"name": "Boolean",
443463
"ofType": null
444464
},
445-
"defaultValue": "False"
465+
"defaultValue": "false"
446466
}
447467
],
448468
"type": {
@@ -1115,7 +1135,7 @@
11151135
{
11161136
"kind": "SCALAR",
11171137
"name": "Guid",
1118-
"description": "The `Guid` scalar type represents a Globaly Unique Identifier value. It's a 128-bit long byte key, that can be serialized to string.",
1138+
"description": "The `Guid` scalar type represents a Globally Unique Identifier value. It's a 128-bit long byte key, that can be serialized to string.",
11191139
"fields": null,
11201140
"inputFields": null,
11211141
"interfaces": null,
@@ -1349,7 +1369,7 @@
13491369
"name": null,
13501370
"ofType": {
13511371
"kind": "SCALAR",
1352-
"name": "Date",
1372+
"name": "DateTimeOffset",
13531373
"ofType": null
13541374
}
13551375
},
@@ -1444,7 +1464,7 @@
14441464
"name": null,
14451465
"ofType": {
14461466
"kind": "SCALAR",
1447-
"name": "Date",
1467+
"name": "DateTimeOffset",
14481468
"ofType": null
14491469
}
14501470
},
@@ -1535,7 +1555,7 @@
15351555
"name": null,
15361556
"ofType": {
15371557
"kind": "SCALAR",
1538-
"name": "Date",
1558+
"name": "DateTimeOffset",
15391559
"ofType": null
15401560
}
15411561
},
@@ -2570,6 +2590,5 @@
25702590
}
25712591
]
25722592
}
2573-
},
2574-
"documentId": -631396295
2575-
}
2593+
}
2594+
}

‎samples/client-provider/field_aliases.fsx‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ let operation =
1717
appearsIn
1818
homePlanet
1919
hisFriends: friends {
20-
... on Human {
21-
humanName: name
22-
appearsIn
23-
homePlanet
24-
}
25-
... on Droid {
26-
droidName: name
27-
appearsIn
28-
primaryFunction
20+
edges {
21+
node {
22+
... on Human {
23+
humanName: name
24+
appearsIn
25+
homePlanet
26+
}
27+
... on Droid {
28+
droidName: name
29+
appearsIn
30+
primaryFunction
31+
}
32+
}
2933
}
3034
}
3135
}
@@ -38,13 +42,13 @@ let result = operation.Run (ctx)
3842

3943
let hisName = result.Data.Value.MyHero.Value.HisName.Value
4044

41-
let hisFriends = result.Data.Value.MyHero.Value.HisFriends |> Array.choose id
45+
let hisFriends = result.Data.Value.MyHero.Value.HisFriends.Edges
4246

4347
let humanFriendNames =
44-
hisFriends |> Array.choose (fun f -> f.TryAsHuman ()) |> Array.map (fun h -> h.HumanName)
48+
hisFriends |> Array.choose (fun e -> e.Node.TryAsHuman ()) |> Array.map (fun h -> h.HumanName)
4549

4650
let droidFriendNames =
47-
hisFriends |> Array.choose (fun f -> f.TryAsDroid ()) |> Array.map (fun h -> h.DroidName)
51+
hisFriends |> Array.choose (fun e -> e.Node.TryAsDroid ()) |> Array.map (fun h -> h.DroidName)
4852

4953
printfn "His name: %s" hisName
5054

0 commit comments

Comments
 (0)