Skip to content

Commit ebebebe

Browse files
committed
create core scalar definitions for URIs and Dates
introduced compilation phase on schema creation moved to Hopac fs core downgrade optimized interface/union completion
1 parent b04e9c0 commit ebebebe

39 files changed

Lines changed: 1123 additions & 739 deletions

FSharp.Data.GraphQL.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,29 +76,51 @@ EndProject
7676
Global
7777
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7878
Debug|Any CPU = Debug|Any CPU
79+
Debug|x64 = Debug|x64
7980
Release|Any CPU = Release|Any CPU
81+
Release|x64 = Release|x64
8082
EndGlobalSection
8183
GlobalSection(ProjectConfigurationPlatforms) = postSolution
8284
{474179D3-0090-49E9-88F8-2971C0966077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8385
{474179D3-0090-49E9-88F8-2971C0966077}.Debug|Any CPU.Build.0 = Debug|Any CPU
86+
{474179D3-0090-49E9-88F8-2971C0966077}.Debug|x64.ActiveCfg = Debug|x64
87+
{474179D3-0090-49E9-88F8-2971C0966077}.Debug|x64.Build.0 = Debug|x64
8488
{474179D3-0090-49E9-88F8-2971C0966077}.Release|Any CPU.ActiveCfg = Release|Any CPU
8589
{474179D3-0090-49E9-88F8-2971C0966077}.Release|Any CPU.Build.0 = Release|Any CPU
90+
{474179D3-0090-49E9-88F8-2971C0966077}.Release|x64.ActiveCfg = Release|x64
91+
{474179D3-0090-49E9-88F8-2971C0966077}.Release|x64.Build.0 = Release|x64
8692
{54AAFE43-FA5F-485A-AD40-0240165FC633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8793
{54AAFE43-FA5F-485A-AD40-0240165FC633}.Debug|Any CPU.Build.0 = Debug|Any CPU
94+
{54AAFE43-FA5F-485A-AD40-0240165FC633}.Debug|x64.ActiveCfg = Debug|Any CPU
95+
{54AAFE43-FA5F-485A-AD40-0240165FC633}.Debug|x64.Build.0 = Debug|Any CPU
8896
{54AAFE43-FA5F-485A-AD40-0240165FC633}.Release|Any CPU.ActiveCfg = Release|Any CPU
8997
{54AAFE43-FA5F-485A-AD40-0240165FC633}.Release|Any CPU.Build.0 = Release|Any CPU
98+
{54AAFE43-FA5F-485A-AD40-0240165FC633}.Release|x64.ActiveCfg = Release|Any CPU
99+
{54AAFE43-FA5F-485A-AD40-0240165FC633}.Release|x64.Build.0 = Release|Any CPU
90100
{751357AE-F2B2-4B38-956E-81E0B8606C73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
91101
{751357AE-F2B2-4B38-956E-81E0B8606C73}.Debug|Any CPU.Build.0 = Debug|Any CPU
102+
{751357AE-F2B2-4B38-956E-81E0B8606C73}.Debug|x64.ActiveCfg = Debug|x64
103+
{751357AE-F2B2-4B38-956E-81E0B8606C73}.Debug|x64.Build.0 = Debug|x64
92104
{751357AE-F2B2-4B38-956E-81E0B8606C73}.Release|Any CPU.ActiveCfg = Release|Any CPU
93105
{751357AE-F2B2-4B38-956E-81E0B8606C73}.Release|Any CPU.Build.0 = Release|Any CPU
106+
{751357AE-F2B2-4B38-956E-81E0B8606C73}.Release|x64.ActiveCfg = Release|x64
107+
{751357AE-F2B2-4B38-956E-81E0B8606C73}.Release|x64.Build.0 = Release|x64
94108
{C53B6C2C-35E0-46D1-8D01-59F19D345CB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95109
{C53B6C2C-35E0-46D1-8D01-59F19D345CB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
110+
{C53B6C2C-35E0-46D1-8D01-59F19D345CB1}.Debug|x64.ActiveCfg = Debug|Any CPU
111+
{C53B6C2C-35E0-46D1-8D01-59F19D345CB1}.Debug|x64.Build.0 = Debug|Any CPU
96112
{C53B6C2C-35E0-46D1-8D01-59F19D345CB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
97113
{C53B6C2C-35E0-46D1-8D01-59F19D345CB1}.Release|Any CPU.Build.0 = Release|Any CPU
114+
{C53B6C2C-35E0-46D1-8D01-59F19D345CB1}.Release|x64.ActiveCfg = Release|Any CPU
115+
{C53B6C2C-35E0-46D1-8D01-59F19D345CB1}.Release|x64.Build.0 = Release|Any CPU
98116
{7C9CC625-FB4E-4215-9F7C-494AA6043821}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99117
{7C9CC625-FB4E-4215-9F7C-494AA6043821}.Debug|Any CPU.Build.0 = Debug|Any CPU
118+
{7C9CC625-FB4E-4215-9F7C-494AA6043821}.Debug|x64.ActiveCfg = Debug|Any CPU
119+
{7C9CC625-FB4E-4215-9F7C-494AA6043821}.Debug|x64.Build.0 = Debug|Any CPU
100120
{7C9CC625-FB4E-4215-9F7C-494AA6043821}.Release|Any CPU.ActiveCfg = Release|Any CPU
101121
{7C9CC625-FB4E-4215-9F7C-494AA6043821}.Release|Any CPU.Build.0 = Release|Any CPU
122+
{7C9CC625-FB4E-4215-9F7C-494AA6043821}.Release|x64.ActiveCfg = Release|Any CPU
123+
{7C9CC625-FB4E-4215-9F7C-494AA6043821}.Release|x64.Build.0 = Release|Any CPU
102124
EndGlobalSection
103125
GlobalSection(SolutionProperties) = preSolution
104126
HideSolutionNode = FALSE

paket.dependencies

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ source https://nuget.org/api/v2
22
nuget BenchmarkDotNet
33
nuget BenchmarkDotNet.Diagnostics.Windows
44
nuget FParsec
5+
nuget Hopac
56
nuget Newtonsoft.Json
67
nuget Suave
78

paket.lock

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
NUGET
22
remote: https://www.nuget.org/api/v2
33
specs:
4-
BenchmarkDotNet (0.9.6)
5-
BenchmarkDotNet.Diagnostics.Windows (0.9.6)
6-
BenchmarkDotNet (>= 0.9.6) - framework: >= net40, dnx451
4+
BenchmarkDotNet (0.9.7)
5+
BenchmarkDotNet.Diagnostics.Windows (0.9.7)
6+
BenchmarkDotNet (>= 0.9.7) - framework: >= net40, dnx451
77
Microsoft.Diagnostics.Tracing.TraceEvent (>= 1.0.41) - framework: >= net40, dnx451
88
FParsec (1.0.2)
99
FSharp.Core (4.0.0.1)
10+
Hopac (0.2.1)
11+
FSharp.Core (>= 3.1.2.5)
1012
Microsoft.Diagnostics.Tracing.TraceEvent (1.0.41) - framework: >= net40, dnx451
1113
Newtonsoft.Json (8.0.3)
1214
Suave (1.1.2)
@@ -16,23 +18,23 @@ GROUP Build
1618
NUGET
1719
remote: https://www.nuget.org/api/v2
1820
specs:
19-
FAKE (4.26.0)
21+
FAKE (4.26)
2022
FParsec (1.0.2)
2123
FSharp.Compiler.Service (2.0.0.6)
2224
FSharp.Formatting (2.14.2)
2325
FSharp.Compiler.Service (2.0.0.6)
24-
FSharpVSPowerTools.Core (>= 2.3.0 < 2.4.0)
25-
FSharpVSPowerTools.Core (2.3.0)
26+
FSharpVSPowerTools.Core (>= 2.3 < 2.4)
27+
FSharpVSPowerTools.Core (2.3)
2628
FSharp.Compiler.Service (>= 2.0.0.3)
2729
Microsoft.Bcl (1.1.10) - framework: net10, net11, net20, net35, net40, net40
2830
Microsoft.Bcl.Build (>= 1.0.14)
2931
Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: net10, net11, net20, net35, net40, net40
3032
Microsoft.Net.Http (2.2.29) - framework: net10, net11, net20, net35, net40, net40
3133
Microsoft.Bcl (>= 1.1.10)
3234
Microsoft.Bcl.Build (>= 1.0.14)
33-
Octokit (0.19.0)
35+
Octokit (0.19)
3436
Microsoft.Net.Http
35-
SourceLink.Fake (1.1.0)
37+
SourceLink.Fake (1.1)
3638
GITHUB
3739
remote: fsharp/FAKE
3840
specs:
@@ -42,7 +44,7 @@ GROUP Test
4244
NUGET
4345
remote: https://www.nuget.org/api/v2
4446
specs:
45-
FsCheck (2.4.0)
47+
FsCheck (2.4)
4648
FSharp.Core (>= 3.1.2.5)
4749
FSharp.Core (4.0.0.1)
4850
xunit (1.9.2)

samples/graphiql-client/server.fsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#r "../../packages/Suave/lib/net40/Suave.dll"
22
#r "../../packages/Newtonsoft.Json/lib/net40/Newtonsoft.Json.dll"
3-
#r "../../src/FSharp.Data.GraphQL/bin/Debug/FSharp.Data.GraphQL.dll"
3+
#r "../../src/FSharp.Data.GraphQL/bin/Release/Hopac.dll"
4+
#r "../../src/FSharp.Data.GraphQL/bin/Release/FSharp.Data.GraphQL.dll"
45

56
open System
67

@@ -86,15 +87,15 @@ open FSharp.Data.GraphQL.Execution
8687
let EpisodeType = Define.Enum(
8788
name = "Episode",
8889
description = "One of the films in the Star Wars Trilogy",
89-
options = [
90+
options = [|
9091
Define.EnumValue("NEWHOPE", Episode.NewHope, "Released in 1977.")
9192
Define.EnumValue("EMPIRE", Episode.Empire, "Released in 1980.")
92-
Define.EnumValue("JEDI", Episode.Jedi, "Released in 1983.")])
93+
Define.EnumValue("JEDI", Episode.Jedi, "Released in 1983.") |])
9394

9495
let rec CharacterType = Define.Union(
9596
name = "Character",
9697
description = "A character in the Star Wars Trilogy",
97-
options = [ HumanType; DroidType ],
98+
options = [| HumanType; DroidType |],
9899
resolveValue = (fun o ->
99100
match o with
100101
| Human h -> box h
@@ -108,7 +109,7 @@ and HumanType : ObjectDef<Human> = Define.Object<Human>(
108109
name = "Human",
109110
description = "A humanoid creature in the Star Wars universe.",
110111
isTypeOf = (fun o -> o :? Human),
111-
fieldsFn = fun () -> [
112+
fieldsFn = fun () -> [|
112113
Define.Field("id", String, "The id of the human.", fun _ h -> h.Id)
113114
Define.Field("name", Nullable String, "The name of the human.", fun _ h -> h.Name)
114115
Define.Field("friends", ListOf (Nullable CharacterType), "The friends of the human, or an empty list if they have none.",
@@ -117,27 +118,25 @@ and HumanType : ObjectDef<Human> = Define.Object<Human>(
117118
|> List.map getCharacter
118119
|> List.toSeq)
119120
Define.Field("appearsIn", ListOf EpisodeType, "Which movies they appear in.", fun _ h -> upcast h.AppearsIn)
120-
Define.Field("homePlanet", Nullable String, "The home planet of the human, or null if unknown.", fun _ h -> h.HomePlanet)
121-
])
121+
Define.Field("homePlanet", Nullable String, "The home planet of the human, or null if unknown.", fun _ h -> h.HomePlanet) |])
122122

123123
and DroidType = Define.Object<Droid>(
124124
name = "Droid",
125125
description = "A mechanical creature in the Star Wars universe.",
126126
isTypeOf = (fun o -> o :? Droid),
127-
fieldsFn = fun () -> [
127+
fieldsFn = fun () -> [|
128128
Define.Field("id", String, "The id of the droid.", fun _ d -> d.Id)
129129
Define.Field("name", Nullable String, "The name of the Droid.", fun _ d -> d.Name)
130130
Define.Field("friends", ListOf (Nullable CharacterType), "The friends of the Droid, or an empty list if they have none.",
131131
fun ctx d -> d.Friends |> List.map getCharacter |> List.toSeq)
132132
Define.Field("appearsIn", ListOf EpisodeType, "Which movies they appear in.", fun _ d -> upcast d.AppearsIn)
133-
Define.Field("primaryFunction", Nullable String, "The primary function of the droid.", fun _ d -> d.PrimaryFunction)]
134-
)
133+
Define.Field("primaryFunction", Nullable String, "The primary function of the droid.", fun _ d -> d.PrimaryFunction) |])
135134

136135
let Query = Define.Object(
137136
name = "Query",
138-
fields = [
139-
Define.Field("hero", Nullable HumanType, "Gets human hero", [ Define.Input("id", String) ], fun ctx () -> getHuman (ctx.Arg("id").Value))
140-
Define.Field("droid", Nullable DroidType, "Gets droid", [ Define.Input("id", String) ], fun ctx () -> getDroid (ctx.Arg("id").Value))])
137+
fields = [|
138+
Define.Field("hero", Nullable HumanType, "Gets human hero", [| Define.Input("id", String) |], fun ctx () -> getHuman (ctx.Arg("id").Value))
139+
Define.Field("droid", Nullable DroidType, "Gets droid", [| Define.Input("id", String) |], fun ctx () -> getDroid (ctx.Arg("id").Value)) |])
141140

142141
let schema = Schema(Query)
143142

src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
</Reference>
110110
</ItemGroup>
111111
</When>
112-
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
112+
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
113113
<ItemGroup>
114114
<Reference Include="Newtonsoft.Json">
115115
<HintPath>..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll</HintPath>

src/FSharp.Data.GraphQL.Relay/Connections.fs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ module Definitions =
5454
let PageInfo = Define.Object<PageInfo>(
5555
name = "PageInfo",
5656
description = "Information about pagination in a connection.",
57-
fields = [
57+
fields = [|
5858
Define.Field("hasNextPage", Boolean, "When paginating forwards, are there more items?", fun _ pageInfo -> pageInfo.HasNextPage)
5959
Define.Field("hasPreviousPage", Boolean, "When paginating backwards, are there more items?", fun _ pageInfo -> pageInfo.HasPreviousPage)
6060
Define.Field("startCursor", Nullable String, "When paginating backwards, the cursor to continue.", fun _ pageInfo -> pageInfo.StartCursor)
6161
Define.Field("endCursor", Nullable String, "When paginating forwards, the cursor to continue.", fun _ pageInfo -> pageInfo.EndCursor)
62-
])
62+
|])
6363

6464
/// Converts existing output type defintion into an edge in a Relay connection.
6565
/// <paramref name="nodeType"/> must not be a List.
@@ -70,9 +70,9 @@ module Definitions =
7070
Define.Object<Edge<'Node>>(
7171
name = n.Name + "Edge",
7272
description = "An edge in a connection from an object to another object of type " + n.Name,
73-
fields = [
73+
fields = [|
7474
Define.Field("cursor", String, "A cursor for use in pagination", fun _ edge -> edge.Cursor)
75-
Define.Field("node", nodeType, "The item at the end of the edge. Must NOT be an enumerable collection.", fun _ edge -> edge.Node) ])
75+
Define.Field("node", nodeType, "The item at the end of the edge. Must NOT be an enumerable collection.", fun _ edge -> edge.Node) |])
7676

7777
/// Converts existing output type definition into Relay-compatible connection.
7878
/// <paramref name="nodeType"/> must not be a List.
@@ -81,23 +81,23 @@ module Definitions =
8181
Define.Object<Connection<'Node>>(
8282
name = n.Name + "Connection",
8383
description = "A connection from an object to a list of objects of type " + n.Name,
84-
fields = [
84+
fields = [|
8585
Define.Field("totalCount", Nullable Int, """A count of the total number of objects in this connection, ignoring pagination. This allows a client to fetch the first five objects by passing \"5\" as the argument to `first`, then fetch the total count so it could display \"5 of 83\", for example. In cases where we employ infinite scrolling or don't have an exact count of entries, this field will return `null`.""", fun _ conn -> conn.TotalCount)
8686
Define.Field("pageInfo", PageInfo, "Information to aid in pagination.", fun _ conn -> conn.PageInfo)
87-
Define.Field("edges", ListOf(EdgeOf nodeType), "Information to aid in pagination.", fun _ conn -> conn.Edges)])
87+
Define.Field("edges", ListOf(EdgeOf nodeType), "Information to aid in pagination.", fun _ conn -> conn.Edges)|])
8888

8989
[<RequireQualifiedAccess>]
9090
module Connection =
9191

92-
let forwardArgs = [
92+
let forwardArgs = [|
9393
Define.Input("first", Nullable Int)
94-
Define.Input("after", Nullable String) ]
94+
Define.Input("after", Nullable String) |]
9595

96-
let backwardArgs = [
96+
let backwardArgs = [|
9797
Define.Input("last", Nullable Int)
98-
Define.Input("before", Nullable String) ]
98+
Define.Input("before", Nullable String) |]
9999

100-
let allArgs = forwardArgs @ backwardArgs
100+
let allArgs = Array.append forwardArgs backwardArgs
101101

102102
let ofArraySlice meta (SliceInfo args) (array: 't []) =
103103
let startOffset, endOffset =

src/FSharp.Data.GraphQL.Relay/FSharp.Data.GraphQL.Relay.fsproj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,25 @@
7878
<Target Name="AfterBuild">
7979
</Target>
8080
-->
81+
<Choose>
82+
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
83+
<ItemGroup>
84+
<Reference Include="Hopac.Core">
85+
<HintPath>..\..\packages\Hopac\lib\net45\Hopac.Core.dll</HintPath>
86+
<Private>True</Private>
87+
<Paket>True</Paket>
88+
</Reference>
89+
<Reference Include="Hopac.Platform">
90+
<HintPath>..\..\packages\Hopac\lib\net45\Hopac.Platform.dll</HintPath>
91+
<Private>True</Private>
92+
<Paket>True</Paket>
93+
</Reference>
94+
<Reference Include="Hopac">
95+
<HintPath>..\..\packages\Hopac\lib\net45\Hopac.dll</HintPath>
96+
<Private>True</Private>
97+
<Paket>True</Paket>
98+
</Reference>
99+
</ItemGroup>
100+
</When>
101+
</Choose>
81102
</Project>

src/FSharp.Data.GraphQL.Relay/Node.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ module GlobalId =
6060
name = "node",
6161
typedef = Nullable nodeDef,
6262
description = "Fetches an object given its ID",
63-
args = [ Define.Input("id", Nullable ID, description = "Identifier of an object") ],
63+
args = [| Define.Input("id", Nullable ID, description = "Identifier of an object") |],
6464
resolve = fun ctx value ->
6565
let id = ctx.Arg("id").Value
6666
resolve ctx value id)
6767

6868
static member Node (possibleTypes: unit -> ObjectDef list) = Define.Interface(
6969
name = "Node",
7070
description = "An object that can be uniquely identified by its id",
71-
fields = [Define.Field("id", ID)],
71+
fields = [| Define.Field("id", ID) |],
7272
resolveType = resolveTypeFun possibleTypes)
7373

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hopac

src/FSharp.Data.GraphQL/Ast.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ and SchemaDefintion = {
130130

131131
and ObjectTypeDefinition = {
132132
Name: string
133-
Interfaces: string list
134-
Fields: FieldDefinition list
133+
Interfaces: string []
134+
Fields: FieldDefinition []
135135
}
136136

137137
and FieldDefinition = {
138138
Name: string
139-
Arguments: InputValueDefinition list
139+
Arguments: InputValueDefinition []
140140
Type: InputType
141141
}
142142

@@ -148,22 +148,22 @@ and InputValueDefinition = {
148148

149149
and InterfaceTypeDefinition = {
150150
Name: string
151-
Fields: FieldDefinition list
151+
Fields: FieldDefinition []
152152
}
153153

154154
and UnionTypeDefinition = {
155155
Name: string
156-
Types: string list
156+
Types: string []
157157
}
158158

159159
and EnumTypeDefinition = {
160160
Name: string
161-
Values: string list
161+
Values: string []
162162
}
163163

164164
and InputObjectTypeDefinition = {
165165
Name: string
166-
Fields: InputValueDefinition list
166+
Fields: InputValueDefinition []
167167
}
168168

169169
and TypeDefinition =

0 commit comments

Comments
 (0)