@@ -608,13 +608,17 @@ type PersonWithGuidId =
608608 { Id: Guid
609609 Name: string }
610610
611+ type PersonWithInt64Id =
612+ { Id: int64
613+ Name: string }
614+
611615[<Fact>]
612616let ``Execution handles ID scalar : serializes Guid field via AutoField`` () =
613617 let id1 = Guid.Parse " d6c684d9-aaaa-4e88-bbb2-0bb584f1661d"
614618 let id2 = Guid.Parse " d6c684d9-bbbb-4e88-bbb2-0bb584f1661d"
615619 let people =
616- [ { Id = id1; Name = " Person A" }
617- { Id = id2; Name = " Person B" } ]
620+ [ { PersonWithGuidId. Id = id1; Name = " Person A" }
621+ { PersonWithGuidId. Id = id2; Name = " Person B" } ]
618622
619623 let PersonType =
620624 Define.Object< PersonWithGuidId>(
@@ -642,17 +646,15 @@ let ``Execution handles ID scalar: serializes Guid field via AutoField`` () =
642646 data |> equals ( upcast expected)
643647
644648[<Fact>]
645- let ``Execution handles ID scalar : serializes Guid field via explicit Field resolve`` () =
646- let id1 = Guid.Parse " d6c684d9-aaaa-4e88-bbb2-0bb584f1661d"
647- let id2 = Guid.Parse " d6c684d9-bbbb-4e88-bbb2-0bb584f1661d"
649+ let ``Execution handles ID scalar : serializes int64 field via AutoField`` () =
648650 let people =
649- [ { Id = id1 ; Name = " Person A" }
650- { Id = id2 ; Name = " Person B" } ]
651+ [ { PersonWithInt64Id. Id = 1 L ; Name = " Person A" }
652+ { PersonWithInt64Id. Id = 2 L ; Name = " Person B" } ]
651653
652654 let PersonType =
653- Define.Object< PersonWithGuidId >(
654- " Person " ,
655- [ Define.Field ( " id" , IDType, fun _ ( p : PersonWithGuidId ) -> string p.Id )
655+ Define.Object< PersonWithInt64Id >(
656+ " Person2 " ,
657+ [ Define.AutoField ( " id" , IDType)
656658 Define.AutoField( " name" , StringType) ])
657659
658660 let QueryRoot =
@@ -666,8 +668,8 @@ let ``Execution handles ID scalar: serializes Guid field via explicit Field reso
666668 let expected =
667669 NameValueLookup.ofList [
668670 " people" , upcast [
669- box <| NameValueLookup.ofList [ " id" , box ( string id1 ) ; " name" , box " Person A" ]
670- box <| NameValueLookup.ofList [ " id" , box ( string id2 ) ; " name" , box " Person B" ]
671+ box <| NameValueLookup.ofList [ " id" , box " 1 " ; " name" , box " Person A" ]
672+ box <| NameValueLookup.ofList [ " id" , box " 2 " ; " name" , box " Person B" ]
671673 ]
672674 ]
673675 ensureDirect result <| fun data errors ->
0 commit comments