+2
-1
src/swell/executor.gleam
+2
-1
src/swell/executor.gleam
···
567
567
option.Some(t) -> t
568
568
option.None -> field_type_def
569
569
}
570
-
let type_to_use = case schema.is_union(unwrapped_type)
570
+
let type_to_use = case
571
+
schema.is_union(unwrapped_type)
571
572
{
572
573
True -> {
573
574
// Create context with the field value for type resolution
+31
-29
test/executor_test.gleam
+31
-29
test/executor_test.gleam
···
1375
1375
// Create query type returning a list of edges
1376
1376
let query_type =
1377
1377
schema.object_type("Query", "Root query type", [
1378
-
schema.field("notifications", schema.list_type(edge_type), "Get notifications", fn(
1379
-
_ctx,
1380
-
) {
1381
-
Ok(
1382
-
value.List([
1383
-
value.Object([
1384
-
#(
1385
-
"node",
1386
-
value.Object([
1387
-
#("type", value.String("Like")),
1388
-
#("uri", value.String("at://user/like/1")),
1389
-
]),
1390
-
),
1391
-
#("cursor", value.String("cursor1")),
1378
+
schema.field(
1379
+
"notifications",
1380
+
schema.list_type(edge_type),
1381
+
"Get notifications",
1382
+
fn(_ctx) {
1383
+
Ok(
1384
+
value.List([
1385
+
value.Object([
1386
+
#(
1387
+
"node",
1388
+
value.Object([
1389
+
#("type", value.String("Like")),
1390
+
#("uri", value.String("at://user/like/1")),
1391
+
]),
1392
+
),
1393
+
#("cursor", value.String("cursor1")),
1394
+
]),
1395
+
value.Object([
1396
+
#(
1397
+
"node",
1398
+
value.Object([
1399
+
#("type", value.String("Follow")),
1400
+
#("uri", value.String("at://user/follow/1")),
1401
+
]),
1402
+
),
1403
+
#("cursor", value.String("cursor2")),
1404
+
]),
1392
1405
]),
1393
-
value.Object([
1394
-
#(
1395
-
"node",
1396
-
value.Object([
1397
-
#("type", value.String("Follow")),
1398
-
#("uri", value.String("at://user/follow/1")),
1399
-
]),
1400
-
),
1401
-
#("cursor", value.String("cursor2")),
1402
-
]),
1403
-
]),
1404
-
)
1405
-
}),
1406
+
)
1407
+
},
1408
+
),
1406
1409
])
1407
1410
1408
1411
let test_schema = schema.schema(query_type, None)
···
1445
1448
// __typename should be "Like" (resolved from union)
1446
1449
case list.key_find(node_fields, "__typename") {
1447
1450
Ok(value.String("Like")) -> should.be_true(True)
1448
-
Ok(value.String(other)) ->
1449
-
should.equal(other, "Like")
1451
+
Ok(value.String(other)) -> should.equal(other, "Like")
1450
1452
_ -> should.fail()
1451
1453
}
1452
1454
// uri should be resolved from inline fragment