diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 41e28fcb3..e57098a44 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -1,24 +1,12 @@
{
- "version": 1,
- "isRoot": true,
- "tools": {
- "paket": {
- "version": "5.257.0",
- "commands": [
- "paket"
- ]
- },
- "fake-cli": {
- "version": "5.20.4",
- "commands": [
- "fake"
- ]
- },
- "fsharp.formatting.commandtool": {
- "version": "11.1.0",
- "commands": [
- "fsdocs"
- ]
- }
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "fsharp.formatting.commandtool": {
+ "version": "11.1.0",
+ "commands": [
+ "fsdocs"
+ ]
}
+ }
}
\ No newline at end of file
diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml
index c1c7f27e1..ce5e9e066 100644
--- a/.github/workflows/dotnetcore.yml
+++ b/.github/workflows/dotnetcore.yml
@@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
- dotnet: [5.0.100]
+ dotnet: [6.0.400]
runs-on: ${{ matrix.os }}
steps:
@@ -31,7 +31,5 @@ jobs:
dotnet-version: ${{ matrix.dotnet }}
- name: Install local tools
run: dotnet tool restore
- - name: Paket Restore
- run: dotnet paket restore
- name: Build and Test
- run: dotnet fake run build.fsx
\ No newline at end of file
+ run: dotnet fsi build.fsx
\ No newline at end of file
diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets
deleted file mode 100644
index 8d37e28bc..000000000
--- a/.paket/Paket.Restore.targets
+++ /dev/null
@@ -1,494 +0,0 @@
-
-
-
-
-
-
- $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
-
- $(MSBuildVersion)
- 15.0.0
- false
- true
-
- true
- $(MSBuildThisFileDirectory)
- $(MSBuildThisFileDirectory)..\
- $(PaketRootPath)paket-files\paket.restore.cached
- $(PaketRootPath)paket.lock
- classic
- proj
- assembly
- native
- /Library/Frameworks/Mono.framework/Commands/mono
- mono
-
-
- $(PaketRootPath)paket.bootstrapper.exe
- $(PaketToolsPath)paket.bootstrapper.exe
- $([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\
-
- "$(PaketBootStrapperExePath)"
- $(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"
-
-
-
-
- true
- true
-
-
- True
-
-
- False
-
- $(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/'))
-
-
-
-
-
-
-
-
- $(PaketRootPath)paket
- $(PaketToolsPath)paket
-
-
-
-
-
- $(PaketRootPath)paket.exe
- $(PaketToolsPath)paket.exe
-
-
-
-
-
- <_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json"))
- <_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"'))
- <_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false
-
-
-
-
-
-
-
-
-
-
- <_PaketCommand>dotnet paket
-
-
-
-
-
- $(PaketToolsPath)paket
- $(PaketBootStrapperExeDir)paket
-
-
- paket
-
-
-
-
- <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))
- <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"
- <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"
- <_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- $(NoWarn);NU1603;NU1604;NU1605;NU1608
- false
- true
-
-
-
-
-
-
-
-
- $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))
-
-
-
-
-
-
- $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[0].Replace(`"`, ``).Replace(` `, ``))
- $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[1].Replace(`"`, ``).Replace(` `, ``))
-
-
-
-
- %(PaketRestoreCachedKeyValue.Value)
- %(PaketRestoreCachedKeyValue.Value)
-
-
-
-
- true
- false
- true
-
-
-
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(PaketIntermediateOutputPath)\$(MSBuildProjectFile).paket.references.cached
-
- $(MSBuildProjectFullPath).paket.references
-
- $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references
-
- $(MSBuildProjectDirectory)\paket.references
-
- false
- true
- true
- references-file-or-cache-not-found
-
-
-
-
- $([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)'))
- $([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)'))
- references-file
- false
-
-
-
-
- false
-
-
-
-
- true
- target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths)
-
-
-
-
-
-
-
-
-
-
- false
- true
-
-
-
-
-
-
-
-
-
-
- $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length)
- $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])
- $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])
- $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])
- $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])
-
-
- %(PaketReferencesFileLinesInfo.PackageVersion)
- All
- runtime
- runtime
- true
- true
-
-
-
-
- $(PaketIntermediateOutputPath)/$(MSBuildProjectFile).paket.clitools
-
-
-
-
-
-
-
-
- $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0])
- $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1])
-
-
- %(PaketCliToolFileLinesInfo.PackageVersion)
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
-
- <_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/>
-
-
-
-
-
- $(MSBuildProjectDirectory)/$(MSBuildProjectFile)
- true
- false
- true
- false
- true
- false
- true
- false
- true
- $(PaketIntermediateOutputPath)\$(Configuration)
- $(PaketIntermediateOutputPath)
-
-
-
- <_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.$(PackageVersion.Split(`+`)[0]).nuspec"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 000000000..1d992c909
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,29 @@
+
+
+
+
+ 6.0
+
+ true
+
+
+
+ John Bazinga, Andrii Chebukin,
+ FSharp.Data.GraphQL
+ F# implementation of Facebook GraphQL query language
+
+ 1.1.0
+ FSharp GraphQL Relay React Middleware
+ README.md
+
+
+ https://fsprojects.github.io/FSharp.Data.GraphQL
+ MIT
+ true
+ true
+ snupkg
+ true
+
+ v
+
+
diff --git a/FSharp.Data.GraphQL.sln b/FSharp.Data.GraphQL.sln
index f08c5fa9d..e72d50225 100644
--- a/FSharp.Data.GraphQL.sln
+++ b/FSharp.Data.GraphQL.sln
@@ -1,16 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.28922.388
+# Visual Studio Version 17
+VisualStudioVersion = 17.3.32811.315
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{63297B98-5CED-492C-A5B7-A5B4F73CF142}"
- ProjectSection(SolutionItems) = preProject
- paket.dependencies = paket.dependencies
- paket.lock = paket.lock
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}"
-EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.GraphQL.Server", "src\FSharp.Data.GraphQL.Server\FSharp.Data.GraphQL.Server.fsproj", "{474179D3-0090-49E9-88F8-2971C0966077}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60BC93-E09B-4E5F-9D85-95A519479D54}"
@@ -20,20 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60
RELEASE_NOTES.md = RELEASE_NOTES.md
EndProjectSection
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{83F16175-43B1-4C90-A1EE-8E351C33435D}"
- ProjectSection(SolutionItems) = preProject
- docs\tools\generate.fsx = docs\tools\generate.fsx
- docs\tools\templates\template.cshtml = docs\tools\templates\template.cshtml
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D5255-776D-4B61-85F9-73C37AA1FB9A}"
- ProjectSection(SolutionItems) = preProject
- docs\content\execution-pipeline.md = docs\content\execution-pipeline.md
- docs\content\index.md = docs\content\index.md
- docs\content\linq.md = docs\content\linq.md
- docs\content\type-system.md = docs\content\type-system.md
- EndProjectSection
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ED8079DD-2B06-4030-9F0F-DC548F98E1C4}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.GraphQL.Tests", "tests\FSharp.Data.GraphQL.Tests\FSharp.Data.GraphQL.Tests.fsproj", "{54AAFE43-FA5F-485A-AD40-0240165FC633}"
@@ -97,17 +75,6 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.GraphQL.Server.
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.GraphQL.Benchmarks", "tests\FSharp.Data.GraphQL.Benchmarks\FSharp.Data.GraphQL.Benchmarks.fsproj", "{A6A162DF-9FBB-4C2A-913F-FD5FED35A09B}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "files", "files", "{56640EAF-82A6-4439-AD14-69F44A90DA99}"
- ProjectSection(SolutionItems) = preProject
- docs\files\introspection_query.graphql = docs\files\introspection_query.graphql
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "img", "img", "{78D10788-601D-4D53-808B-36661911EDD1}"
- ProjectSection(SolutionItems) = preProject
- docs\files\img\logo-template.pdn = docs\files\img\logo-template.pdn
- docs\files\img\logo.png = docs\files\img\logo.png
- EndProjectSection
-EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.GraphQL.Client.DesignTime", "src\FSharp.Data.GraphQL.Client.DesignTime\FSharp.Data.GraphQL.Client.DesignTime.fsproj", "{B075CD55-CEA4-4C30-A088-48319AADF070}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.GraphQL.Client", "src\FSharp.Data.GraphQL.Client\FSharp.Data.GraphQL.Client.fsproj", "{F7858DA7-E067-486B-9E9C-697F0A56C620}"
@@ -137,6 +104,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "server", "server", "{9D5C46
samples\client-provider\file-upload\server\types.mjs = samples\client-provider\file-upload\server\types.mjs
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E3330910-8B6C-4191-8046-D6D57FBC39B1}"
+ ProjectSection(SolutionItems) = preProject
+ Directory.Build.targets = Directory.Build.targets
+ global.json = global.json
+ LICENSE.txt = LICENSE.txt
+ Packages.props = Packages.props
+ README.md = README.md
+ RELEASE_NOTES.md = RELEASE_NOTES.md
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{6B17B8F2-DD8B-4FA1-BA9C-6FF4F668923C}"
+ ProjectSection(SolutionItems) = preProject
+ build.cmd = build.cmd
+ build.fsx = build.fsx
+ build.sh = build.sh
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -249,8 +233,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{474179D3-0090-49E9-88F8-2971C0966077} = {BEFD8748-2467-45F9-A4AD-B450B12D5F78}
- {83F16175-43B1-4C90-A1EE-8E351C33435D} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}
- {8E6D5255-776D-4B61-85F9-73C37AA1FB9A} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}
{54AAFE43-FA5F-485A-AD40-0240165FC633} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
{CAE5916B-1415-4982-B705-7318D77C029C} = {B0C25450-74BF-40C2-9E02-09AADBAE2C2F}
{9B25360F-2CE4-43D2-AFF0-5EAA693E98F7} = {B0C25450-74BF-40C2-9E02-09AADBAE2C2F}
@@ -260,8 +242,6 @@ Global
{6768EA38-1335-4B8E-BC09-CCDED1F9AAF6} = {BEFD8748-2467-45F9-A4AD-B450B12D5F78}
{8FB23F61-77CB-42C7-8EEC-B22D7C4E4067} = {BEFD8748-2467-45F9-A4AD-B450B12D5F78}
{A6A162DF-9FBB-4C2A-913F-FD5FED35A09B} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
- {56640EAF-82A6-4439-AD14-69F44A90DA99} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}
- {78D10788-601D-4D53-808B-36661911EDD1} = {56640EAF-82A6-4439-AD14-69F44A90DA99}
{B075CD55-CEA4-4C30-A088-48319AADF070} = {BEFD8748-2467-45F9-A4AD-B450B12D5F78}
{F7858DA7-E067-486B-9E9C-697F0A56C620} = {BEFD8748-2467-45F9-A4AD-B450B12D5F78}
{F66BEE6C-0CB7-4F39-97E4-243F797E8723} = {B0C25450-74BF-40C2-9E02-09AADBAE2C2F}
diff --git a/Packages.props b/Packages.props
new file mode 100644
index 000000000..eaf9232e0
--- /dev/null
+++ b/Packages.props
@@ -0,0 +1,31 @@
+
+
+
+ 6.0.*
+ 6.0.*
+ 2.*
+
+
+
+
+
+ contentFiles
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build.cmd b/build.cmd
index e7ef31ba2..0d921341a 100644
--- a/build.cmd
+++ b/build.cmd
@@ -1,2 +1,2 @@
dotnet tool restore
-dotnet fake run build.fsx %*
\ No newline at end of file
+dotnet fsi build.fsx %*
\ No newline at end of file
diff --git a/build.fsx b/build.fsx
index 60688bcf2..ef755347b 100644
--- a/build.fsx
+++ b/build.fsx
@@ -1,21 +1,15 @@
-#r "paket:
-nuget Fake.Core.Target
-nuget Fake.DotNet.Cli
-nuget Fake.Tools.Git
-nuget Fake.DotNet.AssemblyInfoFile
-nuget Fake.Core.ReleaseNotes
-nuget Fake.Core.UserInput
-nuget Fake.DotNet.MSBuild
-nuget Fake.IO.FileSystem
-nuget Fake.DotNet.Fsc
-nuget Fake.Api.GitHub
-nuget Fake.DotNet.Paket
-nuget Octokit
-nuget FSharp.Core //"
-
-#if !FAKE
-#load ".fake/build.fsx/intellisense.fsx"
-#endif
+#r "nuget: Fake.Api.GitHub"
+#r "nuget: Fake.Core.ReleaseNotes"
+#r "nuget: Fake.Core.Target"
+#r "nuget: Fake.Core.UserInput"
+#r "nuget: Fake.DotNet.AssemblyInfoFile"
+#r "nuget: Fake.DotNet.Cli"
+#r "nuget: Fake.DotNet.Fsc"
+#r "nuget: Fake.DotNet.MSBuild"
+#r "nuget: Fake.IO.FileSystem"
+#r "nuget: Fake.Tools.Git"
+#r "nuget: System.Reactive"
+#r "nuget: Octokit"
open System
open System.IO
@@ -24,6 +18,7 @@ open System.Threading
open Fake
open Fake.Tools.Git
open Fake.DotNet
+open Fake.DotNet.NuGet
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
@@ -33,57 +28,32 @@ open Fake.Core
open Fake.Api
open Octokit
+// https://github.com/fsprojects/FAKE/issues/2517
+// Regular header and `#load ".fake/build.fsx/intellisense.fsx"`
+
+#if !FAKE
+let execContext =
+ System.Environment.GetCommandLineArgs()
+ |> Array.skip 2 // skip fsi.exe; build.fsx
+ |> Array.toList
+ |> Fake.Core.Context.FakeExecutionContext.Create false __SOURCE_FILE__
+execContext
+|> Fake.Core.Context.RuntimeContext.Fake
+|> Fake.Core.Context.setExecutionContext
+#endif
+
// --------------------------------------------------------------------------------------
// Information about the project are used
// --------------------------------------------------------------------------------------
-// - for version and project name in generated AssemblyInfo file
// - by the generated NuGet package
// - to run tests and to publish documentation on GitHub gh-pages
// - for documentation, you also need to edit info in "docs/tools/generate.fsx"
-
+let [] DotNetMoniker = "net6.0"
let project = "FSharp.Data.GraphQL"
-let summary = "FSharp implementation of Facebook GraphQL query language"
-let gitName = "FSharp.Data.GraphQL"
let release = ReleaseNotes.load "RELEASE_NOTES.md"
let projectRepo = "https://github.com/fsprojects/FSharp.Data.GraphQL.git"
-// Generate assembly info files with the right version & up-to-date information
-Target.create "AssemblyInfo" (fun _ ->
- let getAssemblyInfoAttributes projectName =
- [ AssemblyInfo.Title projectName
- AssemblyInfo.Product project
- AssemblyInfo.Description summary
- AssemblyInfo.Version release.AssemblyVersion
- AssemblyInfo.FileVersion release.AssemblyVersion ]
- let internalsVisibility (fsproj: string) =
- match fsproj with
- | f when f.EndsWith "FSharp.Data.GraphQL.Shared.fsproj" ->
- [ AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Server"
- AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Client"
- AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Client.DesignTime"
- AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Tests" ]
- | f when f.EndsWith "FSharp.Data.GraphQL.Server.fsproj" ->
- [ AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Benchmarks"
- AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Tests" ]
- | _ -> []
-
- let getProjectDetails (projectPath:string) =
- let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
- ( projectPath,
- projectName,
- System.IO.Path.GetDirectoryName(projectPath),
- (getAssemblyInfoAttributes projectName)
- )
-
- !! "src/**/*.fsproj"
- //-- "src/FSharp.Data.GraphQL.Client.DesignTime/FSharp.Data.GraphQL.Client.DesignTime.fsproj"
- |> Seq.map getProjectDetails
- |> Seq.iter (fun (projFileName, _, folderName, attributes) ->
- AssemblyInfoFile.createFSharp (folderName > "AssemblyInfo.fs") (attributes @ internalsVisibility projFileName)
- )
-)
-
// --------------------------------------------------------------------------------------
// Clean build results
@@ -98,16 +68,10 @@ Target.create "CleanDocs" (fun _ ->
// --------------------------------------------------------------------------------------
// Build library & test project
-// We need to disable parallel restoring of projects to because running paket in parallel from Mono
-// is giving errors in Unix based operating systems.
Target.create "Restore" (fun _ ->
!! "src/**/*.??proj"
-- "src/**/*.shproj"
- |> Seq.iter (fun pattern ->
- DotNet.restore (fun options ->
- { options with MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true } }
- ) pattern
- ))
+ |> Seq.iter (fun pattern -> DotNet.restore id pattern))
Target.create "Build" <| fun _ ->
@@ -123,7 +87,7 @@ let startGraphQLServer (project: string) (streamRef: DataRef) =
let projectName = Path.GetFileNameWithoutExtension(project)
let projectPath = Path.GetDirectoryName(project)
- let serverExe = projectPath > "bin" > "Release" > "net5.0" > (projectName + ".dll")
+ let serverExe = projectPath > "bin" > "Release" > DotNetMoniker > (projectName + ".dll")
CreateProcess.fromRawCommandLine "dotnet" serverExe
|> CreateProcess.withStandardInput (CreatePipe streamRef)
@@ -215,22 +179,19 @@ Target.create "ReleaseDocs" (fun _ ->
let pack id =
Shell.cleanDir <| sprintf "nuget/%s.%s" project id
- Paket.pack(fun p ->
+ id
+ |> NuGet.NuGetPack(fun p ->
{ p with
- ToolType = ToolType.CreateLocalTool()
Version = release.NugetVersion
OutputPath = sprintf "nuget/%s.%s" project id
- TemplateFile = sprintf "src/%s.%s/%s.%s.fsproj.paket.template" project id project id
- MinimumFromLockFile = true
- IncludeReferencedProjects = false })
+ //IncludeReferencedProjects = false
+ })
let publishPackage id =
pack id
- Paket.push(fun p ->
+ NuGet.NuGetPublish(fun p ->
{ p with
- ToolType = ToolType.CreateLocalTool()
- WorkingDir = sprintf "nuget/%s.%s" project id
- PublishUrl = "https://www.nuget.org/api/v2/package" })
+ WorkingDir = sprintf "nuget/%s.%s" project id })
Target.create "PublishServer" (fun _ ->
publishPackage "Server"
@@ -269,7 +230,6 @@ Target.create "PackAll" ignore
"Clean"
==> "Restore"
- =?> ("AssemblyInfo", BuildServer.isLocalBuild)
==> "Build"
==> "RunUnitTests"
==> "StartStarWarsServer"
@@ -287,4 +247,8 @@ Target.create "PackAll" ignore
==> "PackMiddleware"
==> "PackAll"
-Target.runOrDefault "All"
\ No newline at end of file
+Target.runOrDefaultWithArguments "All"
+
+#if !FAKE
+execContext.Context.Clear()
+#endif
\ No newline at end of file
diff --git a/build.fsx.lock b/build.fsx.lock
index 0981d7d53..959a8dad3 100644
--- a/build.fsx.lock
+++ b/build.fsx.lock
@@ -1,681 +1,5 @@
STORAGE: NONE
-RESTRICTION: == netstandard2.0
+RESTRICTION: || (== net6.0) (== netstandard2.0)
NUGET
remote: https://api.nuget.org/v3/index.json
- BlackFox.VsWhere (1.1)
- FSharp.Core (>= 4.2.3)
- Microsoft.Win32.Registry (>= 4.7)
- Fake.Api.GitHub (5.20.4)
- FSharp.Core (>= 4.7.2)
- Octokit (>= 0.48)
- Fake.Core.CommandLineParsing (5.20.4)
- FParsec (>= 1.1.1)
- FSharp.Core (>= 4.7.2)
- Fake.Core.Context (5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.Environment (5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.FakeVar (5.20.4)
- Fake.Core.Context (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.Process (5.20.4)
- Fake.Core.Environment (>= 5.20.4)
- Fake.Core.FakeVar (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- Fake.IO.FileSystem (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- System.Collections.Immutable (>= 1.7.1)
- Fake.Core.ReleaseNotes (5.20.4)
- Fake.Core.SemVer (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.SemVer (5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.String (5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.Target (5.20.4)
- Fake.Core.CommandLineParsing (>= 5.20.4)
- Fake.Core.Context (>= 5.20.4)
- Fake.Core.Environment (>= 5.20.4)
- Fake.Core.FakeVar (>= 5.20.4)
- Fake.Core.Process (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- FSharp.Control.Reactive (>= 4.4.2)
- FSharp.Core (>= 4.7.2)
- Fake.Core.Tasks (5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.Trace (5.20.4)
- Fake.Core.Environment (>= 5.20.4)
- Fake.Core.FakeVar (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.UserInput (5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Core.Xml (5.20.4)
- Fake.Core.String (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.DotNet.AssemblyInfoFile (5.20.4)
- Fake.Core.Environment (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- Fake.IO.FileSystem (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.DotNet.Cli (5.20.4)
- Fake.Core.Environment (>= 5.20.4)
- Fake.Core.Process (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- Fake.DotNet.MSBuild (>= 5.20.4)
- Fake.DotNet.NuGet (>= 5.20.4)
- Fake.IO.FileSystem (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Mono.Posix.NETStandard (>= 1.0)
- Newtonsoft.Json (>= 12.0.3)
- Fake.DotNet.Fsc (5.20.4)
- Fake.Core.Process (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- Fake.IO.FileSystem (>= 5.20.4)
- FSharp.Compiler.Service (>= 37.0)
- FSharp.Core (>= 4.7.2)
- Fake.DotNet.MSBuild (5.20.4)
- BlackFox.VsWhere (>= 1.1)
- Fake.Core.Environment (>= 5.20.4)
- Fake.Core.Process (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- Fake.IO.FileSystem (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- MSBuild.StructuredLogger (>= 2.1.176)
- Fake.DotNet.NuGet (5.20.4)
- Fake.Core.Environment (>= 5.20.4)
- Fake.Core.Process (>= 5.20.4)
- Fake.Core.SemVer (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- Fake.Core.Tasks (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- Fake.Core.Xml (>= 5.20.4)
- Fake.IO.FileSystem (>= 5.20.4)
- Fake.Net.Http (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Newtonsoft.Json (>= 12.0.3)
- NuGet.Protocol (>= 5.6)
- Fake.DotNet.Paket (5.20.4)
- Fake.Core.Process (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- Fake.DotNet.Cli (>= 5.20.4)
- Fake.IO.FileSystem (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.IO.FileSystem (5.20.4)
- Fake.Core.String (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Net.Http (5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- Fake.Tools.Git (5.20.4)
- Fake.Core.Environment (>= 5.20.4)
- Fake.Core.Process (>= 5.20.4)
- Fake.Core.SemVer (>= 5.20.4)
- Fake.Core.String (>= 5.20.4)
- Fake.Core.Trace (>= 5.20.4)
- Fake.IO.FileSystem (>= 5.20.4)
- FSharp.Core (>= 4.7.2)
- FParsec (1.1.1)
- FSharp.Core (>= 4.3.4)
- FSharp.Compiler.Service (39.0)
- FSharp.Core (5.0.1)
- Microsoft.Build.Framework (>= 16.6)
- Microsoft.Build.Tasks.Core (>= 16.6)
- Microsoft.Build.Utilities.Core (>= 16.6)
- System.Buffers (>= 4.5.1)
- System.Collections.Immutable (>= 5.0)
- System.Diagnostics.Process (>= 4.3)
- System.Diagnostics.TraceSource (>= 4.3)
- System.Linq.Expressions (>= 4.3)
- System.Linq.Queryable (>= 4.3)
- System.Memory (>= 4.5.4)
- System.Net.Requests (>= 4.3)
- System.Net.Security (>= 4.3)
- System.Reflection.Emit (>= 4.3)
- System.Reflection.Metadata (>= 5.0)
- System.Reflection.TypeExtensions (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Runtime.Loader (>= 4.3)
- System.Security.Claims (>= 4.3)
- System.Security.Cryptography.Algorithms (>= 4.3)
- System.Security.Principal (>= 4.3)
- System.Threading.Tasks.Parallel (>= 4.3)
- System.Threading.Thread (>= 4.3)
- System.Threading.ThreadPool (>= 4.3)
- FSharp.Control.Reactive (5.0.2)
- FSharp.Core (>= 4.7.2)
- System.Reactive (>= 5.0)
- FSharp.Core (5.0.1)
- Microsoft.Build (16.9)
- Microsoft.Build.Framework (16.9)
- System.Security.Permissions (>= 4.7)
- Microsoft.Build.Tasks.Core (16.9)
- Microsoft.Build.Framework (>= 16.9)
- Microsoft.Build.Utilities.Core (>= 16.9)
- Microsoft.Win32.Registry (>= 4.3)
- System.CodeDom (>= 4.4)
- System.Collections.Immutable (>= 5.0)
- System.Reflection.Metadata (>= 1.6)
- System.Reflection.TypeExtensions (>= 4.1)
- System.Resources.Extensions (>= 4.6)
- System.Runtime.InteropServices (>= 4.3)
- System.Security.Cryptography.Pkcs (>= 4.7)
- System.Security.Cryptography.Xml (>= 4.7)
- System.Security.Permissions (>= 4.7)
- System.Threading.Tasks.Dataflow (>= 4.9)
- Microsoft.Build.Utilities.Core (16.9)
- Microsoft.Build.Framework (>= 16.9)
- Microsoft.Win32.Registry (>= 4.3)
- System.Collections.Immutable (>= 5.0)
- System.Security.Permissions (>= 4.7)
- System.Text.Encoding.CodePages (>= 4.0.1)
- Microsoft.NETCore.Platforms (5.0.2)
- Microsoft.NETCore.Targets (5.0)
- Microsoft.Win32.Primitives (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- Microsoft.Win32.Registry (5.0)
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.4)
- System.Security.AccessControl (>= 5.0)
- System.Security.Principal.Windows (>= 5.0)
- Mono.Posix.NETStandard (1.0)
- MSBuild.StructuredLogger (2.1.404)
- Microsoft.Build (>= 16.4)
- Microsoft.Build.Framework (>= 16.4)
- Microsoft.Build.Tasks.Core (>= 16.4)
- Microsoft.Build.Utilities.Core (>= 16.4)
- Newtonsoft.Json (13.0.1)
- NuGet.Common (5.9)
- NuGet.Frameworks (>= 5.9)
- NuGet.Configuration (5.9)
- NuGet.Common (>= 5.9)
- System.Security.Cryptography.ProtectedData (>= 4.4)
- NuGet.Frameworks (5.9)
- NuGet.Packaging (5.9)
- Newtonsoft.Json (>= 9.0.1)
- NuGet.Configuration (>= 5.9)
- NuGet.Versioning (>= 5.9)
- System.Security.Cryptography.Cng (>= 5.0)
- System.Security.Cryptography.Pkcs (>= 5.0)
- NuGet.Protocol (5.9)
- NuGet.Packaging (>= 5.9)
- NuGet.Versioning (5.9)
- Octokit (0.50)
- runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.native.System (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- runtime.native.System.Net.Http (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- runtime.native.System.Net.Security (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- runtime.native.System.Security.Cryptography.Apple (4.3.1)
- runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3.1)
- runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3.1)
- runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- System.Buffers (4.5.1)
- System.CodeDom (5.0)
- System.Collections (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Collections.Concurrent (4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Diagnostics.Tracing (>= 4.3)
- System.Globalization (>= 4.3)
- System.Reflection (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Collections.Immutable (5.0)
- System.Memory (>= 4.5.4)
- System.Diagnostics.Debug (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Diagnostics.DiagnosticSource (5.0.1)
- System.Memory (>= 4.5.4)
- System.Runtime.CompilerServices.Unsafe (>= 5.0)
- System.Diagnostics.Process (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.Win32.Primitives (>= 4.3)
- Microsoft.Win32.Registry (>= 4.3)
- runtime.native.System (>= 4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Globalization (>= 4.3)
- System.IO (>= 4.3)
- System.IO.FileSystem (>= 4.3)
- System.IO.FileSystem.Primitives (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Text.Encoding.Extensions (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Threading.Thread (>= 4.3)
- System.Threading.ThreadPool (>= 4.3)
- System.Diagnostics.TraceSource (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- runtime.native.System (>= 4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Globalization (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Threading (>= 4.3)
- System.Diagnostics.Tracing (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Formats.Asn1 (5.0)
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.4)
- System.Globalization (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Globalization.Calendars (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Globalization (>= 4.3)
- System.Runtime (>= 4.3)
- System.Globalization.Extensions (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- System.Globalization (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.IO (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.IO.FileSystem (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.IO (>= 4.3)
- System.IO.FileSystem.Primitives (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.IO.FileSystem.Primitives (4.3)
- System.Runtime (>= 4.3)
- System.Linq (4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Linq.Expressions (4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Globalization (>= 4.3)
- System.IO (>= 4.3)
- System.Linq (>= 4.3)
- System.ObjectModel (>= 4.3)
- System.Reflection (>= 4.3)
- System.Reflection.Emit (>= 4.3)
- System.Reflection.Emit.ILGeneration (>= 4.3)
- System.Reflection.Emit.Lightweight (>= 4.3)
- System.Reflection.Extensions (>= 4.3)
- System.Reflection.Primitives (>= 4.3)
- System.Reflection.TypeExtensions (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Threading (>= 4.3)
- System.Linq.Queryable (4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Linq (>= 4.3)
- System.Linq.Expressions (>= 4.3)
- System.Reflection (>= 4.3)
- System.Reflection.Extensions (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Memory (4.5.4)
- System.Buffers (>= 4.5.1)
- System.Numerics.Vectors (>= 4.4)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.3)
- System.Net.Http (4.3.4)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- runtime.native.System (>= 4.3)
- runtime.native.System.Net.Http (>= 4.3)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Diagnostics.DiagnosticSource (>= 4.3)
- System.Diagnostics.Tracing (>= 4.3)
- System.Globalization (>= 4.3)
- System.Globalization.Extensions (>= 4.3)
- System.IO (>= 4.3)
- System.IO.FileSystem (>= 4.3)
- System.Net.Primitives (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Security.Cryptography.Algorithms (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.OpenSsl (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Security.Cryptography.X509Certificates (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Net.Primitives (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- System.Runtime (>= 4.3.1)
- System.Runtime.Handles (>= 4.3)
- System.Net.Requests (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Diagnostics.Tracing (>= 4.3)
- System.Globalization (>= 4.3)
- System.IO (>= 4.3)
- System.Net.Http (>= 4.3)
- System.Net.Primitives (>= 4.3)
- System.Net.WebHeaderCollection (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Net.Security (4.3.2)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.Win32.Primitives (>= 4.3)
- runtime.native.System (>= 4.3)
- runtime.native.System.Net.Security (>= 4.3)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2)
- System.Collections (>= 4.3)
- System.Collections.Concurrent (>= 4.3)
- System.Diagnostics.Tracing (>= 4.3)
- System.Globalization (>= 4.3)
- System.Globalization.Extensions (>= 4.3)
- System.IO (>= 4.3)
- System.Net.Primitives (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Security.Claims (>= 4.3)
- System.Security.Cryptography.Algorithms (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.OpenSsl (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Security.Cryptography.X509Certificates (>= 4.3)
- System.Security.Principal (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Threading.ThreadPool (>= 4.3)
- System.Net.WebHeaderCollection (4.3)
- System.Collections (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Numerics.Vectors (4.5)
- System.ObjectModel (4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Threading (>= 4.3)
- System.Reactive (5.0)
- System.Runtime.InteropServices.WindowsRuntime (>= 4.3)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.Reflection (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.IO (>= 4.3)
- System.Reflection.Primitives (>= 4.3)
- System.Runtime (>= 4.3)
- System.Reflection.Emit (4.7)
- System.Reflection.Emit.ILGeneration (>= 4.7)
- System.Reflection.Emit.ILGeneration (4.7)
- System.Reflection.Emit.Lightweight (4.7)
- System.Reflection.Emit.ILGeneration (>= 4.7)
- System.Reflection.Extensions (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Reflection (>= 4.3)
- System.Runtime (>= 4.3)
- System.Reflection.Metadata (5.0)
- System.Collections.Immutable (>= 5.0)
- System.Reflection.Primitives (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Reflection.TypeExtensions (4.7)
- System.Resources.Extensions (5.0)
- System.Memory (>= 4.5.4)
- System.Resources.ResourceManager (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Globalization (>= 4.3)
- System.Reflection (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- System.Runtime.CompilerServices.Unsafe (5.0)
- System.Runtime.Extensions (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- System.Runtime (>= 4.3.1)
- System.Runtime.Handles (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Runtime.InteropServices (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Reflection (>= 4.3)
- System.Reflection.Primitives (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices.WindowsRuntime (4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Loader (4.3)
- System.IO (>= 4.3)
- System.Reflection (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Numerics (4.3)
- System.Globalization (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Security.AccessControl (5.0)
- System.Security.Principal.Windows (>= 5.0)
- System.Security.Claims (4.3)
- System.Collections (>= 4.3)
- System.Globalization (>= 4.3)
- System.IO (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Security.Principal (>= 4.3)
- System.Security.Cryptography.Algorithms (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1)
- runtime.native.System.Security.Cryptography.Apple (>= 4.3.1)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2)
- System.Collections (>= 4.3)
- System.IO (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Runtime.Numerics (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Security.Cryptography.Cng (5.0)
- System.Security.Cryptography.Csp (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- System.IO (>= 4.3)
- System.Reflection (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Security.Cryptography.Algorithms (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading (>= 4.3)
- System.Security.Cryptography.Encoding (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3)
- System.Collections (>= 4.3)
- System.Collections.Concurrent (>= 4.3)
- System.Linq (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Security.Cryptography.OpenSsl (5.0)
- System.Security.Cryptography.Pkcs (5.0.1)
- System.Buffers (>= 4.5.1)
- System.Formats.Asn1 (>= 5.0)
- System.Memory (>= 4.5.4)
- System.Security.Cryptography.Cng (>= 5.0)
- System.Security.Cryptography.Primitives (4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Globalization (>= 4.3)
- System.IO (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Security.Cryptography.ProtectedData (5.0)
- System.Memory (>= 4.5.4)
- System.Security.Cryptography.X509Certificates (4.3.2)
- Microsoft.NETCore.Platforms (>= 1.1)
- runtime.native.System (>= 4.3)
- runtime.native.System.Net.Http (>= 4.3)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Globalization (>= 4.3)
- System.Globalization.Calendars (>= 4.3)
- System.IO (>= 4.3)
- System.IO.FileSystem (>= 4.3)
- System.IO.FileSystem.Primitives (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Runtime.Numerics (>= 4.3)
- System.Security.Cryptography.Algorithms (>= 4.3)
- System.Security.Cryptography.Cng (>= 4.3)
- System.Security.Cryptography.Csp (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.OpenSsl (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading (>= 4.3)
- System.Security.Cryptography.Xml (5.0)
- System.Memory (>= 4.5.4)
- System.Security.Cryptography.Pkcs (>= 5.0)
- System.Security.Permissions (>= 5.0)
- System.Security.Permissions (5.0)
- System.Security.AccessControl (>= 5.0)
- System.Security.Principal (4.3)
- System.Runtime (>= 4.3)
- System.Security.Principal.Windows (5.0)
- System.Text.Encoding (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Text.Encoding.CodePages (5.0)
- System.Runtime.CompilerServices.Unsafe (>= 5.0)
- System.Text.Encoding.Extensions (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading (4.3)
- System.Runtime (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Threading.Tasks (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Threading.Tasks.Dataflow (5.0)
- System.Threading.Tasks.Extensions (4.5.4)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.3)
- System.Threading.Tasks.Parallel (4.3)
- System.Collections.Concurrent (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Diagnostics.Tracing (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Threading.Thread (4.3)
- System.Runtime (>= 4.3)
- System.Threading.ThreadPool (4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Handles (>= 4.3)
+ FSharp.Core (6.0.5)
diff --git a/build.sh b/build.sh
index 038454dab..1edb1ddf3 100755
--- a/build.sh
+++ b/build.sh
@@ -4,4 +4,4 @@ set -eu
set -o pipefail
dotnet tool restore
-dotnet fake run build.fsx "$@"
\ No newline at end of file
+dotnet fsi build.fsx "$@"
\ No newline at end of file
diff --git a/global.json b/global.json
index c9637a5b5..e7813d8db 100644
--- a/global.json
+++ b/global.json
@@ -1,7 +1,7 @@
{
- "sdk": {
- "version": "5.0.100",
- "rollForward": "latestFeature"
- },
- "projects": ["src", "tests"]
+ "sdk": {
+ "version": "6.0.400",
+ "rollForward": "latestMinor"
+ },
+ "projects": [ "src", "tests" ]
}
\ No newline at end of file
diff --git a/paket.dependencies b/paket.dependencies
deleted file mode 100644
index 092d9ae36..000000000
--- a/paket.dependencies
+++ /dev/null
@@ -1,41 +0,0 @@
-source https://api.nuget.org/v3/index.json
-
-nuget NuGet.CommandLine
-
-group Common
- source https://api.nuget.org/v3/index.json
- frameworks: net5.0, netstandard2.0
-
- nuget System.Reactive
-
- # Be explicit about FSharp.Core 4.7.2 when designing libraries.
- # See https://fsharp.github.io/2015/04/18/fsharp-core-notes.html#fsharpcore-entries-in-project-files for additional information.
- nuget FSharp.Core 4.7.2
-
- # FParsec needs to be explicit for the client provider design time reference.
- # This should not be a problem since FParsec almost never gets a new release.
- nuget FParsec 1.1.1
-
- nuget Microsoft.Extensions.Http 5
-
- # Those are needed for the client type provider.
- github fsprojects/FSharp.TypeProviders.SDK:377d56321ad062985ed5aa19f205c1c4f04ef328 src/ProvidedTypes.fsi
- github fsprojects/FSharp.TypeProviders.SDK:377d56321ad062985ed5aa19f205c1c4f04ef328 src/ProvidedTypes.fs
-
-group TestsAndSamples
- source https://api.nuget.org/v3/index.json
- frameworks: net5.0, netstandard2.0
-
- nuget Microsoft.Extensions.Http 5
- nuget System.Net.Http 4.3.4
- nuget FSharp.Core
- nuget Newtonsoft.Json
- nuget Suave
- nuget Giraffe
- nuget Microsoft.NET.Test.Sdk
- nuget xunit
- nuget xunit.runner.utility
- nuget xunit.runner.console
- nuget xunit.runner.visualstudio
- nuget BenchmarkDotNet
- nuget FSharp.Data.TypeProviders
\ No newline at end of file
diff --git a/paket.lock b/paket.lock
deleted file mode 100644
index 86700f6ee..000000000
--- a/paket.lock
+++ /dev/null
@@ -1,641 +0,0 @@
-NUGET
- remote: https://api.nuget.org/v3/index.json
- NuGet.CommandLine (5.8.1)
-
-GROUP Common
-RESTRICTION: || (== net50) (== netstandard2.0)
-NUGET
- remote: https://api.nuget.org/v3/index.json
- FParsec (1.1.1)
- FSharp.Core (>= 4.3.4)
- FSharp.Core (4.7.2)
- Microsoft.Bcl.AsyncInterfaces (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netstandard2.1)) (== netstandard2.0)
- System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.DependencyInjection (5.0.1)
- Microsoft.Bcl.AsyncInterfaces (>= 5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (5.0)
- Microsoft.Extensions.Http (5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Logging (>= 5.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0)
- Microsoft.Extensions.Options (>= 5.0)
- Microsoft.Extensions.Logging (5.0)
- Microsoft.Extensions.DependencyInjection (>= 5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0)
- Microsoft.Extensions.Options (>= 5.0)
- System.Diagnostics.DiagnosticSource (>= 5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.Logging.Abstractions (5.0)
- Microsoft.Extensions.Options (5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Primitives (>= 5.0)
- Microsoft.Extensions.Primitives (5.0.1)
- System.Buffers (>= 4.5.1) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netstandard2.0) (>= xamarintvos)) (&& (== net50) (< netstandard2.0) (>= xamarinwatchos)) (== netstandard2.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netcoreapp3.0)) (&& (== net50) (< netstandard2.0) (>= xamarintvos)) (&& (== net50) (< netstandard2.0) (>= xamarinwatchos)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- Microsoft.NETCore.Platforms (5.0.2) - restriction: || (&& (== net50) (< netcoreapp3.1)) (&& (== net50) (< netstandard1.2)) (&& (== net50) (< netstandard1.3)) (&& (== net50) (< netstandard1.5)) (== netstandard2.0)
- Microsoft.NETCore.Targets (5.0) - restriction: || (&& (== net50) (< netcoreapp3.1)) (&& (== net50) (< netstandard1.2)) (&& (== net50) (< netstandard1.3)) (&& (== net50) (< netstandard1.5)) (== netstandard2.0)
- System.Buffers (4.5.1) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netstandard2.0) (>= xamarintvos)) (&& (== net50) (< netstandard2.0) (>= xamarinwatchos)) (== netstandard2.0)
- System.Diagnostics.DiagnosticSource (5.0.1) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netstandard2.1)) (== netstandard2.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (>= net45) (< netstandard1.3)) (&& (== net50) (>= net46)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net45) (< netstandard1.3)) (&& (== net50) (>= net46)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netcoreapp3.0)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Memory (4.5.4) - restriction: || (&& (== net50) (>= net45) (< netstandard1.3)) (&& (== net50) (>= net46)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1) (< netstandard2.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Buffers (>= 4.5.1) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netstandard1.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= xamarinios)) (&& (== net50) (>= xamarinmac)) (&& (== net50) (>= xamarintvos)) (&& (== net50) (>= xamarinwatchos)) (== netstandard2.0)
- System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net50) (< netcoreapp2.0)) (== netstandard2.0)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard1.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (&& (== net50) (>= xamarinios)) (&& (== net50) (>= xamarinmac)) (&& (== net50) (>= xamarintvos)) (&& (== net50) (>= xamarinwatchos)) (== netstandard2.0)
- System.Numerics.Vectors (4.5) - restriction: || (&& (== net50) (>= net45) (< netstandard1.3)) (&& (== net50) (>= net46)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Reactive (5.0)
- System.Runtime.InteropServices.WindowsRuntime (>= 4.3) - restriction: || (&& (== net50) (< netcoreapp3.1)) (== netstandard2.0)
- System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net50) (>= net472)) (&& (== net50) (< netcoreapp3.1)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Runtime (4.3.1) - restriction: || (&& (== net50) (< netcoreapp3.1)) (== netstandard2.0)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- System.Runtime.CompilerServices.Unsafe (5.0) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net45) (< netstandard1.3)) (&& (== net50) (>= net46)) (&& (== net50) (>= net461)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (< netstandard2.1)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Runtime.InteropServices.WindowsRuntime (4.3) - restriction: || (&& (== net50) (< netcoreapp3.1)) (== netstandard2.0)
- System.Runtime (>= 4.3)
- System.Threading.Tasks.Extensions (4.5.4) - restriction: || (&& (== net50) (>= net472)) (&& (== net50) (< netcoreapp3.1)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard1.0)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= wp8)) (== netstandard2.0)
-GITHUB
- remote: fsprojects/FSharp.TypeProviders.SDK
- src/ProvidedTypes.fs (377d56321ad062985ed5aa19f205c1c4f04ef328)
- src/ProvidedTypes.fsi (377d56321ad062985ed5aa19f205c1c4f04ef328)
-GROUP TestsAndSamples
-RESTRICTION: || (== net50) (== netstandard2.0)
-NUGET
- remote: https://api.nuget.org/v3/index.json
- BenchmarkDotNet (0.12.1)
- BenchmarkDotNet.Annotations (>= 0.12.1)
- CommandLineParser (>= 2.4.3)
- Iced (>= 1.4)
- Microsoft.CodeAnalysis.CSharp (>= 2.10)
- Microsoft.Diagnostics.NETCore.Client (>= 0.2.61701)
- Microsoft.Diagnostics.Runtime (>= 1.1.57604)
- Microsoft.Diagnostics.Tracing.TraceEvent (>= 2.0.49)
- Microsoft.DotNet.PlatformAbstractions (>= 2.1)
- Microsoft.Win32.Registry (>= 4.5)
- Perfolizer (>= 0.2.1)
- System.Management (>= 4.5)
- System.Reflection.Emit (>= 4.3)
- System.Reflection.Emit.Lightweight (>= 4.3)
- System.Threading.Tasks.Extensions (>= 4.5.2)
- System.ValueTuple (>= 4.5)
- BenchmarkDotNet.Annotations (0.12.1)
- CommandLineParser (2.8)
- FSharp.Core (5.0.1)
- FSharp.Data.TypeProviders (5.0.0.6)
- FSharp.Core (>= 3.1.2.5)
- Giraffe (4.1)
- FSharp.Core (>= 4.7)
- Microsoft.AspNetCore.Authentication (>= 2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Authorization (>= 2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Diagnostics (>= 2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.ResponseCaching (>= 2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.IO.RecyclableMemoryStream (>= 1.2.2)
- Newtonsoft.Json (>= 12.0.2)
- TaskBuilder.fs (>= 2.1)
- Utf8Json (>= 1.3.7)
- Iced (1.11)
- Microsoft.AspNetCore.Authentication (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Authentication.Core (>= 2.2)
- Microsoft.AspNetCore.DataProtection (>= 2.2)
- Microsoft.AspNetCore.Http (>= 2.2)
- Microsoft.AspNetCore.Http.Extensions (>= 2.2)
- Microsoft.Extensions.Logging.Abstractions (>= 2.2)
- Microsoft.Extensions.Options (>= 2.2)
- Microsoft.Extensions.WebEncoders (>= 2.2)
- Microsoft.AspNetCore.Authentication.Abstractions (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2)
- Microsoft.Extensions.Logging.Abstractions (>= 2.2)
- Microsoft.Extensions.Options (>= 2.2)
- Microsoft.AspNetCore.Authentication.Core (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2)
- Microsoft.AspNetCore.Http (>= 2.2)
- Microsoft.AspNetCore.Http.Extensions (>= 2.2)
- Microsoft.AspNetCore.Authorization (5.0.5) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Metadata (>= 5.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0)
- Microsoft.Extensions.Options (>= 5.0)
- Microsoft.AspNetCore.Cryptography.Internal (5.0.5) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.DataProtection (5.0.5) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Cryptography.Internal (>= 5.0.5)
- Microsoft.AspNetCore.DataProtection.Abstractions (>= 5.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 5.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0)
- Microsoft.Extensions.Options (>= 5.0)
- Microsoft.Win32.Registry (>= 5.0)
- System.Security.Cryptography.Xml (>= 5.0)
- System.Security.Principal.Windows (>= 5.0) - restriction: == netstandard2.0
- Microsoft.AspNetCore.DataProtection.Abstractions (5.0.5) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Diagnostics (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Diagnostics.Abstractions (>= 2.2)
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.2)
- Microsoft.AspNetCore.Http.Extensions (>= 2.2)
- Microsoft.AspNetCore.WebUtilities (>= 2.2)
- Microsoft.Extensions.FileProviders.Physical (>= 2.2)
- Microsoft.Extensions.Logging.Abstractions (>= 2.2)
- Microsoft.Extensions.Options (>= 2.2)
- System.Diagnostics.DiagnosticSource (>= 4.5)
- System.Reflection.Metadata (>= 1.6)
- Microsoft.AspNetCore.Diagnostics.Abstractions (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Hosting.Abstractions (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Hosting.Server.Abstractions (>= 2.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 2.2)
- Microsoft.AspNetCore.Hosting.Server.Abstractions (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Http.Features (>= 2.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 2.2)
- Microsoft.AspNetCore.Http (2.2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2)
- Microsoft.AspNetCore.WebUtilities (>= 2.2)
- Microsoft.Extensions.ObjectPool (>= 2.2)
- Microsoft.Extensions.Options (>= 2.2)
- Microsoft.Net.Http.Headers (>= 2.2)
- Microsoft.AspNetCore.Http.Abstractions (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Http.Features (>= 2.2)
- System.Text.Encodings.Web (>= 4.5)
- Microsoft.AspNetCore.Http.Extensions (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2)
- Microsoft.Extensions.FileProviders.Abstractions (>= 2.2)
- Microsoft.Net.Http.Headers (>= 2.2)
- System.Buffers (>= 4.5)
- Microsoft.AspNetCore.Http.Features (5.0.5) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.Primitives (>= 5.0.1)
- System.IO.Pipelines (>= 5.0.1)
- Microsoft.AspNetCore.Metadata (5.0.5) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.ResponseCaching (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.AspNetCore.Http (>= 2.2)
- Microsoft.AspNetCore.Http.Extensions (>= 2.2)
- Microsoft.AspNetCore.ResponseCaching.Abstractions (>= 2.2)
- Microsoft.Extensions.Caching.Memory (>= 2.2)
- Microsoft.Extensions.Logging.Abstractions (>= 2.2)
- Microsoft.AspNetCore.ResponseCaching.Abstractions (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.Primitives (>= 2.2)
- Microsoft.AspNetCore.WebUtilities (2.2) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Net.Http.Headers (>= 2.2)
- System.Text.Encodings.Web (>= 4.5)
- Microsoft.Bcl.AsyncInterfaces (5.0)
- System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.CodeAnalysis.Analyzers (3.3.2)
- Microsoft.CodeAnalysis.Common (3.9)
- Microsoft.CodeAnalysis.Analyzers (>= 3.0)
- System.Collections.Immutable (>= 5.0)
- System.Memory (>= 4.5.4)
- System.Reflection.Metadata (>= 5.0)
- System.Runtime.CompilerServices.Unsafe (>= 5.0)
- System.Text.Encoding.CodePages (>= 4.5.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- Microsoft.CodeAnalysis.CSharp (3.9)
- Microsoft.CodeAnalysis.Common (3.9)
- Microsoft.CodeCoverage (16.9.4) - restriction: || (== net50) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0))
- Microsoft.Diagnostics.NETCore.Client (0.2.217401)
- Microsoft.Bcl.AsyncInterfaces (>= 1.1)
- Microsoft.Diagnostics.Runtime (2.0.217201)
- Microsoft.Diagnostics.NETCore.Client (>= 0.2.61701)
- System.Buffers (>= 4.5.1)
- System.Collections.Immutable (>= 1.7.1)
- System.Memory (>= 4.5.4)
- System.Reflection.Metadata (>= 1.8.1)
- System.Runtime.CompilerServices.Unsafe (>= 4.7.1)
- Microsoft.Diagnostics.Tracing.TraceEvent (2.0.66)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.2)
- Microsoft.DotNet.PlatformAbstractions (3.1.6)
- Microsoft.Extensions.Caching.Abstractions (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.Primitives (>= 5.0)
- Microsoft.Extensions.Caching.Memory (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.Caching.Abstractions (>= 5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0)
- Microsoft.Extensions.Options (>= 5.0)
- Microsoft.Extensions.Primitives (>= 5.0)
- Microsoft.Extensions.Configuration.Abstractions (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netcoreapp3.0)) (&& (== net50) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.Primitives (>= 5.0)
- Microsoft.Extensions.DependencyInjection (5.0.1)
- Microsoft.Bcl.AsyncInterfaces (>= 5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (5.0)
- Microsoft.Extensions.FileProviders.Abstractions (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.Primitives (>= 5.0)
- Microsoft.Extensions.FileProviders.Physical (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 5.0)
- Microsoft.Extensions.FileSystemGlobbing (>= 5.0)
- Microsoft.Extensions.Primitives (>= 5.0)
- Microsoft.Extensions.FileSystemGlobbing (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.Hosting.Abstractions (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Bcl.AsyncInterfaces (>= 5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 5.0)
- System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.Http (5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Logging (>= 5.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0)
- Microsoft.Extensions.Options (>= 5.0)
- Microsoft.Extensions.Logging (5.0)
- Microsoft.Extensions.DependencyInjection (>= 5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0)
- Microsoft.Extensions.Options (>= 5.0)
- System.Diagnostics.DiagnosticSource (>= 5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netstandard2.1)) (== netstandard2.0)
- Microsoft.Extensions.Logging.Abstractions (5.0)
- Microsoft.Extensions.ObjectPool (5.0.5) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.Options (5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Primitives (>= 5.0)
- Microsoft.Extensions.Primitives (5.0.1)
- System.Buffers (>= 4.5.1) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netstandard2.0) (>= xamarintvos)) (&& (== net50) (< netstandard2.0) (>= xamarinwatchos)) (== netstandard2.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netcoreapp3.0)) (&& (== net50) (< netstandard2.0) (>= xamarintvos)) (&& (== net50) (< netstandard2.0) (>= xamarinwatchos)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- Microsoft.Extensions.WebEncoders (5.0.5) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0)
- Microsoft.Extensions.Options (>= 5.0)
- System.Text.Encodings.Web (>= 5.0.1) - restriction: || (&& (== net50) (>= net461)) (== netstandard2.0)
- Microsoft.IO.RecyclableMemoryStream (2.0)
- Microsoft.Net.Http.Headers (2.2.8) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- Microsoft.Extensions.Primitives (>= 2.2)
- System.Buffers (>= 4.5)
- Microsoft.NET.Test.Sdk (16.9.4)
- Microsoft.CodeCoverage (>= 16.9.4) - restriction: || (== net50) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0))
- Microsoft.TestPlatform.TestHost (>= 16.9.4) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0))
- Microsoft.NETCore.Platforms (5.0.2)
- Microsoft.NETCore.Targets (5.0)
- Microsoft.TestPlatform.ObjectModel (16.9.4) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0))
- NuGet.Frameworks (>= 5.0)
- System.Reflection.Metadata (>= 1.6)
- Microsoft.TestPlatform.TestHost (16.9.4) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0))
- Microsoft.TestPlatform.ObjectModel (>= 16.9.4) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0))
- Newtonsoft.Json (>= 9.0.1) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0))
- Microsoft.Win32.Registry (5.0)
- System.Buffers (>= 4.5.1) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (>= xamarinios)) (&& (== net50) (>= xamarinmac)) (&& (== net50) (>= xamarintvos)) (&& (== net50) (>= xamarinwatchos)) (== netstandard2.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Security.AccessControl (>= 5.0)
- System.Security.Principal.Windows (>= 5.0)
- NETStandard.Library (2.0.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Newtonsoft.Json (13.0.1)
- NuGet.Frameworks (5.9) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0))
- Perfolizer (0.2.1)
- System.Memory (>= 4.5.3)
- runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.native.System (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- runtime.native.System.Net.Http (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- runtime.native.System.Security.Cryptography.Apple (4.3.1)
- runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3.1)
- runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3.1)
- runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
- Suave (2.6)
- FSharp.Core - restriction: || (== net50) (&& (== netstandard2.0) (>= netstandard2.1))
- System.Buffers (4.5.1)
- System.CodeDom (5.0)
- System.Collections (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Collections.Concurrent (4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Diagnostics.Tracing (>= 4.3)
- System.Globalization (>= 4.3)
- System.Reflection (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Collections.Immutable (5.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Diagnostics.Debug (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Diagnostics.DiagnosticSource (5.0.1)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (>= net45) (< netstandard1.3)) (&& (== net50) (>= net46)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net45) (< netstandard1.3)) (&& (== net50) (>= net46)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netcoreapp3.0)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Diagnostics.Tracing (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Formats.Asn1 (5.0)
- System.Globalization (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Globalization.Calendars (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Globalization (>= 4.3)
- System.Runtime (>= 4.3)
- System.Globalization.Extensions (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- System.Globalization (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.IO (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.IO.FileSystem (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.IO (>= 4.3)
- System.IO.FileSystem.Primitives (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.IO.FileSystem.Primitives (4.3)
- System.Runtime (>= 4.3)
- System.IO.Pipelines (5.0.1) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- System.Buffers (>= 4.5.1) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= xamarinios)) (&& (== net50) (>= xamarinmac)) (&& (== net50) (>= xamarintvos)) (&& (== net50) (>= xamarinwatchos)) (== netstandard2.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Linq (4.3)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Management (5.0)
- Microsoft.NETCore.Platforms (>= 5.0) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp2.0))
- Microsoft.Win32.Registry (>= 5.0) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp2.0))
- System.CodeDom (>= 5.0)
- System.Memory (4.5.4)
- System.Buffers (>= 4.5.1) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netstandard1.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= xamarinios)) (&& (== net50) (>= xamarinmac)) (&& (== net50) (>= xamarintvos)) (&& (== net50) (>= xamarinwatchos)) (== netstandard2.0)
- System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net50) (< netcoreapp2.0)) (== netstandard2.0)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard1.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (&& (== net50) (>= xamarinios)) (&& (== net50) (>= xamarinmac)) (&& (== net50) (>= xamarintvos)) (&& (== net50) (>= xamarinwatchos)) (== netstandard2.0)
- System.Net.Http (4.3.4)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- runtime.native.System (>= 4.3)
- runtime.native.System.Net.Http (>= 4.3)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Diagnostics.DiagnosticSource (>= 4.3)
- System.Diagnostics.Tracing (>= 4.3)
- System.Globalization (>= 4.3)
- System.Globalization.Extensions (>= 4.3)
- System.IO (>= 4.3)
- System.IO.FileSystem (>= 4.3)
- System.Net.Primitives (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Security.Cryptography.Algorithms (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.OpenSsl (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Security.Cryptography.X509Certificates (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Net.Primitives (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- System.Runtime (>= 4.3.1)
- System.Runtime.Handles (>= 4.3)
- System.Numerics.Vectors (4.5) - restriction: || (&& (== net50) (< netcoreapp2.0)) (== netstandard2.0)
- System.Reflection (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.IO (>= 4.3)
- System.Reflection.Primitives (>= 4.3)
- System.Runtime (>= 4.3)
- System.Reflection.Emit (4.7)
- System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== net50) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net50) (< netstandard1.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Reflection.Emit.ILGeneration (4.7) - restriction: || (&& (== net50) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net50) (< netstandard1.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Reflection.Emit.Lightweight (4.7)
- System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== net50) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (< portable-net45+wp8)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Reflection.Metadata (5.0)
- System.Collections.Immutable (>= 5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netstandard1.1)) (&& (== net50) (< netstandard2.0)) (== netstandard2.0)
- System.Reflection.Primitives (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Reflection.TypeExtensions (4.7) - restriction: || (&& (== net50) (< netcoreapp1.0)) (== netstandard2.0)
- System.Resources.ResourceManager (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Globalization (>= 4.3)
- System.Reflection (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- System.Runtime.CompilerServices.Unsafe (5.0)
- System.Runtime.Extensions (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1.1)
- Microsoft.NETCore.Targets (>= 1.1.3)
- System.Runtime (>= 4.3.1)
- System.Runtime.Handles (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Runtime.InteropServices (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Reflection (>= 4.3)
- System.Reflection.Primitives (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.Loader (4.3) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0))
- System.IO (>= 4.3)
- System.Reflection (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Numerics (4.3)
- System.Globalization (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Security.AccessControl (5.0)
- Microsoft.NETCore.Platforms (>= 5.0) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp2.0))
- System.Security.Principal.Windows (>= 5.0)
- System.Security.Cryptography.Algorithms (4.3.1)
- Microsoft.NETCore.Platforms (>= 1.1)
- runtime.native.System.Security.Cryptography.Apple (>= 4.3.1)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2)
- System.Collections (>= 4.3)
- System.IO (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Runtime.Numerics (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Security.Cryptography.Cng (5.0)
- System.Formats.Asn1 (>= 5.0) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp3.0))
- System.Security.Cryptography.Csp (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- System.IO (>= 4.3)
- System.Reflection (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Security.Cryptography.Algorithms (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading (>= 4.3)
- System.Security.Cryptography.Encoding (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3)
- System.Collections (>= 4.3)
- System.Collections.Concurrent (>= 4.3)
- System.Linq (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Security.Cryptography.OpenSsl (5.0)
- System.Formats.Asn1 (>= 5.0) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp3.0))
- System.Security.Cryptography.Pkcs (5.0.1) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- System.Buffers (>= 4.5.1) - restriction: || (&& (== net50) (< netcoreapp2.0) (< netstandard2.1)) (== netstandard2.0)
- System.Formats.Asn1 (>= 5.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net50) (< netcoreapp2.1) (< netstandard2.1)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Security.Cryptography.Cng (>= 5.0)
- System.Security.Cryptography.Primitives (4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Globalization (>= 4.3)
- System.IO (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Threading (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Security.Cryptography.X509Certificates (4.3.2)
- Microsoft.NETCore.Platforms (>= 1.1)
- runtime.native.System (>= 4.3)
- runtime.native.System.Net.Http (>= 4.3)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2)
- System.Collections (>= 4.3)
- System.Diagnostics.Debug (>= 4.3)
- System.Globalization (>= 4.3)
- System.Globalization.Calendars (>= 4.3)
- System.IO (>= 4.3)
- System.IO.FileSystem (>= 4.3)
- System.IO.FileSystem.Primitives (>= 4.3)
- System.Resources.ResourceManager (>= 4.3)
- System.Runtime (>= 4.3)
- System.Runtime.Extensions (>= 4.3)
- System.Runtime.Handles (>= 4.3)
- System.Runtime.InteropServices (>= 4.3)
- System.Runtime.Numerics (>= 4.3)
- System.Security.Cryptography.Algorithms (>= 4.3)
- System.Security.Cryptography.Cng (>= 4.3)
- System.Security.Cryptography.Csp (>= 4.3)
- System.Security.Cryptography.Encoding (>= 4.3)
- System.Security.Cryptography.OpenSsl (>= 4.3)
- System.Security.Cryptography.Primitives (>= 4.3)
- System.Text.Encoding (>= 4.3)
- System.Threading (>= 4.3)
- System.Security.Cryptography.Xml (5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (< netcoreapp2.1)) (== netstandard2.0)
- System.Security.Cryptography.Pkcs (>= 5.0)
- System.Security.Permissions (>= 5.0)
- System.Security.Permissions (5.0) - restriction: || (&& (== net50) (>= monotouch)) (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- System.Security.AccessControl (>= 5.0)
- System.Security.Principal.Windows (5.0)
- System.Text.Encoding (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Text.Encoding.CodePages (5.0)
- Microsoft.NETCore.Platforms (>= 5.0) - restriction: || (== net50) (&& (== netstandard2.0) (>= net50)) (&& (== netstandard2.0) (>= netcoreapp2.0))
- System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0)) (== netstandard2.0)
- System.Text.Encodings.Web (5.0.1) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp3.0)) (== netstandard2.0)
- System.Buffers (>= 4.5.1) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0) (< netstandard2.1)) (== netstandard2.0)
- System.Memory (>= 4.5.4) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net50) (< netcoreapp2.1) (< netstandard2.1)) (&& (== net50) (>= uap10.1)) (== netstandard2.0)
- System.Threading (4.3)
- System.Runtime (>= 4.3)
- System.Threading.Tasks (>= 4.3)
- System.Threading.Tasks (4.3)
- Microsoft.NETCore.Platforms (>= 1.1)
- Microsoft.NETCore.Targets (>= 1.1)
- System.Runtime (>= 4.3)
- System.Threading.Tasks.Extensions (4.5.4)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net50) (>= net461)) (&& (== net50) (< netcoreapp2.1)) (&& (== net50) (< netstandard1.0)) (&& (== net50) (< netstandard2.0)) (&& (== net50) (>= wp8)) (== netstandard2.0)
- System.ValueTuple (4.5)
- TaskBuilder.fs (2.1)
- FSharp.Core (>= 4.1.17)
- NETStandard.Library (>= 1.6.1)
- System.ValueTuple (>= 4.4)
- Utf8Json (1.3.7)
- System.Reflection.Emit (>= 4.3)
- System.Reflection.Emit.Lightweight (>= 4.3)
- System.Threading.Tasks.Extensions (>= 4.4)
- System.ValueTuple (>= 4.4)
- xunit (2.4.1)
- xunit.analyzers (>= 0.10)
- xunit.assert (2.4.1)
- xunit.core (2.4.1)
- xunit.abstractions (2.0.3)
- xunit.analyzers (0.10)
- xunit.assert (2.4.1)
- NETStandard.Library (>= 1.6.1)
- xunit.core (2.4.1)
- xunit.extensibility.core (2.4.1)
- xunit.extensibility.execution (2.4.1)
- xunit.extensibility.core (2.4.1)
- NETStandard.Library (>= 1.6.1)
- xunit.abstractions (>= 2.0.3)
- xunit.extensibility.execution (2.4.1)
- NETStandard.Library (>= 1.6.1)
- xunit.extensibility.core (2.4.1)
- xunit.runner.console (2.4.1)
- xunit.runner.utility (2.4.1)
- NETStandard.Library (>= 1.6) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0))
- NETStandard.Library (>= 1.6.1) - restriction: || (&& (== net50) (< netcoreapp1.0)) (&& (== net50) (< netstandard1.5)) (== netstandard2.0)
- System.Reflection.TypeExtensions (>= 4.3) - restriction: || (&& (== net50) (< netcoreapp1.0)) (== netstandard2.0)
- System.Runtime.Loader (>= 4.0) - restriction: || (== net50) (&& (== netstandard2.0) (>= netcoreapp1.0))
- xunit.abstractions (>= 2.0.3)
- xunit.runner.visualstudio (2.4.3)
diff --git a/samples/star-wars-api/FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj b/samples/star-wars-api/FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj
index 87cffddde..643e4c7c8 100644
--- a/samples/star-wars-api/FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj
+++ b/samples/star-wars-api/FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj
@@ -1,15 +1,18 @@
-
+
+
Exe
- net5.0
+ net6.0
false
+
-
-
-
+
+
+
+
@@ -18,8 +21,11 @@
-
-
-
+
+
+
+
+
+
diff --git a/samples/star-wars-api/HttpHandlers.fs b/samples/star-wars-api/HttpHandlers.fs
index 916b27331..141c08bde 100644
--- a/samples/star-wars-api/HttpHandlers.fs
+++ b/samples/star-wars-api/HttpHandlers.fs
@@ -1,15 +1,14 @@
namespace FSharp.Data.GraphQL.Samples.StarWarsApi
+open System.IO
open System.Text
open Giraffe
open Microsoft.AspNetCore.Http
open Newtonsoft.Json
+open Newtonsoft.Json.Linq
open FSharp.Data.GraphQL.Execution
-open System.IO
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
-open FSharp.Control.Tasks
-open Newtonsoft.Json.Linq
type HttpHandler = HttpFunc -> HttpContext -> HttpFuncResult
@@ -32,7 +31,7 @@ module HttpHandlers =
let serialize d = JsonConvert.SerializeObject(d, jsonSettings)
let deserialize (data : string) =
- let getMap (token : JToken) =
+ let getMap (token : JToken) =
let rec mapper (name : string) (token : JToken) =
match name, token.Type with
| "variables", JTokenType.Object -> token.Children() |> Seq.map (fun x -> x.Name, mapper x.Name x.Value) |> Map.ofSeq |> box
@@ -41,10 +40,10 @@ module HttpHandlers =
token.Children()
|> Seq.map (fun x -> x.Name, mapper x.Name x.Value)
|> Map.ofSeq
- if System.String.IsNullOrWhiteSpace(data)
+ if System.String.IsNullOrWhiteSpace(data)
then None
else data |> JToken.Parse |> getMap |> Some
-
+
let json =
function
| Direct (data, _) ->
@@ -52,19 +51,19 @@ module HttpHandlers =
| Deferred (data, _, deferred) ->
deferred |> Observable.add(fun d -> printfn "Deferred: %s" (serialize d))
JsonConvert.SerializeObject(data, jsonSettings)
- | Stream data ->
+ | Stream data ->
data |> Observable.add(fun d -> printfn "Subscription data: %s" (serialize d))
"{}"
-
+
let removeWhitespacesAndLineBreaks (str : string) = str.Trim().Replace("\r\n", " ")
-
+
let readStream (s : Stream) =
use ms = new MemoryStream(4096)
s.CopyTo(ms)
ms.ToArray()
-
+
let data = Encoding.UTF8.GetString(readStream ctx.Request.Body) |> deserialize
-
+
let query =
data |> Option.bind (fun data ->
if data.ContainsKey("query")
@@ -73,7 +72,7 @@ module HttpHandlers =
| :? string as x -> Some x
| _ -> failwith "Failure deserializing repsonse. Could not read query - it is not stringified in request."
else None)
-
+
let variables =
data |> Option.bind (fun data ->
if data.ContainsKey("variables")
@@ -84,7 +83,7 @@ module HttpHandlers =
| :? Map as x -> Some x
| _ -> failwith "Failure deserializing response. Could not read variables - it is not a object in the request."
else None)
-
+
match query, variables with
| Some query, Some variables ->
printfn "Received query: %s" query
@@ -106,7 +105,7 @@ module HttpHandlers =
return! okWithStr (json result) next ctx
}
- let webApp : HttpHandler =
+ let webApp : HttpHandler =
setCorsHeaders
- >=> graphQL
+ >=> graphQL
>=> setContentTypeAsJson
diff --git a/src/FSharp.Data.GraphQL.Client.DesignTime/FSharp.Data.GraphQL.Client.DesignTime.fsproj b/src/FSharp.Data.GraphQL.Client.DesignTime/FSharp.Data.GraphQL.Client.DesignTime.fsproj
index 2cca4b284..a4dd04afd 100644
--- a/src/FSharp.Data.GraphQL.Client.DesignTime/FSharp.Data.GraphQL.Client.DesignTime.fsproj
+++ b/src/FSharp.Data.GraphQL.Client.DesignTime/FSharp.Data.GraphQL.Client.DesignTime.fsproj
@@ -1,5 +1,5 @@
-
-
+
+
Library
netstandard2.0
@@ -11,16 +11,22 @@
false
false
..\FSharp.Data.GraphQL.Client\bin\$(Configuration)\typeproviders\fsharp41\
+
+ FSharp implementation of Facebook GraphQL query language (Client)
+
+
+
+ all
+
+
+ all
+
+
+
+
+
-
- True
- paket-files/ProvidedTypes.fsi
-
-
- True
- paket-files/ProvidedTypes.fs
-
@@ -37,10 +43,9 @@
-
+
-
+
-
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Client.DesignTime/ProvidedTypesHelper.fs b/src/FSharp.Data.GraphQL.Client.DesignTime/ProvidedTypesHelper.fs
index 3ee46e852..8966e7eb3 100644
--- a/src/FSharp.Data.GraphQL.Client.DesignTime/ProvidedTypesHelper.fs
+++ b/src/FSharp.Data.GraphQL.Client.DesignTime/ProvidedTypesHelper.fs
@@ -1,6 +1,5 @@
/// The MIT License (MIT)
/// Copyright (c) 2016 Bazinga Technologies Inc
-
namespace FSharp.Data.GraphQL
open System
@@ -21,32 +20,41 @@ open System.Collections
module internal QuotationHelpers =
let rec coerceValues fieldTypeLookup fields =
- let arrayExpr (arrayType : Type) (v : obj) =
+ let arrayExpr (arrayType: Type) (v: obj) =
let typ = arrayType.GetElementType()
+
let instance =
match v with
| :? IEnumerable as x -> Seq.cast x |> Array.ofSeq
| _ -> failwith "Unexpected array value."
+
let exprs = coerceValues (fun _ -> typ) instance
Expr.NewArray(typ, exprs)
- let tupleExpr (tupleType : Type) (v : obj) =
+
+ let tupleExpr (tupleType: Type) (v: obj) =
let typ = FSharpType.GetTupleElements tupleType |> Array.mapi (fun i t -> i, t) |> Map.ofArray
let fieldTypeLookup i = typ.[i]
let fields = FSharpValue.GetTupleFields v
let exprs = coerceValues fieldTypeLookup fields
Expr.NewTuple(exprs)
- Array.mapi (fun i v ->
+
+ Array.mapi
+ (fun i v ->
let expr =
- if isNull v then simpleTypeExpr v
+ if isNull v then
+ simpleTypeExpr v
else
let tpy = v.GetType()
+
if tpy.IsArray then arrayExpr tpy v
elif FSharpType.IsTuple tpy then tupleExpr tpy v
elif FSharpType.IsUnion tpy then unionExpr v |> snd
elif FSharpType.IsRecord tpy then recordExpr v |> snd
else simpleTypeExpr v
- Expr.Coerce(expr, fieldTypeLookup i)
- ) fields |> List.ofArray
+
+ Expr.Coerce(expr, fieldTypeLookup i))
+ fields
+ |> List.ofArray
and simpleTypeExpr instance = Expr.Value(instance)
@@ -63,7 +71,7 @@ module internal QuotationHelpers =
let fieldTypeLookup indx = fieldInfo.[indx].PropertyType
typ, Expr.NewRecord(instance.GetType(), coerceValues fieldTypeLookup fields)
- and arrayExpr (instance : 'a array) =
+ and arrayExpr (instance: 'a array) =
let typ = typeof<'a>
let arrayType = instance.GetType()
let exprs = coerceValues (fun _ -> typ) (instance |> Array.map box)
@@ -88,34 +96,41 @@ module internal QuotationHelpers =
module internal ProvidedEnum =
let ctor = typeof.GetConstructors().[0]
- let makeProvidedType(name, items : string seq) =
+ let makeProvidedType (name, items: string seq) =
let tdef = ProvidedTypeDefinition(name, Some typeof, nonNullable = true, isSealed = true)
- tdef.AddMembersDelayed(fun _ ->
+
+ tdef.AddMembersDelayed (fun _ ->
items
|> Seq.map (fun item ->
- let getterCode (_ : Expr list) =
- Expr.NewObject(ctor, [ <@@ name @@>; <@@ item @@> ])
+ let getterCode (_: Expr list) = Expr.NewObject(ctor, [ <@@ name @@>; <@@ item @@> ])
ProvidedProperty(item, tdef, getterCode, isStatic = true))
|> Seq.cast
|> List.ofSeq)
+
tdef
type internal ProvidedTypeMetadata =
- { Name : string
- Description : string option }
+ {
+ Name: string
+ Description: string option
+ }
module internal ProvidedInterface =
- let makeProvidedType(metadata : ProvidedTypeMetadata) =
- let tdef = ProvidedTypeDefinition("I" + metadata.Name.FirstCharUpper(), None, nonNullable = true, isInterface = true)
+ let makeProvidedType (metadata: ProvidedTypeMetadata) =
+ let tdef =
+ ProvidedTypeDefinition("I" + metadata.Name.FirstCharUpper(), None, nonNullable = true, isInterface = true)
+
metadata.Description |> Option.iter tdef.AddXmlDoc
tdef
type internal RecordPropertyMetadata =
- { Name : string
- Alias : string option
- Description : string option
- DeprecationReason : string option
- Type : Type }
+ {
+ Name: string
+ Alias: string option
+ Description: string option
+ DeprecationReason: string option
+ Type: Type
+ }
member x.AliasOrName =
match x.Alias with
| Some x -> x
@@ -124,7 +139,7 @@ type internal RecordPropertyMetadata =
type internal ProvidedRecordTypeDefinition(className, baseType) =
inherit ProvidedTypeDefinition(className, baseType, nonNullable = true)
- let mutable properties : RecordPropertyMetadata list = []
+ let mutable properties: RecordPropertyMetadata list = []
member __.GetRecordProperties() = properties
@@ -133,27 +148,40 @@ type internal ProvidedRecordTypeDefinition(className, baseType) =
[]
module internal Failures =
let uploadTypeIsNotScalar uploadTypeName =
- failwithf "Upload type \"%s\" was found on the schema, but it is not a Scalar type. Upload types can only be used if they are defined as scalar types." uploadTypeName
+ failwithf
+ "Upload type \"%s\" was found on the schema, but it is not a Scalar type. Upload types can only be used if they are defined as scalar types."
+ uploadTypeName
module internal ProvidedRecord =
let ctor = typeof.GetConstructors().[0]
- let makeProvidedType(tdef : ProvidedRecordTypeDefinition, properties : RecordPropertyMetadata list, explicitOptionalParameters: bool) =
+ let makeProvidedType
+ (
+ tdef: ProvidedRecordTypeDefinition,
+ properties: RecordPropertyMetadata list,
+ explicitOptionalParameters: bool
+ ) =
let name = tdef.Name
- tdef.AddMembersDelayed(fun _ ->
- properties |> List.map (fun metadata ->
+
+ tdef.AddMembersDelayed (fun _ ->
+ properties
+ |> List.map (fun metadata ->
let pname = metadata.AliasOrName.FirstCharUpper()
- let getterCode (args : Expr list) =
- <@@ let this = %%args.[0] : RecordBase
+
+ let getterCode (args: Expr list) =
+ <@@ let this: RecordBase = %%args.[0]
+
match this.GetProperties() |> List.tryFind (fun prop -> prop.Name = pname) with
| Some prop -> prop.Value
| None -> failwithf "Expected to find property \"%s\", but the property was not found." pname @@>
+
let pdef = ProvidedProperty(pname, metadata.Type, getterCode)
metadata.Description |> Option.iter pdef.AddXmlDoc
metadata.DeprecationReason |> Option.iter pdef.AddObsoleteAttribute
pdef))
- let addConstructorDelayed (propertiesGetter : unit -> (string * string option * Type) list) =
- tdef.AddMembersDelayed(fun _ ->
+
+ let addConstructorDelayed (propertiesGetter: unit -> (string * string option * Type) list) =
+ tdef.AddMembersDelayed (fun _ ->
// We need to build a constructor that takes all optional properties wrapped in another option.
// We need to do this because optional parameters have issues with non-nullable types
// in the type provider SDK. They require a default value, and if the type is not nullable
@@ -172,41 +200,59 @@ module internal ProvidedRecord =
// combinations of all possible overloads, and for each one we map the user's provided values and
// fill the others with a null value. This way we can construct the RecordBase type providing all
// needed properties.
- let properties = propertiesGetter()
+ let properties = propertiesGetter ()
+
let optionalProperties, requiredProperties =
properties
|> List.map (fun (name, alias, t) -> Option.defaultValue name alias, t)
|> List.partition (fun (_, t) -> isOption t)
+
if explicitOptionalParameters then
let constructorProperties = requiredProperties @ optionalProperties
let propertyNames = constructorProperties |> List.map (fst >> (fun x -> x.FirstCharUpper()))
let constructorPropertyTypes = constructorProperties |> List.map snd
- let invoker (args : Expr list) =
+
+ let invoker (args: Expr list) =
let properties =
let baseConstructorArgs =
let coercedArgs =
(constructorPropertyTypes, args)
||> List.map2 (fun t arg ->
let arg = Expr.Coerce(arg, typeof)
+
match t with
| Option (Option t) -> <@@ makeValue t %%arg @@>
| _ -> <@@ %%arg @@>)
+
(propertyNames, coercedArgs)
- ||> List.map2 (fun name value -> <@@ { RecordProperty.Name = name; Value = %%value } @@>)
+ ||> List.map2 (fun name value ->
+ <@@ {
+ RecordProperty.Name = name
+ Value = %%value
+ } @@>)
+
Expr.NewArray(typeof, baseConstructorArgs)
- Expr.NewObject(ctor, [Expr.Value(name); properties])
+
+ Expr.NewObject(ctor, [ Expr.Value(name); properties ])
+
let constructorParams =
constructorProperties
- |> List.map (fun (name, t) -> ProvidedParameter(name, t, ?optionalValue = if isOption t then Some null else None))
- [ProvidedConstructor(constructorParams, invoker)]
+ |> List.map (fun (name, t) ->
+ ProvidedParameter(name, t, ?optionalValue = if isOption t then Some null else None))
+
+ [ ProvidedConstructor(constructorParams, invoker) ]
else
List.combinations optionalProperties
|> List.map (fun (optionalProperties, nullValuedProperties) ->
let constructorProperties = requiredProperties @ optionalProperties
- let propertyNames = (constructorProperties @ nullValuedProperties) |> List.map (fst >> (fun x -> x.FirstCharUpper()))
+
+ let propertyNames =
+ (constructorProperties @ nullValuedProperties) |> List.map (fst >> (fun x -> x.FirstCharUpper()))
+
let constructorPropertyTypes = constructorProperties |> List.map snd
let nullValuedPropertyTypes = nullValuedProperties |> List.map snd
- let invoker (args : Expr list) =
+
+ let invoker (args: Expr list) =
let properties =
let baseConstructorArgs =
let coercedArgs =
@@ -214,49 +260,75 @@ module internal ProvidedRecord =
||> List.map2 (fun t arg ->
let arg = Expr.Coerce(arg, typeof)
if isOption t then <@@ makeSome %%arg @@> else <@@ %%arg @@>)
+
let nullValuedArgs = nullValuedPropertyTypes |> List.map (fun _ -> <@@ null @@>)
+
(propertyNames, (coercedArgs @ nullValuedArgs))
- ||> List.map2 (fun name value -> <@@ { RecordProperty.Name = name; Value = %%value } @@>)
+ ||> List.map2 (fun name value ->
+ <@@ {
+ RecordProperty.Name = name
+ Value = %%value
+ } @@>)
+
Expr.NewArray(typeof, baseConstructorArgs)
- Expr.NewObject(ctor, [Expr.Value(name); properties])
+
+ Expr.NewObject(ctor, [ Expr.Value(name); properties ])
+
let constructorParams =
constructorProperties
|> List.map (fun (name, t) ->
match t with
| Option t -> ProvidedParameter(name, t)
| _ -> ProvidedParameter(name, t))
+
ProvidedConstructor(constructorParams, invoker)))
+
match tdef.BaseType with
| :? ProvidedRecordTypeDefinition as bdef ->
- bdef.AddMembersDelayed(fun _ ->
+ bdef.AddMembersDelayed (fun _ ->
let asType =
- let invoker (args : Expr list) =
- <@@ let this = %%args.[0] : RecordBase
- if this.GetName() = name then this
- else failwithf "Expected type to be \"%s\", but it is \"%s\". Make sure to check the type by calling \"Is%s\" method before calling \"As%s\" method." name (this.GetName()) name name @@>
+ let invoker (args: Expr list) =
+ <@@ let this: RecordBase = %%args.[0]
+
+ if this.GetName() = name then
+ this
+ else
+ failwithf
+ "Expected type to be \"%s\", but it is \"%s\". Make sure to check the type by calling \"Is%s\" method before calling \"As%s\" method."
+ name
+ (this.GetName())
+ name
+ name @@>
+
ProvidedMethod("As" + name, [], tdef, invoker)
+
let tryAsType =
- let invoker (args : Expr list) =
- <@@ let this = %%args.[0] : RecordBase
- if this.GetName() = name then Some this
- else None @@>
- ProvidedMethod("TryAs" + name, [], typedefof<_ option>.MakeGenericType(tdef), invoker)
+ let invoker (args: Expr list) =
+ <@@ let this: RecordBase = %%args.[0]
+ if this.GetName() = name then Some this else None @@>
+
+ ProvidedMethod("TryAs" + name, [], typedefof<_ option>.MakeGenericType (tdef), invoker)
+
let isType =
- let invoker (args : Expr list) =
- <@@ let this = %%args.[0] : RecordBase
+ let invoker (args: Expr list) =
+ <@@ let this: RecordBase = %%args.[0]
this.GetName() = name @@>
+
ProvidedMethod("Is" + name, [], typeof, invoker)
- let members : MemberInfo list = [asType; tryAsType; isType]
+
+ let members: MemberInfo list = [ asType; tryAsType; isType ]
members)
- let propertiesGetter() = bdef.GetRecordProperties() @ properties |> List.map (fun p -> p.Name, p.Alias, p.Type)
+
+ let propertiesGetter () = bdef.GetRecordProperties() @ properties |> List.map (fun p -> p.Name, p.Alias, p.Type)
addConstructorDelayed propertiesGetter
| _ ->
- let propertiesGetter() = properties |> List.map (fun p -> p.Name, p.Alias, p.Type)
+ let propertiesGetter () = properties |> List.map (fun p -> p.Name, p.Alias, p.Type)
addConstructorDelayed propertiesGetter
+
tdef.SetRecordProperties(properties)
tdef
- let preBuildProvidedType(metadata : ProvidedTypeMetadata, baseType : Type option) =
+ let preBuildProvidedType (metadata: ProvidedTypeMetadata, baseType: Type option) =
let baseType = Option.defaultValue typeof baseType
let name = metadata.Name.FirstCharUpper()
let tdef = ProvidedRecordTypeDefinition(name, Some baseType)
@@ -265,39 +337,49 @@ module internal ProvidedRecord =
#nowarn "10001"
module internal ProvidedOperationResult =
- let makeProvidedType(operationType : Type) =
- let tdef = ProvidedTypeDefinition("OperationResult", Some typeof, nonNullable = true)
- tdef.AddMemberDelayed(fun _ ->
- let getterCode (args : Expr list) =
- <@@ let this = %%args.[0] : OperationResultBase
+ let makeProvidedType (operationType: Type) =
+ let tdef =
+ ProvidedTypeDefinition("OperationResult", Some typeof, nonNullable = true)
+
+ tdef.AddMemberDelayed (fun _ ->
+ let getterCode (args: Expr list) =
+ <@@ let this: OperationResultBase = %%args.[0]
this.RawData @@>
+
let prop = ProvidedProperty("Data", operationType, getterCode)
prop.AddXmlDoc("Contains the data returned by the operation on the server.")
prop)
+
tdef
module internal ProvidedOperation =
- let makeProvidedType(actualQuery : string,
- operationDefinition : OperationDefinition,
- operationTypeName : string,
- operationFieldsExpr : Expr,
- schemaTypes: Map,
- schemaProvidedTypes : Map,
- operationType : Type,
- contextInfo : GraphQLRuntimeContextInfo option,
- uploadInputTypeName : string option,
- className : string,
- explicitOptionalParameters: bool) =
+ let makeProvidedType
+ (
+ actualQuery: string,
+ operationDefinition: OperationDefinition,
+ operationTypeName: string,
+ operationFieldsExpr: Expr,
+ schemaTypes: Map,
+ schemaProvidedTypes: Map,
+ operationType: Type,
+ contextInfo: GraphQLRuntimeContextInfo option,
+ uploadInputTypeName: string option,
+ className: string,
+ explicitOptionalParameters: bool
+ ) =
let tdef = ProvidedTypeDefinition(className, Some typeof)
tdef.AddXmlDoc("Represents a GraphQL operation on the server.")
- tdef.AddMembersDelayed(fun _ ->
- let operationResultDef = ProvidedOperationResult.makeProvidedType(operationType)
+
+ tdef.AddMembersDelayed (fun _ ->
+ let operationResultDef = ProvidedOperationResult.makeProvidedType (operationType)
+
let isScalar (typeName: string) =
match schemaTypes.TryFind typeName with
| Some introspectionType -> introspectionType.Kind = TypeKind.SCALAR
| None -> false
+
let variables =
- let rec mapVariable (variableName : string) (variableType : InputType) =
+ let rec mapVariable (variableName: string) (variableType: TypeReference) =
match variableType with
| NamedType typeName ->
match uploadInputTypeName with
@@ -314,14 +396,18 @@ module internal ProvidedOperation =
| ListType itype ->
let name, t = mapVariable variableName itype
name, t |> TypeMapping.makeArray |> TypeMapping.makeOption
- | NonNullType itype ->
+ | NonNullNameType itype ->
let name, t = mapVariable variableName itype
name, TypeMapping.unwrapOption t
- operationDefinition.VariableDefinitions |> List.map (fun vdef -> mapVariable vdef.VariableName vdef.Type)
- let buildVariablesExprFromArgs (varNames : string list) (args : Expr list) =
- let mapVariableExpr (name : string) (value : Expr) =
+
+ operationDefinition.VariableDefinitions
+ |> List.map (fun vdef -> mapVariable vdef.VariableName vdef.Type)
+
+ let buildVariablesExprFromArgs (varNames: string list) (args: Expr list) =
+ let mapVariableExpr (name: string) (value: Expr) =
let value = Expr.Coerce(value, typeof)
- <@@ let rec mapVariableValue (value : obj) =
+
+ <@@ let rec mapVariableValue (value: obj) =
match value with
| null -> null
| :? string -> value // We need this because strings are enumerables, and we don't want to enumerate them recursively as an object
@@ -330,18 +416,27 @@ module internal ProvidedOperation =
| OptionValue v -> v |> Option.map mapVariableValue |> box
| EnumerableValue v -> v |> Array.map mapVariableValue |> box
| v -> v
+
(name, mapVariableValue %%value) @@>
+
let args =
let varArgs = List.skip (args.Length - variables.Length) args
(varNames, varArgs) ||> List.map2 mapVariableExpr
+
Expr.NewArray(typeof, args)
+
let defaultContextExpr =
match contextInfo with
| Some info ->
let serverUrl = info.ServerUrl
let headerNames = info.HttpHeaders |> Seq.map fst |> Array.ofSeq
let headerValues = info.HttpHeaders |> Seq.map snd |> Array.ofSeq
- <@@ { ServerUrl = serverUrl; HttpHeaders = Array.zip headerNames headerValues; Connection = new GraphQLClientConnection() } @@>
+
+ <@@ {
+ ServerUrl = serverUrl
+ HttpHeaders = Array.zip headerNames headerValues
+ Connection = new GraphQLClientConnection()
+ } @@>
| None -> <@@ Unchecked.defaultof @@>
// We need to use the combination strategy to generate overloads for variables in the Run/AsyncRun methods.
// The strategy follows the same principle with ProvidedRecord constructor overloads,
@@ -349,44 +444,60 @@ module internal ProvidedOperation =
// if no default context is provided.
let methodOverloadDefinitions =
let overloadsWithoutContext =
- let optionalVariables, requiredVariables =
- variables |> List.partition (fun (_, t) -> isOption t)
+ let optionalVariables, requiredVariables = variables |> List.partition (fun (_, t) -> isOption t)
+
if explicitOptionalParameters then
- [requiredVariables @ optionalVariables]
+ [ requiredVariables @ optionalVariables ]
else
List.combinations optionalVariables
|> List.map (fun (optionalVariables, _) ->
- let optionalVariables = optionalVariables |> List.map (fun (name, t) -> name, (TypeMapping.unwrapOption t))
+ let optionalVariables =
+ optionalVariables |> List.map (fun (name, t) -> name, (TypeMapping.unwrapOption t))
+
requiredVariables @ optionalVariables)
+
let overloadsWithContext =
overloadsWithoutContext
|> List.map (fun var -> ("runtimeContext", typeof) :: var)
+
match contextInfo with
| Some _ -> overloadsWithoutContext @ overloadsWithContext
| None -> overloadsWithContext
// Multipart requests should only be used when the user specifies a upload type name AND the type
// is present in the query as an input value. If not, we fallback to classic requests.
let shouldUseMultipartRequest =
- let rec existsUploadType (foundTypes : ProvidedTypeDefinition list) (t : Type) =
+ let rec existsUploadType (foundTypes: ProvidedTypeDefinition list) (t: Type) =
match t with
- | :? ProvidedTypeDefinition as tdef when not (List.contains tdef foundTypes) -> tdef.DeclaredProperties |> Seq.exists ((fun p -> p.PropertyType) >> existsUploadType (tdef :: foundTypes))
+ | :? ProvidedTypeDefinition as tdef when not (List.contains tdef foundTypes) ->
+ tdef.DeclaredProperties
+ |> Seq.exists ((fun p -> p.PropertyType) >> existsUploadType (tdef :: foundTypes))
| Option t -> existsUploadType foundTypes t
| Array t -> existsUploadType foundTypes t
| _ -> t = typeof
+
variables |> Seq.exists (snd >> existsUploadType [])
- let runMethodOverloads : MemberInfo list =
+
+ let runMethodOverloads: MemberInfo list =
let operationName = Option.toObj operationDefinition.Name
- methodOverloadDefinitions |> List.map (fun overloadParameters ->
- let variableNames = overloadParameters |> List.map fst |> List.filter (fun name -> name <> "runtimeContext")
- let invoker (args : Expr list) =
+
+ methodOverloadDefinitions
+ |> List.map (fun overloadParameters ->
+ let variableNames =
+ overloadParameters |> List.map fst |> List.filter (fun name -> name <> "runtimeContext")
+
+ let invoker (args: Expr list) =
// First arg is the operation instance, second should be the context, if the overload asks for one.
// We determine it by seeing if the variable names have one less item than the arguments without the instance.
let argsWithoutInstance = args.Tail
+
let variableArgs, isDefaultContext, context =
- if argsWithoutInstance.Length - variableNames.Length = 1
- then argsWithoutInstance.Tail, false, argsWithoutInstance.Head
- else argsWithoutInstance, true, defaultContextExpr
+ if argsWithoutInstance.Length - variableNames.Length = 1 then
+ argsWithoutInstance.Tail, false, argsWithoutInstance.Head
+ else
+ argsWithoutInstance, true, defaultContextExpr
+
let variables = buildVariablesExprFromArgs variableNames variableArgs
+
let variables =
if explicitOptionalParameters then
<@@ (%%variables: (string * obj) [])
@@ -396,38 +507,63 @@ module internal ProvidedOperation =
| _ -> true) @@>
else
variables
- <@@ let context = %%context : GraphQLProviderRuntimeContext
- let request =
- { ServerUrl = context.ServerUrl
- HttpHeaders = context.HttpHeaders
- OperationName = Option.ofObj operationName
- Query = actualQuery
- Variables = %%variables }
- let response =
- if shouldUseMultipartRequest
- then Tracer.runAndMeasureExecutionTime "Ran a multipart GraphQL query request" (fun _ -> GraphQLClient.sendMultipartRequest context.Connection request)
- else Tracer.runAndMeasureExecutionTime "Ran a GraphQL query request" (fun _ -> GraphQLClient.sendRequest context.Connection request)
- let responseJson = Tracer.runAndMeasureExecutionTime "Parsed a GraphQL response to a JsonValue" (fun _ -> JsonValue.Parse response)
- // If the user does not provide a context, we should dispose the default one after running the query
- if isDefaultContext then (context :> IDisposable).Dispose()
- OperationResultBase(responseJson, %%operationFieldsExpr, operationTypeName) @@>
- let methodParameters = overloadParameters |> List.map (fun (name, t) -> ProvidedParameter(name, t, ?optionalValue = if isOption t then Some null else None))
+
+ <@@ let context: GraphQLProviderRuntimeContext = %%context
+
+ let request =
+ {
+ ServerUrl = context.ServerUrl
+ HttpHeaders = context.HttpHeaders
+ OperationName = Option.ofObj operationName
+ Query = actualQuery
+ Variables = %%variables
+ }
+
+ let response =
+ if shouldUseMultipartRequest then
+ Tracer.runAndMeasureExecutionTime "Ran a multipart GraphQL query request" (fun _ ->
+ GraphQLClient.sendMultipartRequest context.Connection request)
+ else
+ Tracer.runAndMeasureExecutionTime "Ran a GraphQL query request" (fun _ ->
+ GraphQLClient.sendRequest context.Connection request)
+
+ let responseJson =
+ Tracer.runAndMeasureExecutionTime "Parsed a GraphQL response to a JsonValue" (fun _ ->
+ JsonValue.Parse response)
+ // If the user does not provide a context, we should dispose the default one after running the query
+ if isDefaultContext then (context :> IDisposable).Dispose()
+ OperationResultBase(responseJson, %%operationFieldsExpr, operationTypeName) @@>
+
+ let methodParameters =
+ overloadParameters
+ |> List.map (fun (name, t) ->
+ ProvidedParameter(name, t, ?optionalValue = if isOption t then Some null else None))
+
let methodDef = ProvidedMethod("Run", methodParameters, operationResultDef, invoker)
methodDef.AddXmlDoc("Executes the operation on the server and fetch its results.")
upcast methodDef)
- let asyncRunMethodOverloads : MemberInfo list =
+
+ let asyncRunMethodOverloads: MemberInfo list =
let operationName = Option.toObj operationDefinition.Name
- methodOverloadDefinitions |> List.map (fun overloadParameters ->
- let variableNames = overloadParameters |> List.map fst |> List.filter (fun name -> name <> "runtimeContext")
- let invoker (args : Expr list) =
+
+ methodOverloadDefinitions
+ |> List.map (fun overloadParameters ->
+ let variableNames =
+ overloadParameters |> List.map fst |> List.filter (fun name -> name <> "runtimeContext")
+
+ let invoker (args: Expr list) =
// First arg is the operation instance, second should be the context, if the overload asks for one.
// We determine it by seeing if the variable names have one less item than the arguments without the instance.
let argsWithoutInstance = args.Tail
+
let variableArgs, isDefaultContext, context =
- if argsWithoutInstance.Length - variableNames.Length = 1
- then argsWithoutInstance.Tail, false, argsWithoutInstance.Head
- else argsWithoutInstance, true, defaultContextExpr
+ if argsWithoutInstance.Length - variableNames.Length = 1 then
+ argsWithoutInstance.Tail, false, argsWithoutInstance.Head
+ else
+ argsWithoutInstance, true, defaultContextExpr
+
let variables = buildVariablesExprFromArgs variableNames variableArgs
+
let variables =
if explicitOptionalParameters then
<@@ (%%variables: (string * obj) [])
@@ -437,104 +573,187 @@ module internal ProvidedOperation =
| _ -> true) @@>
else
variables
- <@@ let context = %%context : GraphQLProviderRuntimeContext
+
+ <@@ let context: GraphQLProviderRuntimeContext = %%context
+
let request =
- { ServerUrl = context.ServerUrl
- HttpHeaders = context.HttpHeaders
- OperationName = Option.ofObj operationName
- Query = actualQuery
- Variables = %%variables }
+ {
+ ServerUrl = context.ServerUrl
+ HttpHeaders = context.HttpHeaders
+ OperationName = Option.ofObj operationName
+ Query = actualQuery
+ Variables = %%variables
+ }
+
async {
let! response =
- if shouldUseMultipartRequest
- then Tracer.asyncRunAndMeasureExecutionTime "Ran a multipart GraphQL query request asynchronously" (fun _ -> GraphQLClient.sendMultipartRequestAsync context.Connection request)
- else Tracer.asyncRunAndMeasureExecutionTime "Ran a GraphQL query request asynchronously" (fun _ -> GraphQLClient.sendRequestAsync context.Connection request)
- let responseJson = Tracer.runAndMeasureExecutionTime "Parsed a GraphQL response to a JsonValue" (fun _ -> JsonValue.Parse response)
+ if shouldUseMultipartRequest then
+ Tracer.asyncRunAndMeasureExecutionTime
+ "Ran a multipart GraphQL query request asynchronously"
+ (fun _ -> GraphQLClient.sendMultipartRequestAsync context.Connection request)
+ else
+ Tracer.asyncRunAndMeasureExecutionTime
+ "Ran a GraphQL query request asynchronously"
+ (fun _ -> GraphQLClient.sendRequestAsync context.Connection request)
+
+ let responseJson =
+ Tracer.runAndMeasureExecutionTime "Parsed a GraphQL response to a JsonValue" (fun _ ->
+ JsonValue.Parse response)
// If the user does not provide a context, we should dispose the default one after running the query
if isDefaultContext then (context :> IDisposable).Dispose()
return OperationResultBase(responseJson, %%operationFieldsExpr, operationTypeName)
} @@>
- let methodParameters = overloadParameters |> List.map (fun (name, t) -> ProvidedParameter(name, t, ?optionalValue = if isOption t then Some null else None))
- let methodDef = ProvidedMethod("AsyncRun", methodParameters, TypeMapping.makeAsync operationResultDef, invoker)
+
+ let methodParameters =
+ overloadParameters
+ |> List.map (fun (name, t) ->
+ ProvidedParameter(name, t, ?optionalValue = if isOption t then Some null else None))
+
+ let methodDef =
+ ProvidedMethod("AsyncRun", methodParameters, TypeMapping.makeAsync operationResultDef, invoker)
+
methodDef.AddXmlDoc("Executes the operation asynchronously on the server and fetch its results.")
upcast methodDef)
+
let parseResultDef =
- let invoker (args : Expr list) = <@@ OperationResultBase(JsonValue.Parse %%args.[1], %%operationFieldsExpr, operationTypeName) @@>
- let parameters = [ProvidedParameter("responseJson", typeof)]
+ let invoker (args: Expr list) =
+ <@@ OperationResultBase(JsonValue.Parse %%args.[1], %%operationFieldsExpr, operationTypeName) @@>
+
+ let parameters = [ ProvidedParameter("responseJson", typeof) ]
let methodDef = ProvidedMethod("ParseResult", parameters, operationResultDef, invoker)
- methodDef.AddXmlDoc("Parses a JSON response that matches the response pattern of the current operation into a OperationResult type.")
+
+ methodDef.AddXmlDoc(
+ "Parses a JSON response that matches the response pattern of the current operation into a OperationResult type."
+ )
+
methodDef
- let members : MemberInfo list = [operationResultDef; parseResultDef] @ runMethodOverloads @ asyncRunMethodOverloads
+
+ let members: MemberInfo list =
+ [ operationResultDef; parseResultDef ] @ runMethodOverloads @ asyncRunMethodOverloads
+
members)
+
tdef
type internal ProvidedOperationMetadata =
- { OperationType : Type
- UploadInputTypeName : string option
- TypeWrapper : ProvidedTypeDefinition }
+ {
+ OperationType: Type
+ UploadInputTypeName: string option
+ TypeWrapper: ProvidedTypeDefinition
+ }
module internal Provider =
- let getOperationMetadata (schemaTypes : Map, uploadInputTypeName : string option, enumProvidedTypes : Map, operationAstFields, operationTypeRef, explicitOptionalParameters: bool) =
+ let getOperationMetadata
+ (
+ schemaTypes: Map,
+ uploadInputTypeName: string option,
+ enumProvidedTypes: Map,
+ operationAstFields,
+ operationTypeRef,
+ explicitOptionalParameters: bool
+ ) =
let generateWrapper name =
let rec resolveWrapperName actual =
- if schemaTypes.ContainsKey(actual)
- then resolveWrapperName (actual + "Fields")
- else actual
+ if schemaTypes.ContainsKey(actual) then resolveWrapperName (actual + "Fields") else actual
+
ProvidedTypeDefinition(resolveWrapperName name, None, isSealed = true)
+
let wrappersByPath = Dictionary()
let rootWrapper = generateWrapper "Types"
wrappersByPath.Add([], rootWrapper)
- let rec getWrapper (path : string list) =
- if wrappersByPath.ContainsKey path
- then wrappersByPath.[path]
+
+ let rec getWrapper (path: string list) =
+ if wrappersByPath.ContainsKey path then
+ wrappersByPath.[path]
else
let wrapper = generateWrapper (path.Head.FirstCharUpper() + "Fields")
+
let upperWrapper =
let path = path.Tail
- if wrappersByPath.ContainsKey(path)
- then wrappersByPath.[path]
- else getWrapper path
+ if wrappersByPath.ContainsKey(path) then wrappersByPath.[path] else getWrapper path
+
upperWrapper.AddMember(wrapper)
wrappersByPath.Add(path, wrapper)
wrapper
- let includeType (path : string list) (t : ProvidedTypeDefinition) =
+
+ let includeType (path: string list) (t: ProvidedTypeDefinition) =
let wrapper = getWrapper path
wrapper.AddMember(t)
+
let providedTypes = Dictionary()
- let rec getProvidedType (providedTypes : Dictionary) (schemaTypes : Map) (path : Path) (astFields : AstFieldInfo list) (tref : IntrospectionTypeRef) : Type =
+
+ let rec getProvidedType
+ (providedTypes: Dictionary)
+ (schemaTypes: Map)
+ (path: Path)
+ (astFields: AstFieldInfo list)
+ (tref: IntrospectionTypeRef)
+ : Type =
match tref.Kind with
- | TypeKind.SCALAR when tref.Name.IsSome -> TypeMapping.mapScalarType uploadInputTypeName tref.Name.Value |> TypeMapping.makeOption
- | _ when uploadInputTypeName.IsSome && tref.Name.IsSome && uploadInputTypeName.Value = tref.Name.Value -> uploadTypeIsNotScalar uploadInputTypeName.Value
- | TypeKind.NON_NULL when tref.Name.IsNone && tref.OfType.IsSome -> getProvidedType providedTypes schemaTypes path astFields tref.OfType.Value |> TypeMapping.unwrapOption
- | TypeKind.LIST when tref.Name.IsNone && tref.OfType.IsSome -> getProvidedType providedTypes schemaTypes path astFields tref.OfType.Value |> TypeMapping.makeArray |> TypeMapping.makeOption
+ | TypeKind.SCALAR when tref.Name.IsSome ->
+ TypeMapping.mapScalarType uploadInputTypeName tref.Name.Value |> TypeMapping.makeOption
+ | _ when uploadInputTypeName.IsSome && tref.Name.IsSome && uploadInputTypeName.Value = tref.Name.Value ->
+ uploadTypeIsNotScalar uploadInputTypeName.Value
+ | TypeKind.NON_NULL when tref.Name.IsNone && tref.OfType.IsSome ->
+ getProvidedType providedTypes schemaTypes path astFields tref.OfType.Value
+ |> TypeMapping.unwrapOption
+ | TypeKind.LIST when tref.Name.IsNone && tref.OfType.IsSome ->
+ getProvidedType providedTypes schemaTypes path astFields tref.OfType.Value
+ |> TypeMapping.makeArray
+ |> TypeMapping.makeOption
| TypeKind.ENUM when tref.Name.IsSome ->
match enumProvidedTypes.TryFind(tref.Name.Value) with
| Some providedEnum -> TypeMapping.makeOption providedEnum
- | None -> failwithf "Could not find a enum type based on a type reference. The reference is an \"%s\" enum, but that enum was not found in the introspection schema." tref.Name.Value
- | (TypeKind.OBJECT | TypeKind.INTERFACE | TypeKind.UNION) when tref.Name.IsSome ->
- if providedTypes.ContainsKey(path, tref.Name.Value)
- then TypeMapping.makeOption providedTypes.[path, tref.Name.Value]
+ | None ->
+ failwithf
+ "Could not find a enum type based on a type reference. The reference is an \"%s\" enum, but that enum was not found in the introspection schema."
+ tref.Name.Value
+ | (TypeKind.OBJECT
+ | TypeKind.INTERFACE
+ | TypeKind.UNION) when tref.Name.IsSome ->
+ if providedTypes.ContainsKey(path, tref.Name.Value) then
+ TypeMapping.makeOption providedTypes.[path, tref.Name.Value]
else
let getIntrospectionFields typeName =
- if schemaTypes.ContainsKey(typeName)
- then schemaTypes.[typeName].Fields |> Option.defaultValue [||]
- else failwithf "Could not find a schema type based on a type reference. The reference is to a \"%s\" type, but that type was not found in the schema types." typeName
- let getPropertyMetadata typeName (info : AstFieldInfo) : RecordPropertyMetadata =
+ if schemaTypes.ContainsKey(typeName) then
+ schemaTypes.[typeName].Fields |> Option.defaultValue [||]
+ else
+ failwithf
+ "Could not find a schema type based on a type reference. The reference is to a \"%s\" type, but that type was not found in the schema types."
+ typeName
+
+ let getPropertyMetadata typeName (info: AstFieldInfo) : RecordPropertyMetadata =
let ifield =
- match getIntrospectionFields typeName |> Array.tryFind(fun f -> f.Name = info.Name) with
+ match getIntrospectionFields typeName |> Array.tryFind (fun f -> f.Name = info.Name) with
| Some ifield -> ifield
- | None -> failwithf "Could not find field \"%s\" of type \"%s\". The schema type does not have a field with the specified name." info.Name tref.Name.Value
+ | None ->
+ failwithf
+ "Could not find field \"%s\" of type \"%s\". The schema type does not have a field with the specified name."
+ info.Name
+ tref.Name.Value
+
let path = info.AliasOrName :: path
let astFields = info.Fields
let ftype = getProvidedType providedTypes schemaTypes path astFields ifield.Type
- { Name = info.Name; Alias = info.Alias; Description = ifield.Description; DeprecationReason = ifield.DeprecationReason; Type = ftype }
+
+ {
+ Name = info.Name
+ Alias = info.Alias
+ Description = ifield.Description
+ DeprecationReason = ifield.DeprecationReason
+ Type = ftype
+ }
+
let fragmentProperties =
astFields
- |> List.choose (function FragmentField f when f.TypeCondition <> tref.Name.Value -> Some f | _ -> None)
+ |> List.choose (function
+ | FragmentField f when f.TypeCondition <> tref.Name.Value -> Some f
+ | _ -> None)
|> List.groupBy (fun field -> field.TypeCondition)
|> List.map (fun (typeCondition, fields) ->
let conditionFields = fields |> List.distinctBy (fun x -> x.AliasOrName) |> List.map FragmentField
typeCondition, List.map (getPropertyMetadata typeCondition) conditionFields)
+
let baseProperties =
astFields
|> List.choose (fun x ->
@@ -544,118 +763,205 @@ module internal Provider =
| _ -> None)
|> List.distinctBy (fun x -> x.AliasOrName)
|> List.map (getPropertyMetadata tref.Name.Value)
+
let baseType =
- let metadata : ProvidedTypeMetadata = { Name = tref.Name.Value; Description = tref.Description }
- let tdef = ProvidedRecord.preBuildProvidedType(metadata, None)
+ let metadata: ProvidedTypeMetadata =
+ {
+ Name = tref.Name.Value
+ Description = tref.Description
+ }
+
+ let tdef = ProvidedRecord.preBuildProvidedType (metadata, None)
providedTypes.Add((path, tref.Name.Value), tdef)
includeType path tdef
- ProvidedRecord.makeProvidedType(tdef, baseProperties, explicitOptionalParameters)
+ ProvidedRecord.makeProvidedType (tdef, baseProperties, explicitOptionalParameters)
+
let createFragmentType (typeName, properties) =
let itype =
- if schemaTypes.ContainsKey(typeName)
- then schemaTypes.[typeName]
- else failwithf "Could not find schema type based on the query. Type \"%s\" does not exist on the schema definition." typeName
- let metadata : ProvidedTypeMetadata = { Name = itype.Name; Description = itype.Description }
- let tdef = ProvidedRecord.preBuildProvidedType(metadata, Some (upcast baseType))
+ if schemaTypes.ContainsKey(typeName) then
+ schemaTypes.[typeName]
+ else
+ failwithf
+ "Could not find schema type based on the query. Type \"%s\" does not exist on the schema definition."
+ typeName
+
+ let metadata: ProvidedTypeMetadata =
+ {
+ Name = itype.Name
+ Description = itype.Description
+ }
+
+ let tdef = ProvidedRecord.preBuildProvidedType (metadata, Some(upcast baseType))
providedTypes.Add((path, typeName), tdef)
includeType path tdef
- ProvidedRecord.makeProvidedType(tdef, properties, explicitOptionalParameters) |> ignore
+ ProvidedRecord.makeProvidedType (tdef, properties, explicitOptionalParameters) |> ignore
+
fragmentProperties |> List.iter createFragmentType
TypeMapping.makeOption baseType
- | _ -> failwith "Could not find a schema type based on a type reference. The reference has an invalid or unsupported combination of Name, Kind and OfType fields."
+ | _ ->
+ failwith
+ "Could not find a schema type based on a type reference. The reference has an invalid or unsupported combination of Name, Kind and OfType fields."
+
let operationType = getProvidedType providedTypes schemaTypes [] operationAstFields operationTypeRef
- { OperationType = operationType
- UploadInputTypeName = uploadInputTypeName
- TypeWrapper = rootWrapper }
- let getSchemaProvidedTypes(schema : IntrospectionSchema, uploadInputTypeName : string option, explicitOptionalParameters: bool) =
+ {
+ OperationType = operationType
+ UploadInputTypeName = uploadInputTypeName
+ TypeWrapper = rootWrapper
+ }
+
+ let getSchemaProvidedTypes
+ (
+ schema: IntrospectionSchema,
+ uploadInputTypeName: string option,
+ explicitOptionalParameters: bool
+ ) =
let providedTypes = ref Map.empty
let schemaTypes = TypeMapping.getSchemaTypes schema
- let getSchemaType (tref : IntrospectionTypeRef) =
+
+ let getSchemaType (tref: IntrospectionTypeRef) =
match tref.Name with
| Some name ->
match schemaTypes.TryFind(name) with
| Some itype -> itype
| None -> failwithf "Type \"%s\" was not found on the schema custom types." name
| None -> failwith "Expected schema type to have a name, but it does not have one."
- let typeModifier (modifier : Type -> Type) (metadata : RecordPropertyMetadata) = { metadata with Type = modifier metadata.Type }
+
+ let typeModifier (modifier: Type -> Type) (metadata: RecordPropertyMetadata) =
+ { metadata with
+ Type = modifier metadata.Type
+ }
+
let makeOption = typeModifier TypeMapping.makeOption
let makeArrayOption = typeModifier (TypeMapping.makeArray >> TypeMapping.makeOption)
let unwrapOption = typeModifier TypeMapping.unwrapOption
- let ofFieldType (field : IntrospectionField) = { field with Type = field.Type.OfType.Value }
- let ofInputFieldType (field : IntrospectionInputVal) = { field with Type = field.Type.OfType.Value }
- let rec resolveFieldMetadata (field : IntrospectionField) : RecordPropertyMetadata =
+
+ let ofFieldType (field: IntrospectionField) =
+ { field with
+ Type = field.Type.OfType.Value
+ }
+
+ let ofInputFieldType (field: IntrospectionInputVal) =
+ { field with
+ Type = field.Type.OfType.Value
+ }
+
+ let rec resolveFieldMetadata (field: IntrospectionField) : RecordPropertyMetadata =
match field.Type.Kind with
| TypeKind.SCALAR when field.Type.Name.IsSome ->
let providedType = TypeMapping.mapScalarType uploadInputTypeName field.Type.Name.Value
- { Name = field.Name
- Alias = None
- Description = field.Description
- DeprecationReason = field.DeprecationReason
- Type = providedType }
+
+ {
+ Name = field.Name
+ Alias = None
+ Description = field.Description
+ DeprecationReason = field.DeprecationReason
+ Type = providedType
+ }
|> makeOption
- | _ when uploadInputTypeName.IsSome && field.Type.Name.IsSome && uploadInputTypeName.Value = field.Type.Name.Value -> uploadTypeIsNotScalar uploadInputTypeName.Value
- | TypeKind.NON_NULL when field.Type.Name.IsNone && field.Type.OfType.IsSome -> ofFieldType field |> resolveFieldMetadata |> unwrapOption
- | TypeKind.LIST when field.Type.Name.IsNone && field.Type.OfType.IsSome -> ofFieldType field |> resolveFieldMetadata |> makeArrayOption
- | (TypeKind.OBJECT | TypeKind.INTERFACE | TypeKind.INPUT_OBJECT | TypeKind.UNION | TypeKind.ENUM) when field.Type.Name.IsSome ->
+ | _ when
+ uploadInputTypeName.IsSome
+ && field.Type.Name.IsSome
+ && uploadInputTypeName.Value = field.Type.Name.Value
+ ->
+ uploadTypeIsNotScalar uploadInputTypeName.Value
+ | TypeKind.NON_NULL when field.Type.Name.IsNone && field.Type.OfType.IsSome ->
+ ofFieldType field |> resolveFieldMetadata |> unwrapOption
+ | TypeKind.LIST when field.Type.Name.IsNone && field.Type.OfType.IsSome ->
+ ofFieldType field |> resolveFieldMetadata |> makeArrayOption
+ | (TypeKind.OBJECT
+ | TypeKind.INTERFACE
+ | TypeKind.INPUT_OBJECT
+ | TypeKind.UNION
+ | TypeKind.ENUM) when field.Type.Name.IsSome ->
let itype = getSchemaType field.Type
let providedType = resolveProvidedType itype
- { Name = field.Name
- Alias = None
- Description = field.Description
- DeprecationReason = field.DeprecationReason
- Type = providedType }
+
+ {
+ Name = field.Name
+ Alias = None
+ Description = field.Description
+ DeprecationReason = field.DeprecationReason
+ Type = providedType
+ }
|> makeOption
- | _ -> failwith "Could not find a schema type based on a type reference. The reference has an invalid or unsupported combination of Name, Kind and OfType fields."
- and resolveInputFieldMetadata (field : IntrospectionInputVal) : RecordPropertyMetadata =
+ | _ ->
+ failwith
+ "Could not find a schema type based on a type reference. The reference has an invalid or unsupported combination of Name, Kind and OfType fields."
+
+ and resolveInputFieldMetadata (field: IntrospectionInputVal) : RecordPropertyMetadata =
match field.Type.Kind with
| TypeKind.SCALAR when field.Type.Name.IsSome ->
let providedType = TypeMapping.mapScalarType uploadInputTypeName field.Type.Name.Value
- { Name = field.Name
- Alias = None
- Description = field.Description
- DeprecationReason = None
- Type = providedType }
+
+ {
+ Name = field.Name
+ Alias = None
+ Description = field.Description
+ DeprecationReason = None
+ Type = providedType
+ }
|> makeOption
- | _ when uploadInputTypeName.IsSome && field.Type.Name.IsSome && uploadInputTypeName.Value = field.Type.Name.Value -> uploadTypeIsNotScalar uploadInputTypeName.Value
- | TypeKind.NON_NULL when field.Type.Name.IsNone && field.Type.OfType.IsSome -> ofInputFieldType field |> resolveInputFieldMetadata |> unwrapOption
- | TypeKind.LIST when field.Type.Name.IsNone && field.Type.OfType.IsSome -> ofInputFieldType field |> resolveInputFieldMetadata |> makeArrayOption
- | (TypeKind.OBJECT | TypeKind.INTERFACE | TypeKind.INPUT_OBJECT | TypeKind.UNION | TypeKind.ENUM) when field.Type.Name.IsSome ->
+ | _ when
+ uploadInputTypeName.IsSome
+ && field.Type.Name.IsSome
+ && uploadInputTypeName.Value = field.Type.Name.Value
+ ->
+ uploadTypeIsNotScalar uploadInputTypeName.Value
+ | TypeKind.NON_NULL when field.Type.Name.IsNone && field.Type.OfType.IsSome ->
+ ofInputFieldType field |> resolveInputFieldMetadata |> unwrapOption
+ | TypeKind.LIST when field.Type.Name.IsNone && field.Type.OfType.IsSome ->
+ ofInputFieldType field |> resolveInputFieldMetadata |> makeArrayOption
+ | (TypeKind.OBJECT
+ | TypeKind.INTERFACE
+ | TypeKind.INPUT_OBJECT
+ | TypeKind.UNION
+ | TypeKind.ENUM) when field.Type.Name.IsSome ->
let itype = getSchemaType field.Type
let providedType = resolveProvidedType itype
- { Name = field.Name
- Alias = None
- Description = field.Description
- DeprecationReason = None
- Type = providedType }
+
+ {
+ Name = field.Name
+ Alias = None
+ Description = field.Description
+ DeprecationReason = None
+ Type = providedType
+ }
|> makeOption
- | _ -> failwith "Could not find a schema type based on a type reference. The reference has an invalid or unsupported combination of Name, Kind and OfType fields."
- and resolveProvidedType (itype : IntrospectionType) : ProvidedTypeDefinition =
- if (!providedTypes).ContainsKey(itype.Name)
- then (!providedTypes).[itype.Name]
+ | _ ->
+ failwith
+ "Could not find a schema type based on a type reference. The reference has an invalid or unsupported combination of Name, Kind and OfType fields."
+
+ and resolveProvidedType (itype: IntrospectionType) : ProvidedTypeDefinition =
+ if (!providedTypes).ContainsKey(itype.Name) then
+ (!providedTypes).[itype.Name]
else
- let metadata = { Name = itype.Name; Description = itype.Description }
+ let metadata =
+ {
+ Name = itype.Name
+ Description = itype.Description
+ }
+
match itype.Kind with
| TypeKind.OBJECT ->
- let tdef = ProvidedRecord.preBuildProvidedType(metadata, None)
+ let tdef = ProvidedRecord.preBuildProvidedType (metadata, None)
providedTypes := (!providedTypes).Add(itype.Name, tdef)
+
let properties =
- itype.Fields
- |> Option.defaultValue [||]
- |> Array.map resolveFieldMetadata
- |> List.ofArray
- upcast ProvidedRecord.makeProvidedType(tdef, properties, explicitOptionalParameters)
+ itype.Fields |> Option.defaultValue [||] |> Array.map resolveFieldMetadata |> List.ofArray
+
+ upcast ProvidedRecord.makeProvidedType (tdef, properties, explicitOptionalParameters)
| TypeKind.INPUT_OBJECT ->
- let tdef = ProvidedRecord.preBuildProvidedType(metadata, None)
+ let tdef = ProvidedRecord.preBuildProvidedType (metadata, None)
providedTypes := (!providedTypes).Add(itype.Name, tdef)
+
let properties =
- itype.InputFields
- |> Option.defaultValue [||]
- |> Array.map resolveInputFieldMetadata
- |> List.ofArray
- upcast ProvidedRecord.makeProvidedType(tdef, properties, explicitOptionalParameters)
- | TypeKind.INTERFACE | TypeKind.UNION ->
- let bdef = ProvidedInterface.makeProvidedType(metadata)
+ itype.InputFields |> Option.defaultValue [||] |> Array.map resolveInputFieldMetadata |> List.ofArray
+
+ upcast ProvidedRecord.makeProvidedType (tdef, properties, explicitOptionalParameters)
+ | TypeKind.INTERFACE
+ | TypeKind.UNION ->
+ let bdef = ProvidedInterface.makeProvidedType (metadata)
providedTypes := (!providedTypes).Add(itype.Name, bdef)
bdef
| TypeKind.ENUM ->
@@ -663,278 +969,472 @@ module internal Provider =
match itype.EnumValues with
| Some values -> values |> Array.map (fun value -> value.Name)
| None -> [||]
- let tdef = ProvidedEnum.makeProvidedType(itype.Name, items)
+
+ let tdef = ProvidedEnum.makeProvidedType (itype.Name, items)
providedTypes := (!providedTypes).Add(itype.Name, tdef)
tdef
| _ -> failwithf "Type \"%s\" is not a Record, Union, Enum, Input Object, or Interface type." itype.Name
- let ignoredKinds = [TypeKind.SCALAR; TypeKind.LIST; TypeKind.NON_NULL]
- schemaTypes |> Map.iter (fun _ itype -> if not (List.contains itype.Kind ignoredKinds) then resolveProvidedType itype |> ignore)
- let possibleTypes (itype : IntrospectionType) =
+
+ let ignoredKinds = [ TypeKind.SCALAR; TypeKind.LIST; TypeKind.NON_NULL ]
+
+ schemaTypes
+ |> Map.iter (fun _ itype -> if not (List.contains itype.Kind ignoredKinds) then resolveProvidedType itype |> ignore)
+
+ let possibleTypes (itype: IntrospectionType) =
match itype.PossibleTypes with
| Some trefs -> trefs |> Array.map (getSchemaType >> resolveProvidedType)
| None -> [||]
+
let getProvidedType typeName =
match (!providedTypes).TryFind(typeName) with
| Some ptype -> ptype
| None -> failwithf "Expected to find a type \"%s\" on the schema type map, but it was not found." typeName
+
schemaTypes
|> Seq.iter (fun kvp ->
if kvp.Value.Kind = TypeKind.INTERFACE || kvp.Value.Kind = TypeKind.UNION then
let itype = getProvidedType kvp.Value.Name
let ptypes = possibleTypes kvp.Value
ptypes |> Array.iter (fun ptype -> ptype.AddInterfaceImplementation(itype)))
+
!providedTypes
- let makeProvidedType(asm : Assembly, ns : string, resolutionFolder : string) =
+ let makeProvidedType (asm: Assembly, ns: string, resolutionFolder: string) =
let generator = ProvidedTypeDefinition(asm, ns, "GraphQLProvider", None)
+
let staticParams =
- [ ProvidedStaticParameter("introspection", typeof)
- ProvidedStaticParameter("httpHeaders", typeof, parameterDefaultValue = "")
- ProvidedStaticParameter("resolutionFolder", typeof, parameterDefaultValue = resolutionFolder)
- ProvidedStaticParameter("uploadInputTypeName", typeof, parameterDefaultValue = "")
- ProvidedStaticParameter("clientQueryValidation", typeof, parameterDefaultValue = true)
- ProvidedStaticParameter("explicitOptionalParameters", typeof, parameterDefaultValue = false) ]
- generator.DefineStaticParameters(staticParams, fun tname args ->
- let clientQueryValidation : bool = downcast args.[4]
- let explicitOptionalParameters : bool = downcast args.[5]
- let introspectionLocation = IntrospectionLocation.Create(downcast args.[0], downcast args.[2])
- let httpHeadersLocation = StringLocation.Create(downcast args.[1], resolutionFolder)
- let uploadInputTypeName =
- let name : string = unbox args.[3]
- match name with
- | null | "" -> None
- | _ -> Some name
- let maker =
- lazy
- let tdef = ProvidedTypeDefinition(asm, ns, tname, None)
- tdef.AddXmlDoc("A type provider for GraphQL operations.")
- tdef.AddMembersDelayed (fun _ ->
- let httpHeaders = HttpHeaders.load httpHeadersLocation
- let schemaJson =
- match introspectionLocation with
- | Uri serverUrl ->
- use connection = new GraphQLClientConnection()
- GraphQLClient.sendIntrospectionRequest connection serverUrl httpHeaders
- | IntrospectionFile path ->
- System.IO.File.ReadAllText path
- let schema = Serialization.deserializeSchema schemaJson
-
- let schemaProvidedTypes = getSchemaProvidedTypes(schema, uploadInputTypeName, explicitOptionalParameters)
- let typeWrapper = ProvidedTypeDefinition("Types", None, isSealed = true)
- typeWrapper.AddMembers(schemaProvidedTypes |> Seq.map (fun kvp -> kvp.Value) |> List.ofSeq)
- let operationWrapper = ProvidedTypeDefinition("Operations", None, isSealed = true)
- let getContextMethodDef =
- let methodParameters =
- let serverUrl =
- match introspectionLocation with
- | Uri serverUrl -> ProvidedParameter("serverUrl", typeof, optionalValue = serverUrl)
- | _ -> ProvidedParameter("serverUrl", typeof)
- let httpHeaders = ProvidedParameter("httpHeaders", typeof>, optionalValue = null)
- let connectionFactory = ProvidedParameter("connectionFactory", typeof GraphQLClientConnection>, optionalValue = null)
- [serverUrl; httpHeaders; connectionFactory]
- let defaultHttpHeadersExpr =
- let names = httpHeaders |> Seq.map fst |> Array.ofSeq
- let values = httpHeaders |> Seq.map snd |> Array.ofSeq
- Expr.Coerce(<@@ Array.zip names values @@>, typeof>)
- let invoker (args : Expr list) =
- let serverUrl = args.[0]
- <@@ let httpHeaders =
- match %%args.[1] : seq with
- | null -> %%defaultHttpHeadersExpr
- | argHeaders -> argHeaders
+ [
+ ProvidedStaticParameter("introspection", typeof)
+ ProvidedStaticParameter("httpHeaders", typeof, parameterDefaultValue = "")
+ ProvidedStaticParameter("resolutionFolder", typeof, parameterDefaultValue = resolutionFolder)
+ ProvidedStaticParameter("uploadInputTypeName", typeof, parameterDefaultValue = "")
+ ProvidedStaticParameter("clientQueryValidation", typeof, parameterDefaultValue = true)
+ ProvidedStaticParameter("explicitOptionalParameters", typeof, parameterDefaultValue = false)
+ ]
+
+ generator.DefineStaticParameters(
+ staticParams,
+ fun tname args ->
+ let clientQueryValidation: bool = downcast args.[4]
+ let explicitOptionalParameters: bool = downcast args.[5]
+ let introspectionLocation = IntrospectionLocation.Create(downcast args.[0], downcast args.[2])
+ let httpHeadersLocation = StringLocation.Create(downcast args.[1], resolutionFolder)
+
+ let uploadInputTypeName =
+ let name: string = unbox args.[3]
+
+ match name with
+ | null
+ | "" -> None
+ | _ -> Some name
+
+ let maker =
+ lazy
+ let tdef = ProvidedTypeDefinition(asm, ns, tname, None)
+ tdef.AddXmlDoc("A type provider for GraphQL operations.")
+
+ tdef.AddMembersDelayed (fun _ ->
+ let httpHeaders = HttpHeaders.load httpHeadersLocation
+
+ let schemaJson =
+ match introspectionLocation with
+ | Uri serverUrl ->
+ use connection = new GraphQLClientConnection()
+ GraphQLClient.sendIntrospectionRequest connection serverUrl httpHeaders
+ | IntrospectionFile path -> System.IO.File.ReadAllText path
+
+ let schema = Serialization.deserializeSchema schemaJson
+
+ let schemaProvidedTypes =
+ getSchemaProvidedTypes (schema, uploadInputTypeName, explicitOptionalParameters)
+
+ let typeWrapper = ProvidedTypeDefinition("Types", None, isSealed = true)
+ typeWrapper.AddMembers(schemaProvidedTypes |> Seq.map (fun kvp -> kvp.Value) |> List.ofSeq)
+ let operationWrapper = ProvidedTypeDefinition("Operations", None, isSealed = true)
+
+ let getContextMethodDef =
+ let methodParameters =
+ let serverUrl =
+ match introspectionLocation with
+ | Uri serverUrl ->
+ ProvidedParameter("serverUrl", typeof, optionalValue = serverUrl)
+ | _ -> ProvidedParameter("serverUrl", typeof)
+
+ let httpHeaders =
+ ProvidedParameter("httpHeaders", typeof>, optionalValue = null)
+
let connectionFactory =
- match %%args.[2] : unit -> GraphQLClientConnection with
- | argHeaders when obj.Equals(argHeaders, null) -> fun () -> new GraphQLClientConnection()
- | argHeaders -> argHeaders
- { ServerUrl = %%serverUrl; HttpHeaders = httpHeaders; Connection = connectionFactory() } @@>
- ProvidedMethod("GetContext", methodParameters, typeof, invoker, isStatic = true)
- let operationMethodDef =
- let staticParams =
- [ ProvidedStaticParameter("query", typeof)
- ProvidedStaticParameter("resolutionFolder", typeof, parameterDefaultValue = resolutionFolder)
- ProvidedStaticParameter("operationName", typeof, parameterDefaultValue = "")
- ProvidedStaticParameter("typeName", typeof, parameterDefaultValue = "") ]
- let staticMethodDef = ProvidedMethod("Operation", [], typeof, isStatic = true)
- let instanceBuilder (methodName : string) (args : obj []) =
- let queryLocation = StringLocation.Create(downcast args.[0], downcast args.[1])
- let query =
- match queryLocation with
- | String query -> query
- | File path -> System.IO.File.ReadAllText(path)
- let queryAst = Parser.parse query
- #if IS_DESIGNTIME
- let throwExceptionIfValidationFailed (validationResult : ValidationResult) =
- let rec formatValidationExceptionMessage(errors : AstError list) =
- match errors with
- | [] -> "Query validation resulted in invalid query, but no validation messages were produced."
- | errors ->
- errors
- |> List.map (fun err ->
- match err.Path with
- | Some path -> sprintf "%s Path: %A" err.Message path
- | None -> err.Message)
- |> List.reduce (fun x y -> x + Environment.NewLine + y)
- match validationResult with
- | ValidationError msgs -> failwith (formatValidationExceptionMessage msgs)
- | Success -> ()
- let key = { DocumentId = queryAst.GetHashCode(); SchemaId = schema.GetHashCode() }
- let refMaker = lazy Validation.Ast.validateDocument schema queryAst
- if clientQueryValidation then
- refMaker.Force
- |> QueryValidationDesignTimeCache.getOrAdd key
- |> throwExceptionIfValidationFailed
- #endif
- let operationName : OperationName option =
- match args.[2] :?> string with
- | null | "" ->
- let operationDefinitions = queryAst.Definitions |> List.filter (function OperationDefinition _ -> true | _ -> false)
- match operationDefinitions with
- | opdef :: _ -> opdef.Name
- | _ -> failwith "Error parsing query. Can not choose a default operation: query document has no operation definitions."
- | x -> Some x
- let explicitOperationTypeName : TypeName option =
- match args.[3] :?> string with
- | null | "" -> None
- | x -> Some x
- let operationDefinition =
- queryAst.Definitions
- |> List.choose (function OperationDefinition odef -> Some odef | _ -> None)
- |> List.find (fun d -> d.Name = operationName)
- let operationAstFields =
- let infoMap = queryAst.GetInfoMap()
- match infoMap.TryFind(operationName) with
- | Some fields -> fields
- | None -> failwith "Error parsing query. Could not find field information for requested operation."
- let operationTypeRef =
- let tref =
- match operationDefinition.OperationType with
- | Query -> schema.QueryType
- | Mutation ->
- match schema.MutationType with
- | Some tref -> tref
- | None -> failwith "The operation is a mutation operation, but the schema does not have a mutation type."
- | Subscription ->
- match schema.SubscriptionType with
- | Some tref -> tref
- | None -> failwithf "The operation is a subscription operation, but the schema does not have a subscription type."
- let tinst =
- match tref.Name with
- | Some name -> schema.Types |> Array.tryFind (fun t -> t.Name = name)
- | None -> None
- match tinst with
- | Some t -> { tref with Kind = t.Kind }
- | None -> failwith "The operation was found in the schema, but it does not have a name."
- let schemaTypes = TypeMapping.getSchemaTypes schema
- let enumProvidedTypes = schemaProvidedTypes |> Map.filter (fun _ t -> t.BaseType = typeof)
- let actualQuery = queryAst.ToQueryString(QueryStringPrintingOptions.IncludeTypeNames).Replace("\r\n", "\n")
- let className =
- match explicitOperationTypeName, operationDefinition.Name with
- | Some name, _ -> name.FirstCharUpper()
- | None, Some name -> name.FirstCharUpper()
- | None, None -> "Operation" + actualQuery.MD5Hash()
- let metadata = getOperationMetadata(schemaTypes, uploadInputTypeName, enumProvidedTypes, operationAstFields, operationTypeRef, explicitOptionalParameters)
- let operationTypeName : TypeName =
- match operationTypeRef.Name with
- | Some name -> name
- | None -> failwith "Error parsing query. Operation type does not have a name."
- let rec getKind (tref : IntrospectionTypeRef) =
- match tref.Kind with
- | TypeKind.NON_NULL | TypeKind.LIST when tref.OfType.IsSome -> getKind tref.OfType.Value
- | _ -> tref.Kind
- let rec getTypeName (tref : IntrospectionTypeRef) =
- match tref.Kind with
- | TypeKind.NON_NULL | TypeKind.LIST when tref.OfType.IsSome -> getTypeName tref.OfType.Value
- | _ ->
- match tref.Name with
- | Some tname -> tname
- | None -> failwithf "Expected type kind \"%s\" to have a name, but it does not have a name." (tref.Kind.ToString())
- let rec getIntrospectionType (tref : IntrospectionTypeRef) =
- match tref.Kind with
- | TypeKind.NON_NULL | TypeKind.LIST when tref.OfType.IsSome -> getIntrospectionType tref.OfType.Value
- | _ ->
- let typeName = getTypeName tref
- match schemaTypes.TryFind(typeName) with
- | Some t -> t
- | None -> failwithf "Type \"%s\" was not found in the introspection schema." typeName
- let getOperationFields (operationAstFields : AstFieldInfo list) (operationType : IntrospectionType) =
- let rec helper (acc : SchemaFieldInfo list) (astFields : AstFieldInfo list) (introspectionType : IntrospectionType) =
- match introspectionType.Kind with
- | TypeKind.OBJECT | TypeKind.INTERFACE | TypeKind.UNION ->
- match astFields with
- | [] -> acc
- | field :: tail ->
- let throw typeName = failwithf "Field \"%s\" of type \"%s\" was not found in the introspection schema." field.Name typeName
- let tref =
- match field with
- | FragmentField fragf ->
- let fragmentType =
- let tref =
- Option.defaultValue [||] introspectionType.PossibleTypes
- |> Array.map getIntrospectionType
- |> Array.append [|introspectionType|]
- |> Array.tryFind (fun pt -> pt.Name = fragf.TypeCondition)
- match tref with
- | Some t -> t
- | None -> failwithf "Fragment field defines a type condition \"%s\", but that type was not found in the schema definition." fragf.TypeCondition
- let field =
- fragmentType.Fields
- |> Option.map (Array.tryFind (fun f -> f.Name = fragf.Name))
- |> Option.flatten
- match field with
- | Some f -> f.Type
- | None -> throw fragmentType.Name
- | TypeField typef ->
- let field =
- introspectionType.Fields
- |> Option.map (Array.tryFind (fun f -> f.Name = typef.Name))
- |> Option.flatten
+ ProvidedParameter(
+ "connectionFactory",
+ typeof GraphQLClientConnection>,
+ optionalValue = null
+ )
+
+ [ serverUrl; httpHeaders; connectionFactory ]
+
+ let defaultHttpHeadersExpr =
+ let names = httpHeaders |> Seq.map fst |> Array.ofSeq
+ let values = httpHeaders |> Seq.map snd |> Array.ofSeq
+ Expr.Coerce(<@@ Array.zip names values @@>, typeof>)
+
+ let invoker (args: Expr list) =
+ let serverUrl = args.[0]
+
+ <@@ let httpHeaders =
+ match %%args.[1]: seq with
+ | null -> %%defaultHttpHeadersExpr
+ | argHeaders -> argHeaders
+
+ let connectionFactory =
+ match %%args.[2]: unit -> GraphQLClientConnection with
+ | argHeaders when obj.Equals(argHeaders, null) ->
+ fun () -> new GraphQLClientConnection()
+ | argHeaders -> argHeaders
+
+ {
+ ServerUrl = %%serverUrl
+ HttpHeaders = httpHeaders
+ Connection = connectionFactory ()
+ } @@>
+
+ ProvidedMethod(
+ "GetContext",
+ methodParameters,
+ typeof,
+ invoker,
+ isStatic = true
+ )
+
+ let operationMethodDef =
+ let staticParams =
+ [
+ ProvidedStaticParameter("query", typeof)
+ ProvidedStaticParameter(
+ "resolutionFolder",
+ typeof,
+ parameterDefaultValue = resolutionFolder
+ )
+ ProvidedStaticParameter("operationName", typeof, parameterDefaultValue = "")
+ ProvidedStaticParameter("typeName", typeof, parameterDefaultValue = "")
+ ]
+
+ let staticMethodDef = ProvidedMethod("Operation", [], typeof, isStatic = true)
+
+ let instanceBuilder (methodName: string) (args: obj []) =
+ let queryLocation = StringLocation.Create(downcast args.[0], downcast args.[1])
+
+ let query =
+ match queryLocation with
+ | String query -> query
+ | File path -> System.IO.File.ReadAllText(path)
+
+ let queryAst = Parser.parse query
+#if IS_DESIGNTIME
+ let throwExceptionIfValidationFailed (validationResult: ValidationResult) =
+ let rec formatValidationExceptionMessage (errors: AstError list) =
+ match errors with
+ | [] ->
+ "Query validation resulted in invalid query, but no validation messages were produced."
+ | errors ->
+ errors
+ |> List.map (fun err ->
+ match err.Path with
+ | Some path -> sprintf "%s Path: %A" err.Message path
+ | None -> err.Message)
+ |> List.reduce (fun x y -> x + Environment.NewLine + y)
+
+ match validationResult with
+ | ValidationError msgs -> failwith (formatValidationExceptionMessage msgs)
+ | Success -> ()
+
+ let key =
+ {
+ DocumentId = queryAst.GetHashCode()
+ SchemaId = schema.GetHashCode()
+ }
+
+ let refMaker = lazy Validation.Ast.validateDocument schema queryAst
+
+ if clientQueryValidation then
+ refMaker.Force
+ |> QueryValidationDesignTimeCache.getOrAdd key
+ |> throwExceptionIfValidationFailed
+#endif
+ let operationName: OperationName option =
+ match args.[2] :?> string with
+ | null
+ | "" ->
+ let operationDefinitions =
+ queryAst.Definitions
+ |> List.filter (function
+ | OperationDefinition _ -> true
+ | _ -> false)
+
+ match operationDefinitions with
+ | opdef :: _ -> opdef.Name
+ | _ ->
+ failwith
+ "Error parsing query. Can not choose a default operation: query document has no operation definitions."
+ | x -> Some x
+
+ let explicitOperationTypeName: TypeName option =
+ match args.[3] :?> string with
+ | null
+ | "" -> None
+ | x -> Some x
+
+ let operationDefinition =
+ queryAst.Definitions
+ |> List.choose (function
+ | OperationDefinition odef -> Some odef
+ | _ -> None)
+ |> List.find (fun d -> d.Name = operationName)
+
+ let operationAstFields =
+ let infoMap = queryAst.GetInfoMap()
+
+ match infoMap.TryFind(operationName) with
+ | Some fields -> fields
+ | None ->
+ failwith
+ "Error parsing query. Could not find field information for requested operation."
+
+ let operationTypeRef =
+ let tref =
+ match operationDefinition.OperationType with
+ | Query -> schema.QueryType
+ | Mutation ->
+ match schema.MutationType with
+ | Some tref -> tref
+ | None ->
+ failwith
+ "The operation is a mutation operation, but the schema does not have a mutation type."
+ | Subscription ->
+ match schema.SubscriptionType with
+ | Some tref -> tref
+ | None ->
+ failwithf
+ "The operation is a subscription operation, but the schema does not have a subscription type."
+
+ let tinst =
+ match tref.Name with
+ | Some name -> schema.Types |> Array.tryFind (fun t -> t.Name = name)
+ | None -> None
+
+ match tinst with
+ | Some t -> { tref with Kind = t.Kind }
+ | None -> failwith "The operation was found in the schema, but it does not have a name."
+
+ let schemaTypes = TypeMapping.getSchemaTypes schema
+
+ let enumProvidedTypes =
+ schemaProvidedTypes |> Map.filter (fun _ t -> t.BaseType = typeof)
+
+ let actualQuery =
+ queryAst
+ .ToQueryString(QueryStringPrintingOptions.IncludeTypeNames)
+ .Replace("\r\n", "\n")
+
+ let className =
+ match explicitOperationTypeName, operationDefinition.Name with
+ | Some name, _ -> name.FirstCharUpper()
+ | None, Some name -> name.FirstCharUpper()
+ | None, None -> "Operation" + actualQuery.MD5Hash()
+
+ let metadata =
+ getOperationMetadata (
+ schemaTypes,
+ uploadInputTypeName,
+ enumProvidedTypes,
+ operationAstFields,
+ operationTypeRef,
+ explicitOptionalParameters
+ )
+
+ let operationTypeName: TypeName =
+ match operationTypeRef.Name with
+ | Some name -> name
+ | None -> failwith "Error parsing query. Operation type does not have a name."
+
+ let rec getKind (tref: IntrospectionTypeRef) =
+ match tref.Kind with
+ | TypeKind.NON_NULL
+ | TypeKind.LIST when tref.OfType.IsSome -> getKind tref.OfType.Value
+ | _ -> tref.Kind
+
+ let rec getTypeName (tref: IntrospectionTypeRef) =
+ match tref.Kind with
+ | TypeKind.NON_NULL
+ | TypeKind.LIST when tref.OfType.IsSome -> getTypeName tref.OfType.Value
+ | _ ->
+ match tref.Name with
+ | Some tname -> tname
+ | None ->
+ failwithf
+ "Expected type kind \"%s\" to have a name, but it does not have a name."
+ (tref.Kind.ToString())
+
+ let rec getIntrospectionType (tref: IntrospectionTypeRef) =
+ match tref.Kind with
+ | TypeKind.NON_NULL
+ | TypeKind.LIST when tref.OfType.IsSome -> getIntrospectionType tref.OfType.Value
+ | _ ->
+ let typeName = getTypeName tref
+
+ match schemaTypes.TryFind(typeName) with
+ | Some t -> t
+ | None -> failwithf "Type \"%s\" was not found in the introspection schema." typeName
+
+ let getOperationFields
+ (operationAstFields: AstFieldInfo list)
+ (operationType: IntrospectionType)
+ =
+ let rec helper
+ (acc: SchemaFieldInfo list)
+ (astFields: AstFieldInfo list)
+ (introspectionType: IntrospectionType)
+ =
+ match introspectionType.Kind with
+ | TypeKind.OBJECT
+ | TypeKind.INTERFACE
+ | TypeKind.UNION ->
+ match astFields with
+ | [] -> acc
+ | field :: tail ->
+ let throw typeName =
+ failwithf
+ "Field \"%s\" of type \"%s\" was not found in the introspection schema."
+ field.Name
+ typeName
+
+ let tref =
match field with
- | Some f -> f.Type
- | None -> throw introspectionType.Name
- let fields =
- match getKind tref with
- | TypeKind.OBJECT | TypeKind.INTERFACE | TypeKind.UNION ->
- let schemaType = getIntrospectionType tref
- helper [] field.Fields schemaType
- | _ -> []
- let info = { AliasOrName = field.AliasOrName.FirstCharUpper(); SchemaTypeRef = tref; Fields = Array.ofList fields }
- helper (info :: acc) tail introspectionType
- | _ -> []
- helper [] operationAstFields operationType |> Array.ofList
-
- // Every time we run the query, we will need the schema types information as an expression.
- // To avoid creating the type map expression every time we call Run method, we cache it here.
- let operationFieldsExpr = getOperationFields operationAstFields (getIntrospectionType operationTypeRef) |> QuotationHelpers.arrayExpr |> snd
- let contextInfo : GraphQLRuntimeContextInfo option =
- match introspectionLocation with
- | Uri serverUrl -> Some { ServerUrl = serverUrl; HttpHeaders = httpHeaders }
- | _ -> None
- let operationDef = ProvidedOperation.makeProvidedType(actualQuery, operationDefinition, operationTypeName, operationFieldsExpr, schemaTypes, schemaProvidedTypes, metadata.OperationType, contextInfo, metadata.UploadInputTypeName, className, explicitOptionalParameters)
- operationDef.AddMember(metadata.TypeWrapper)
- let invoker (_ : Expr list) = <@@ OperationBase(query) @@>
- let methodDef = ProvidedMethod(methodName, [], operationDef, invoker, isStatic = true)
- methodDef.AddXmlDoc("Creates an operation to be executed on the server and provide its return types.")
- operationWrapper.AddMember(operationDef)
- operationDef.AddMember(methodDef)
- methodDef
- staticMethodDef.DefineStaticParameters(staticParams, instanceBuilder)
- staticMethodDef
- let schemaPropertyDef =
- let getter = QuotationHelpers.quoteRecord schema (fun (_ : Expr list) schema -> schema)
- ProvidedProperty("Schema", typeof, getter, isStatic = true)
- let members : MemberInfo list = [typeWrapper; operationWrapper; getContextMethodDef; operationMethodDef; schemaPropertyDef]
- members)
- tdef
- #if IS_DESIGNTIME
- let providerKey =
- { IntrospectionLocation = introspectionLocation
- CustomHttpHeadersLocation = httpHeadersLocation
- UploadInputTypeName = uploadInputTypeName
- ResolutionFolder = resolutionFolder
- ClientQueryValidation = clientQueryValidation
- ExplicitOptionalParameters = explicitOptionalParameters }
- ProviderDesignTimeCache.getOrAdd providerKey maker.Force)
- #else
- maker.Force())
- #endif
+ | FragmentField fragf ->
+ let fragmentType =
+ let tref =
+ Option.defaultValue [||] introspectionType.PossibleTypes
+ |> Array.map getIntrospectionType
+ |> Array.append [| introspectionType |]
+ |> Array.tryFind (fun pt -> pt.Name = fragf.TypeCondition)
+
+ match tref with
+ | Some t -> t
+ | None ->
+ failwithf
+ "Fragment field defines a type condition \"%s\", but that type was not found in the schema definition."
+ fragf.TypeCondition
+
+ let field =
+ fragmentType.Fields
+ |> Option.map (Array.tryFind (fun f -> f.Name = fragf.Name))
+ |> Option.flatten
+
+ match field with
+ | Some f -> f.Type
+ | None -> throw fragmentType.Name
+ | TypeField typef ->
+ let field =
+ introspectionType.Fields
+ |> Option.map (Array.tryFind (fun f -> f.Name = typef.Name))
+ |> Option.flatten
+
+ match field with
+ | Some f -> f.Type
+ | None -> throw introspectionType.Name
+
+ let fields =
+ match getKind tref with
+ | TypeKind.OBJECT
+ | TypeKind.INTERFACE
+ | TypeKind.UNION ->
+ let schemaType = getIntrospectionType tref
+ helper [] field.Fields schemaType
+ | _ -> []
+
+ let info =
+ {
+ AliasOrName = field.AliasOrName.FirstCharUpper()
+ SchemaTypeRef = tref
+ Fields = Array.ofList fields
+ }
+
+ helper (info :: acc) tail introspectionType
+ | _ -> []
+
+ helper [] operationAstFields operationType |> Array.ofList
+
+ // Every time we run the query, we will need the schema types information as an expression.
+ // To avoid creating the type map expression every time we call Run method, we cache it here.
+ let operationFieldsExpr =
+ getOperationFields operationAstFields (getIntrospectionType operationTypeRef)
+ |> QuotationHelpers.arrayExpr
+ |> snd
+
+ let contextInfo: GraphQLRuntimeContextInfo option =
+ match introspectionLocation with
+ | Uri serverUrl ->
+ Some
+ {
+ ServerUrl = serverUrl
+ HttpHeaders = httpHeaders
+ }
+ | _ -> None
+
+ let operationDef =
+ ProvidedOperation.makeProvidedType (
+ actualQuery,
+ operationDefinition,
+ operationTypeName,
+ operationFieldsExpr,
+ schemaTypes,
+ schemaProvidedTypes,
+ metadata.OperationType,
+ contextInfo,
+ metadata.UploadInputTypeName,
+ className,
+ explicitOptionalParameters
+ )
+
+ operationDef.AddMember(metadata.TypeWrapper)
+ let invoker (_: Expr list) = <@@ OperationBase(query) @@>
+ let methodDef = ProvidedMethod(methodName, [], operationDef, invoker, isStatic = true)
+
+ methodDef.AddXmlDoc(
+ "Creates an operation to be executed on the server and provide its return types."
+ )
+
+ operationWrapper.AddMember(operationDef)
+ operationDef.AddMember(methodDef)
+ methodDef
+
+ staticMethodDef.DefineStaticParameters(staticParams, instanceBuilder)
+ staticMethodDef
+
+ let schemaPropertyDef =
+ let getter = QuotationHelpers.quoteRecord schema (fun (_: Expr list) schema -> schema)
+ ProvidedProperty("Schema", typeof, getter, isStatic = true)
+
+ let members: MemberInfo list =
+ [ typeWrapper; operationWrapper; getContextMethodDef; operationMethodDef; schemaPropertyDef ]
+
+ members)
+
+ tdef
+#if IS_DESIGNTIME
+ let providerKey =
+ {
+ IntrospectionLocation = introspectionLocation
+ CustomHttpHeadersLocation = httpHeadersLocation
+ UploadInputTypeName = uploadInputTypeName
+ ResolutionFolder = resolutionFolder
+ ClientQueryValidation = clientQueryValidation
+ ExplicitOptionalParameters = explicitOptionalParameters
+ }
+
+ ProviderDesignTimeCache.getOrAdd providerKey maker.Force
+ )
+#else
+ maker.Force()
+ )
+#endif
generator
diff --git a/src/FSharp.Data.GraphQL.Client.DesignTime/paket.references b/src/FSharp.Data.GraphQL.Client.DesignTime/paket.references
deleted file mode 100644
index 91d46b834..000000000
--- a/src/FSharp.Data.GraphQL.Client.DesignTime/paket.references
+++ /dev/null
@@ -1,6 +0,0 @@
-group Common
-FSharp.Core
-FParsec
-Microsoft.Extensions.Http
-File:ProvidedTypes.fsi
-File:ProvidedTypes.fs
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Client/AssemblyInfo.fs b/src/FSharp.Data.GraphQL.Client/AssemblyInfo.fs
deleted file mode 100644
index 146b60534..000000000
--- a/src/FSharp.Data.GraphQL.Client/AssemblyInfo.fs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Auto-Generated by FAKE; do not edit
-namespace System
-open System.Reflection
-
-[]
-[]
-[]
-[]
-[]
-do ()
-
-module internal AssemblyVersionInformation =
- let [] AssemblyTitle = "FSharp.Data.GraphQL.Client"
- let [] AssemblyProduct = "FSharp.Data.GraphQL"
- let [] AssemblyDescription = "FSharp implementation of Facebook GraphQL query language"
- let [] AssemblyVersion = "1.0.8"
- let [] AssemblyFileVersion = "1.0.8"
diff --git a/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj b/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj
index 042050af4..b83efed0a 100644
--- a/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj
+++ b/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj
@@ -1,5 +1,5 @@
-
-
+
+
Library
netstandard2.0
@@ -7,9 +7,16 @@
false
typeproviders
typeproviders
+
+ FSharp implementation of Facebook GraphQL query language (Client)
+
+
+
+
+
+
-
@@ -24,11 +31,9 @@
-
-
+
-
+
-
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj.paket.template b/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj.paket.template
deleted file mode 100644
index 0c7ae92d5..000000000
--- a/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj.paket.template
+++ /dev/null
@@ -1,24 +0,0 @@
-type project
-id FSharp.Data.GraphQL.Client
-authors Bazinga Technologies Inc
-projectUrl https://github.com/fsprojects/FSharp.Data.GraphQL
-licenseUrl https://github.com/fsprojects/FSharp.Data.GraphQL/blob/dev/LICENSE.txt
-requireLicenseAcceptance false
-copyright Copyright (c) 2016 Bazinga Technologies Inc
-tags
- FSharp GraphQL Relay React
-summary
- FSharp implementation of Facebook GraphQL query language (Client)
-description
- FSharp implementation of Facebook GraphQL query language (Client)
-files
- bin/Release/netstandard2.0/FSharp.Data.GraphQL.Client.dll ==> lib/netstandard2.0
- bin/Release/typeproviders/fsharp41/netstandard2.0/*.dll ==> typeproviders/fsharp41/netstandard2.0
-references
- FSharp.Data.GraphQL.Client.dll
-dependencies
- framework: netstandard2.0
- FSharp.Core >= LOCKEDVERSION-Common
- FParsec >= LOCKEDVERSION-Common
- Microsoft.Extensions.Http >= LOCKEDVERSION-Common
- FSharp.Data.GraphQL.Shared >= CURRENTVERSION
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Client/paket.references b/src/FSharp.Data.GraphQL.Client/paket.references
deleted file mode 100644
index 3d7ef45ed..000000000
--- a/src/FSharp.Data.GraphQL.Client/paket.references
+++ /dev/null
@@ -1,4 +0,0 @@
-group Common
-FSharp.Core
-FParsec
-Microsoft.Extensions.Http
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Server.Middleware/AssemblyInfo.fs b/src/FSharp.Data.GraphQL.Server.Middleware/AssemblyInfo.fs
deleted file mode 100644
index 3e900e847..000000000
--- a/src/FSharp.Data.GraphQL.Server.Middleware/AssemblyInfo.fs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Auto-Generated by FAKE; do not edit
-namespace System
-open System.Reflection
-
-[]
-[]
-[]
-[]
-[]
-do ()
-
-module internal AssemblyVersionInformation =
- let [] AssemblyTitle = "FSharp.Data.GraphQL.Server.Middleware"
- let [] AssemblyProduct = "FSharp.Data.GraphQL"
- let [] AssemblyDescription = "FSharp implementation of Facebook GraphQL query language"
- let [] AssemblyVersion = "1.0.8"
- let [] AssemblyFileVersion = "1.0.8"
diff --git a/src/FSharp.Data.GraphQL.Server.Middleware/FSharp.Data.GraphQL.Server.Middleware.fsproj b/src/FSharp.Data.GraphQL.Server.Middleware/FSharp.Data.GraphQL.Server.Middleware.fsproj
index 2f9483336..b09fd3f9d 100644
--- a/src/FSharp.Data.GraphQL.Server.Middleware/FSharp.Data.GraphQL.Server.Middleware.fsproj
+++ b/src/FSharp.Data.GraphQL.Server.Middleware/FSharp.Data.GraphQL.Server.Middleware.fsproj
@@ -1,22 +1,28 @@
-
+
+
netstandard2.0
false
true
+ true
+
+ Built-in, generic middlewares for FSharp.Data.GraphQL.Server Executor
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Server.Middleware/FSharp.Data.GraphQL.Server.Middleware.fsproj.paket.template b/src/FSharp.Data.GraphQL.Server.Middleware/FSharp.Data.GraphQL.Server.Middleware.fsproj.paket.template
deleted file mode 100644
index 3354026f8..000000000
--- a/src/FSharp.Data.GraphQL.Server.Middleware/FSharp.Data.GraphQL.Server.Middleware.fsproj.paket.template
+++ /dev/null
@@ -1,20 +0,0 @@
-type project
-id FSharp.Data.GraphQL.Server.Middleware
-authors Bazinga Technologies Inc
-projectUrl https://github.com/bazingatechnologies/FSharp.Data.GraphQL
-licenseUrl https://github.com/bazingatechnologies/FSharp.Data.GraphQL/blob/dev/LICENSE.txt
-requireLicenseAcceptance false
-copyright Copyright (c) 2016 Bazinga Technologies Inc
-tags
- FSharp GraphQL Relay React Middleware
-summary
- Built-in, generic middlewares for FSharp.Data.GraphQL.Server Executor
-description
- Built-in, generic middlewares for FSharp.Data.GraphQL.Server Executor
-dependencies
- framework: netstandard2.0
- FParsec >= LOCKEDVERSION-Common
- FSharp.Core >= LOCKEDVERSION-Common
- FSharp.Data.GraphQL.Shared >= CURRENTVERSION
-files
- bin/Release/netstandard2.0/FSharp.Data.GraphQL.Server.Middleware.dll ==> lib/netstandard2.0
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Server.Middleware/paket.references b/src/FSharp.Data.GraphQL.Server.Middleware/paket.references
deleted file mode 100644
index d5db0d1e4..000000000
--- a/src/FSharp.Data.GraphQL.Server.Middleware/paket.references
+++ /dev/null
@@ -1,2 +0,0 @@
-group Common
-FSharp.Core
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Server/AssemblyInfo.fs b/src/FSharp.Data.GraphQL.Server/AssemblyInfo.fs
deleted file mode 100644
index a8956370b..000000000
--- a/src/FSharp.Data.GraphQL.Server/AssemblyInfo.fs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Auto-Generated by FAKE; do not edit
-namespace System
-open System.Reflection
-open System.Runtime.CompilerServices
-
-[]
-[]
-[]
-[]
-[]
-[]
-[]
-do ()
-
-module internal AssemblyVersionInformation =
- let [] AssemblyTitle = "FSharp.Data.GraphQL.Server"
- let [] AssemblyProduct = "FSharp.Data.GraphQL"
- let [] AssemblyDescription = "FSharp implementation of Facebook GraphQL query language"
- let [] AssemblyVersion = "1.0.8"
- let [] AssemblyFileVersion = "1.0.8"
- let [] InternalsVisibleTo = "FSharp.Data.GraphQL.Benchmarks"
- let [] InternalsVisibleTo_1 = "FSharp.Data.GraphQL.Tests"
diff --git a/src/FSharp.Data.GraphQL.Server/FSharp.Data.GraphQL.Server.fsproj b/src/FSharp.Data.GraphQL.Server/FSharp.Data.GraphQL.Server.fsproj
index 69dca6632..12a05bc4d 100644
--- a/src/FSharp.Data.GraphQL.Server/FSharp.Data.GraphQL.Server.fsproj
+++ b/src/FSharp.Data.GraphQL.Server/FSharp.Data.GraphQL.Server.fsproj
@@ -1,11 +1,37 @@
-
+
+
netstandard2.0
- false
true
+ true
+
+ FSharp implementation of Facebook GraphQL query language (Server)
+
+
+
+
+
+
+
+
+
+
+ <_Parameter1>FSharp.Data.GraphQL.Benchmarks
+
+
+ <_Parameter1>FSharp.Data.GraphQL.Tests
+
+
+
+
+
+
+
+
-
@@ -17,11 +43,9 @@
-
-
+
-
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Server/FSharp.Data.GraphQL.Server.fsproj.paket.template b/src/FSharp.Data.GraphQL.Server/FSharp.Data.GraphQL.Server.fsproj.paket.template
deleted file mode 100644
index 6fa22434f..000000000
--- a/src/FSharp.Data.GraphQL.Server/FSharp.Data.GraphQL.Server.fsproj.paket.template
+++ /dev/null
@@ -1,23 +0,0 @@
-type project
-id FSharp.Data.GraphQL.Server
-authors Bazinga Technologies Inc
-projectUrl https://github.com/bazingatechnologies/FSharp.Data.GraphQL
-licenseUrl https://github.com/bazingatechnologies/FSharp.Data.GraphQL/blob/dev/LICENSE.txt
-requireLicenseAcceptance false
-copyright Copyright (c) 2016 Bazinga Technologies Inc
-tags
- FSharp GraphQL Relay React
-summary
- FSharp implementation of Facebook GraphQL query language (Server)
-description
- FSharp implementation of Facebook GraphQL query language (Server)
-references
- FSharp.Data.GraphQL.Server.dll
-dependencies
- framework: netstandard2.0
- FParsec >= LOCKEDVERSION-Common
- FSharp.Core >= LOCKEDVERSION-Common
- System.Reactive >= LOCKEDVERSION-Common
- FSharp.Data.GraphQL.Shared >= CURRENTVERSION
-files
- bin/Release/netstandard2.0/FSharp.Data.GraphQL.Server.dll ==> lib/netstandard2.0
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Server/Schema.fs b/src/FSharp.Data.GraphQL.Server/Schema.fs
index ebde61e27..18bdba0bf 100644
--- a/src/FSharp.Data.GraphQL.Server/Schema.fs
+++ b/src/FSharp.Data.GraphQL.Server/Schema.fs
@@ -5,6 +5,7 @@ namespace FSharp.Data.GraphQL
open System.Collections.Generic
open System.Reactive.Linq
+open FSharp.Data.GraphQL.Ast
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Types.Patterns
open FSharp.Data.GraphQL.Types.Introspection
diff --git a/src/FSharp.Data.GraphQL.Server/Values.fs b/src/FSharp.Data.GraphQL.Server/Values.fs
index 61243aad7..03e93d601 100644
--- a/src/FSharp.Data.GraphQL.Server/Values.fs
+++ b/src/FSharp.Data.GraphQL.Server/Values.fs
@@ -14,40 +14,41 @@ open Microsoft.FSharp.Reflection
/// Tries to convert type defined in AST into one of the type defs known in schema.
let inline tryConvertAst schema ast =
- let rec convert isNullable (schema: ISchema) (ast: InputType) : TypeDef option =
+ let rec convert isNullable (schema: ISchema) (ast: TypeReference) : TypeDef option =
match ast with
| NamedType name ->
match schema.TryFindType name with
- | Some namedDef ->
- Some (if isNullable then upcast namedDef.MakeNullable() else upcast namedDef)
+ | Some namedDef -> Some(if isNullable then upcast namedDef.MakeNullable() else upcast namedDef)
| None -> None
| ListType inner ->
convert true schema inner
- |> Option.map (fun i ->
- if isNullable
- then upcast i.MakeList().MakeNullable()
- else upcast i.MakeList())
- | NonNullType inner ->
- convert false schema inner
+ |> Option.map (fun i -> if isNullable then upcast i.MakeList().MakeNullable() else upcast i.MakeList())
+ | NonNullNameType inner -> convert false schema inner
+
convert true schema ast
let inline private notAssignableMsg (innerDef: InputDef) value : string =
sprintf "value of type %s is not assignable from %s" innerDef.Type.Name (value.GetType().Name)
-let rec internal compileByType (errMsg: string) (inputDef: InputDef): ExecuteInput =
+let rec internal compileByType (errMsg: string) (inputDef: InputDef) : ExecuteInput =
match inputDef with
- | Scalar scalardef ->
- variableOrElse (scalardef.CoerceInput >> Option.toObj)
+ | Scalar scalardef -> variableOrElse (scalardef.CoerceInput >> Option.toObj)
| InputObject objdef ->
let objtype = objdef.Type
let ctor = ReflectionHelper.matchConstructor objtype (objdef.Fields |> Array.map (fun x -> x.Name))
+
let mapper =
ctor.GetParameters()
- |> Array.map(fun param ->
- match objdef.Fields |> Array.tryFind(fun field -> field.Name = param.Name) with
+ |> Array.map (fun param ->
+ match objdef.Fields |> Array.tryFind (fun field -> field.Name = param.Name) with
| Some x -> x
| None ->
- failwithf "Input object '%s' refers to type '%O', but constructor parameter '%s' doesn't match any of the defined input fields" objdef.Name objtype param.Name)
+ failwithf
+ "Input object '%s' refers to type '%O', but constructor parameter '%s' doesn't match any of the defined input fields"
+ objdef.Name
+ objtype
+ param.Name)
+
fun value variables ->
match value with
| ObjectValue props ->
@@ -57,6 +58,7 @@ let rec internal compileByType (errMsg: string) (inputDef: InputDef): ExecuteInp
match Map.tryFind field.Name props with
| None -> null
| Some prop -> field.ExecuteInput prop variables)
+
let instance = ctor.Invoke(args)
instance
| Variable variableName ->
@@ -73,6 +75,7 @@ let rec internal compileByType (errMsg: string) (inputDef: InputDef): ExecuteInp
match value with
| ListValue list ->
let mappedValues = list |> List.map (fun value -> inner value variables)
+
if isArray then
ReflectionHelper.arrayOfList innerdef.Type mappedValues
else
@@ -81,21 +84,22 @@ let rec internal compileByType (errMsg: string) (inputDef: InputDef): ExecuteInp
| _ ->
// try to construct a list from single element
let single = inner value variables
- if single = null then null else
- if isArray then ReflectionHelper.arrayOfList innerdef.Type [single]
- else cons single nil
+
+ if single = null then null
+ else if isArray then ReflectionHelper.arrayOfList innerdef.Type [ single ]
+ else cons single nil
| Nullable (Input innerdef) ->
let inner = compileByType errMsg innerdef
let some, none, _ = ReflectionHelper.optionOfType innerdef.Type
fun variables value ->
let i = inner variables value
+
match i with
| null -> none
| coerced ->
let c = some coerced
- if c <> null then c
- else raise(GraphQLException (errMsg + notAssignableMsg innerdef coerced))
+ if c <> null then c else raise (GraphQLException(errMsg + notAssignableMsg innerdef coerced))
| Enum enumdef ->
fun value variables ->
match value with
@@ -105,6 +109,7 @@ let rec internal compileByType (errMsg: string) (inputDef: InputDef): ExecuteInp
| None -> failwithf "Variable '%s' not supplied.\nVariables: %A" variableName variables
| _ ->
let coerced = coerceEnumInput value
+
match coerced with
| None -> null
| Some s -> ReflectionHelper.parseUnion enumdef.Type s
@@ -115,25 +120,35 @@ let rec private coerceVariableValue isNullable typedef (vardef: VarDef) (input:
| Scalar scalardef ->
match scalardef.CoerceValue input with
| None when isNullable -> null
- | None ->
- raise (GraphQLException <| errMsg + (sprintf "expected value of type %s but got None" scalardef.Name))
+ | None -> raise (GraphQLException <| errMsg + (sprintf "expected value of type %s but got None" scalardef.Name))
| Some res -> res
| Nullable (Input innerdef) ->
let some, none, innerValue = ReflectionHelper.optionOfType innerdef.Type
let input = innerValue input
let coerced = coerceVariableValue true innerdef vardef input errMsg
- if coerced <> null
- then
+
+ if coerced <> null then
let s = some coerced
- if s <> null
- then s
- else raise (GraphQLException <| errMsg + (sprintf "value of type %O is not assignable from %O" innerdef.Type (coerced.GetType())))
- else none
+
+ if s <> null then
+ s
+ else
+ raise (
+ GraphQLException
+ <| errMsg + (sprintf "value of type %O is not assignable from %O" innerdef.Type (coerced.GetType()))
+ )
+ else
+ none
| List (Input innerdef) ->
let cons, nil = ReflectionHelper.listOfType innerdef.Type
+
match input with
| null when isNullable -> null
- | null -> raise(GraphQLException <| errMsg + (sprintf "expected value of type %s, but no value was found." (vardef.TypeDef.ToString())))
+ | null ->
+ raise (
+ GraphQLException
+ <| errMsg + (sprintf "expected value of type %s, but no value was found." (vardef.TypeDef.ToString()))
+ )
// special case - while single values should be wrapped with a list in this scenario,
// string would be treat as IEnumerable and coerced into a list of chars
| :? string as s ->
@@ -148,21 +163,29 @@ let rec private coerceVariableValue isNullable typedef (vardef: VarDef) (input:
|> Seq.toList
|> List.rev
|> List.fold (fun acc coerced -> cons coerced acc) nil
+
mapped
| other -> raise (GraphQLException <| errMsg + (sprintf "Cannot coerce value of type '%O' to list." (other.GetType())))
| InputObject objdef ->
coerceVariableInputObject objdef vardef input (errMsg + (sprintf "in input object '%s': " objdef.Name))
| Enum enumdef ->
match input with
- | :? string as s ->
- ReflectionHelper.parseUnion enumdef.Type s
+ | :? string as s -> ReflectionHelper.parseUnion enumdef.Type s
| null when isNullable -> null
- | null -> raise(GraphQLException <| errMsg + (sprintf "Expected Enum '%s', but no value was found." enumdef.Name))
+ | null -> raise (GraphQLException <| errMsg + (sprintf "Expected Enum '%s', but no value was found." enumdef.Name))
| u when FSharpType.IsUnion(enumdef.Type) && enumdef.Type = input.GetType() -> u
| o when Enum.IsDefined(enumdef.Type, o) -> o
| _ ->
- raise (GraphQLException <| errMsg + (sprintf "Cannot coerce value of type '%O' to type Enum '%s'" (input.GetType()) enumdef.Name))
- | _ -> raise (GraphQLException <| errMsg + "Only Scalars, Nullables, Lists and InputObjects are valid type definitions.")
+ raise (
+ GraphQLException
+ <| errMsg
+ + (sprintf "Cannot coerce value of type '%O' to type Enum '%s'" (input.GetType()) enumdef.Name)
+ )
+ | _ ->
+ raise (
+ GraphQLException
+ <| errMsg + "Only Scalars, Nullables, Lists and InputObjects are valid type definitions."
+ )
and private coerceVariableInputObject (objdef) (vardef: VarDef) (input: obj) errMsg =
//TODO: this should be eventually coerced to complex object
@@ -172,13 +195,17 @@ and private coerceVariableInputObject (objdef) (vardef: VarDef) (input: obj) err
objdef.Fields
|> Array.map (fun field ->
let valueFound = Map.tryFind field.Name map |> Option.toObj
- (field.Name, coerceVariableValue false field.TypeDef vardef valueFound (errMsg + (sprintf "in field '%s': " field.Name))))
+
+ (field.Name,
+ coerceVariableValue false field.TypeDef vardef valueFound (errMsg + (sprintf "in field '%s': " field.Name))))
|> Map.ofArray
+
upcast mapped
| _ -> input
let internal coerceVariable (vardef: VarDef) (inputs) =
let vname = vardef.Name
+
match Map.tryFind vname inputs with
| None ->
match vardef.DefaultValue with
@@ -189,5 +216,10 @@ let internal coerceVariable (vardef: VarDef) (inputs) =
| None ->
match vardef.TypeDef with
| Nullable _ -> null
- | _ -> raise (GraphQLException (sprintf "Variable '$%s' of required type %s has no value provided." vname (vardef.TypeDef.ToString())))
- | Some input -> coerceVariableValue false vardef.TypeDef vardef input (sprintf "Variable '$%s': " vname)
\ No newline at end of file
+ | _ ->
+ raise (
+ GraphQLException(
+ sprintf "Variable '$%s' of required type %s has no value provided." vname (vardef.TypeDef.ToString())
+ )
+ )
+ | Some input -> coerceVariableValue false vardef.TypeDef vardef input (sprintf "Variable '$%s': " vname)
diff --git a/src/FSharp.Data.GraphQL.Server/paket.references b/src/FSharp.Data.GraphQL.Server/paket.references
deleted file mode 100644
index 0fd7b0ea0..000000000
--- a/src/FSharp.Data.GraphQL.Server/paket.references
+++ /dev/null
@@ -1,4 +0,0 @@
-group Common
-FParsec
-FSharp.Core
-System.Reactive
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Shared/AssemblyInfo.fs b/src/FSharp.Data.GraphQL.Shared/AssemblyInfo.fs
deleted file mode 100644
index 25cc3fed6..000000000
--- a/src/FSharp.Data.GraphQL.Shared/AssemblyInfo.fs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Auto-Generated by FAKE; do not edit
-namespace System
-open System.Reflection
-open System.Runtime.CompilerServices
-
-[]
-[]
-[]
-[]
-[]
-[]
-[]
-[]
-[]
-do ()
-
-module internal AssemblyVersionInformation =
- let [] AssemblyTitle = "FSharp.Data.GraphQL.Shared"
- let [] AssemblyProduct = "FSharp.Data.GraphQL"
- let [] AssemblyDescription = "FSharp implementation of Facebook GraphQL query language"
- let [] AssemblyVersion = "1.0.8"
- let [] AssemblyFileVersion = "1.0.8"
- let [] InternalsVisibleTo = "FSharp.Data.GraphQL.Server"
- let [] InternalsVisibleTo_1 = "FSharp.Data.GraphQL.Client"
- let [] InternalsVisibleTo_2 = "FSharp.Data.GraphQL.Client.DesignTime"
- let [] InternalsVisibleTo_3 = "FSharp.Data.GraphQL.Tests"
diff --git a/src/FSharp.Data.GraphQL.Shared/Ast.fs b/src/FSharp.Data.GraphQL.Shared/Ast.fs
index e35f736a3..e4cf47dae 100644
--- a/src/FSharp.Data.GraphQL.Shared/Ast.fs
+++ b/src/FSharp.Data.GraphQL.Shared/Ast.fs
@@ -1,67 +1,268 @@
-/// The MIT License (MIT)
-/// Copyright (c) 2016 Bazinga Technologies Inc
+// The MIT License (MIT)
+// Copyright (c) 2016 Bazinga Technologies Inc
+// Copyright (c) 2019 Henrik Feldt
+
namespace FSharp.Data.GraphQL.Ast
-//NOTE: For references, see https://facebook.github.io/graphql/
+open System
-/// 2.2 Query Document
-type Document = {
- Definitions: Definition list
-}
+/// There are three types of operations that GraphQL models.
+///
+/// Each operation is represented by an optional operation name and a selection set.
+///
+/// https://spec.graphql.org/October2021/#sec-Language.Operations
+/// https://spec.graphql.org/October2021/#OperationType
+type OperationType =
+ /// A read-only fetch.
+ | Query
+ /// A write followed by a fetch.
+ | Mutation
+ /// A long-lived request that fetches data in response to source events.
+ | Subscription
-and Definition =
- | OperationDefinition of OperationDefinition
- | FragmentDefinition of FragmentDefinition
- member x.Name =
- match x with
- | OperationDefinition op -> op.Name
- | FragmentDefinition frag -> frag.Name
- member x.Directives =
- match x with
- | OperationDefinition op -> op.Directives
- | FragmentDefinition frag -> frag.Directives
- member x.SelectionSet =
- match x with
- | OperationDefinition op -> op.SelectionSet
- | FragmentDefinition frag -> frag.SelectionSet
-/// 2.2.1 Operations
-and OperationDefinition =
+/// 2.9 Input Values
+///
+/// Field and directive arguments accept input values of various literal primitives; input values can be scalars, enumeration
+/// values, lists, or input objects.
+///
+/// If not defined as constant (for example, in DefaultValue), input values can be specified as a variable. List and inputs
+/// objects may also contain variables (unless defined to be constant).
+///
+/// https://spec.graphql.org/October2021/#sec-Input-Values
+type Value =
+ /// 2.9.1 Int Value
+ /// https://spec.graphql.org/October2021/#sec-Int-Value
+ | IntValue of int64
+ /// 2.9.2 Float Value
+ /// https://spec.graphql.org/October2021/#sec-Float-Value
+ | FloatValue of double
+ /// 2.9.3 Boolean Value
+ /// https://spec.graphql.org/October2021/#sec-Boolean-Value
+ | BooleanValue of bool
+ /// 2.9.4 String Value
+ /// https://spec.graphql.org/October2021/#sec-String-Value
+ | StringValue of string
+ /// 2.9.5 Null Value
+ /// https://spec.graphql.org/October2021/#sec-Null-Value
+ | NullValue
+ /// 2.9.6 Enum Value
+ /// not "true", "false" or "null"
+ /// https://spec.graphql.org/October2021/#sec-Enum-Value
+ | EnumValue of string
+ /// 2.9.7 List Value
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#sec-List-Value
+ | ListValue of Value list
+ /// 2.9.8 Input Object Values
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#sec-Input-Object-Values
+ /// Contains ObjectField: https://spec.graphql.org/October2021/#ObjectField
+ | ObjectValue of Map
+ /// 2.10 Variables
+ /// if not Const
+ /// https://spec.graphql.org/October2021/#Variable
+ | Variable of string
+
+/// 2.6 Arguments
+///
+/// Fields are conceptually functions which return values, and occasionally accept arguments which alter their behavior.
+/// These arguments often map directly to function arguments within a GraphQL service’s implementation.
+///
+/// https://spec.graphql.org/October2021/#sec-Language.Arguments
+/// https://spec.graphql.org/October2021/#Arguments
+type Argument =
{
- OperationType: OperationType
- Name: string option
- VariableDefinitions: VariableDefinition list
+ Name: string
+ Value: Value
+ }
+
+/// 2.12 Directives
+///
+/// Directives provide a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
+///
+/// In some cases, you need to provide options to alter GraphQL’s execution behavior in ways field arguments will not suffice,
+/// such as conditionally including or skipping a field. Directives provide this by describing additional information to the
+/// executor.
+///
+/// Directives have a name along with a list of arguments which may accept values of any input type.
+///
+/// Directives can be used to describe additional information for types, fields, fragments and operations.
+///
+/// As future versions of GraphQL adopt new configurable execution capabilities, they may be exposed via directives. GraphQL
+/// services and tools may also provide any additional custom directive beyond those described here.
+///
+/// Directives may be provided in a specific syntactic order which may have semantic interpretation.
+///
+/// https://spec.graphql.org/October2021/#sec-Language.Directives
+/// https://spec.graphql.org/October2021/#Directive
+type Directive =
+ {
+ /// https://spec.graphql.org/October2021/#Name
+ Name: string
+ /// https://spec.graphql.org/October2021/#Arguments
+ Arguments: Argument list
+ }
+ member x.If = x.Arguments |> List.find (fun arg -> arg.Name = "if")
+
+/// 2.8 Fragments
+///
+/// Fragments are the primary unit of composition in GraphQL.
+///
+/// Fragments allow for the reuse of common repeated selections of fields, reducing duplicated text in the document. Inline
+/// Fragments can be used directly within a selection to condition upon a type condition when querying against an interface or
+/// union.
+///
+/// https://spec.graphql.org/October2021/#sec-Language.Fragments
+/// https://spec.graphql.org/October2021/#FragmentSpread
+type FragmentSpread =
+ {
+ Name: string
+ /// Maybe empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ }
+
+///
+/// 2.8 Fragments
+///
+///
+/// Fragments are the primary unit of composition in GraphQL.
+///
+/// Fragments allow for the reuse of common repeated selections of fields, reducing duplicated text in the document. Inline
+/// Fragments can be used directly within a selection to condition upon a type condition when querying against an interface or
+/// union.
+///
+/// Example: fragment userFragment on User
+///
+/// https://spec.graphql.org/October2021/#sec-Language.Fragments
+///
+/// https://spec.graphql.org/October2021/#FragmentDefinition
+///
+type FragmentDefinition =
+ {
+ /// Name, but not the constant "on"
+ Name: string
+
+ /// 2.8.1 Type Conditions
+ ///
+ /// Fragments must specify the type they apply to. In this example, friendFields can be used in the context of querying a
+ /// User.
+ ///
+ /// Fragments cannot be specified on any input value (scalar, enumeration, or input object).
+ ///
+ /// Selections within fragments only return values when the concrete type of the object it is operating on matches the
+ /// type of the fragment.
+ ///
+ /// Example: `fragment userFragment on User`
+ ///
+ /// https://spec.graphql.org/October2021/#sec-Type-Conditions
+ TypeCondition: string
+
+ /// May be empty
Directives: Directive list
+
+ /// May not be empty
SelectionSet: Selection list
}
- member x.IsShortHandQuery =
- x.OperationType = Query && x.Name.IsNone && x.VariableDefinitions.IsEmpty && x.Directives.IsEmpty
-and OperationType =
- | Query
- | Mutation
- | Subscription
+/// Fragments can be defined inline within a selection set. This is done to conditionally include fields based on their runtime
+/// type. This feature of standard fragment inclusion was demonstrated in the query FragmentTyping example. We could accomplish
+/// the same thing using inline fragments.
+///
+/// https://spec.graphql.org/October2021/#sec-Inline-Fragments
+/// https://spec.graphql.org/October2021/#InlineFragment
+and InlineFragment =
+ {
+ /// 2.8.1 Type Conditions
+ ///
+ /// Fragments must specify the type they apply to. In this example, friendFields can be used in the context of querying a
+ /// User.
+ ///
+ /// Fragments cannot be specified on any input value (scalar, enumeration, or input object).
+ ///
+ /// Selections within fragments only return values when the concrete type of the object it is operating on matches the
+ /// type of the fragment.
+ ///
+ /// Example: `fragment userFragment on User`
+ ///
+ /// https://spec.graphql.org/October2021/#sec-Type-Conditions
+ TypeCondition: string option
-/// 2.2.2 Selection Sets
+ /// May be empty
+ Directives: Directive list
+
+ /// May not be empty
+ SelectionSet: Selection list
+ }
+
+
+///
+/// 2.4 Selection Sets
+///
+/// An operation selects the set of information it needs, and will receive exactly that information and nothing more, avoiding
+/// over-fetching and under-fetching data.
+///
+///
+///
+/// {
+/// id
+/// firstName
+/// lastName
+/// }
+///
+///
+/// https://spec.graphql.org/October2021/#sec-Selection-Sets
+///
+/// https://spec.graphql.org/October2021/#Selection
+///
and Selection =
+ /// https://spec.graphql.org/October2021/#Field
| Field of Field
+ /// https://spec.graphql.org/October2021/#FragmentSpread
| FragmentSpread of FragmentSpread
- /// 2.2.6.2 Inline Fragments
- | InlineFragment of FragmentDefinition
+ /// https://spec.graphql.org/October2021/#InlineFragment
+ | InlineFragment of InlineFragment
member x.Directives =
match x with
| Field f -> f.Directives
| FragmentSpread s -> s.Directives
| InlineFragment f -> f.Directives
-/// 2.2.3 Fields
+/// 2.5 Fields
+/// https://spec.graphql.org/October2021/#sec-Language.Fields
+///
+/// A selection set is primarily composed of fields. A field describes one discrete piece of information available to request
+/// within a selection set.
+///
+/// Some fields describe complex data or relationships to other data. In order to further explore this data, a field may itself
+/// contain a selection set, allowing for deeply nested requests. All GraphQL operations must specify their selections down to
+/// fields which return scalar values to ensure an unambiguously shaped response.
and Field =
{
- /// 2.2.5 Field Alias
+ /// 2.7 Field Alias
+ ///
+ /// By default a field’s response key in the response object will use that field’s name. However, you can define a
+ /// different response key by specifying an alias.
+ ///
+ /// https://spec.graphql.org/October2021/#sec-Field-Alias
+ /// https://spec.graphql.org/October2021/#Alias
Alias: string option
+
+ /// https://spec.graphql.org/October2021/#Name
Name: string
+
+ /// Arguments are unordered.
+ /// https://spec.graphql.org/October2021/#Arguments
Arguments: Argument list
+
+ /// May be empty.
+ /// Arguments are ordered.
+ /// https://spec.graphql.org/October2021/#Directives
Directives: Directive list
+
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#SelectionSet
SelectionSet: Selection list
}
member x.AliasOrName =
@@ -69,127 +270,840 @@ and Field =
| Some alias -> alias
| None -> x.Name
-/// 2.2.4 Arguments
-and Argument = {
- Name: string
- Value: Value
-}
-
-/// 2.2.6 Fragments
-and FragmentSpread = {
- Name: string
- Directives: Directive list
-}
-
-and FragmentDefinition = {
- Name: string option
- /// 2.2.6.1 Type Conditions
- TypeCondition: string option
- Directives: Directive list
- SelectionSet: Selection list
-}
-/// 2.9 Input Values
-and Value =
- /// 2.9.1 Int Value
- | IntValue of int64
- /// 2.9.2 Float Value
- | FloatValue of double
- /// 2.9.3 Boolean Value
- | BooleanValue of bool
- /// 2.9.4 String Value
- | StringValue of string
- /// 2.9.5 Null Value
- | NullValue
- /// 2.9.6 Enum Value
- | EnumValue of string
- /// 2.9.7 List Value
- | ListValue of Value list
- /// 2.9.8 Input Object Values
- | ObjectValue of Map
- /// 2.10 Variables
- | Variable of string
-
-/// 2.2.8 Variables
-and VariableDefinition =
- { VariableName: string
- Type: InputType
- DefaultValue: Value option }
-
-/// 2.2.9 Input Types
-and InputType =
+/// 2.11 Type References
+/// Renamed from "Type" as this is frequently used in .Net.
+/// https://spec.graphql.org/October2021/#sec-Type-References
+/// https://spec.graphql.org/October2021/#Type
+type TypeReference =
+ /// https://spec.graphql.org/October2021/#NamedType
| NamedType of string
- | ListType of InputType
- | NonNullType of InputType
+ /// https://spec.graphql.org/October2021/#ListType
+ | ListType of TypeReference list
+ /// https://spec.graphql.org/October2021/#NamedType
+ /// https://spec.graphql.org/October2021/#NonNullType
+ | NonNullNameType of string
+ /// https://spec.graphql.org/October2021/#ListType
+ /// https://spec.graphql.org/October2021/#NonNullType
+ | NonNullListType of TypeReference list
override x.ToString() =
- let rec str = function
+ let rec str =
+ function
| NamedType name -> name
- | ListType inner -> "[" + (str inner) + "]"
- | NonNullType inner -> (str inner) + "!"
+ | ListType inner ->
+ String.Concat [ "["
+ String.concat ", " (List.map str inner)
+ "]" ]
+ | NonNullNameType inner -> $"{inner}!"
+ | NonNullListType inner -> $"{str (ListType inner)}!"
+
str x
-/// 2.2.10 Directives
-and Directive =
+
+
+/// 2.10 Variables
+/// A GraphQL operation can be parameterized with variables, maximizing reuse, and avoiding costly string building in clients at
+/// runtime.
+///
+/// If not defined as constant (for example, in DefaultValue), a Variable can be supplied for an input value.
+///
+/// Variables must be defined at the top of an operation and are in scope throughout the execution of that operation. Values for
+/// those variables are provided to a GraphQL service as part of a request so they may be substituted in during execution.
+///
+/// Variables can be used within fragments. Variables have global scope with a given operation, so a variable used within a
+/// fragment must be declared in any top-level operation that transitively consumes that fragment. If a variable is referenced in
+/// a fragment and is included by an operation that does not define that variable, that operation is invalid (see All Variable
+/// Uses Defined). (from https://spec.graphql.org/October2021/#sec-Language.Variables.Variable-use-within-Fragments)
+///
+/// https://spec.graphql.org/October2021/#sec-Language.Variables
+/// https://spec.graphql.org/October2021/#VariableDefinition
+type VariableDefinition =
+ {
+ /// https://spec.graphql.org/October2021/#Variable
+ VariableName: string
+ /// https://spec.graphql.org/October2021/#Type
+ Type: TypeReference
+ /// https://spec.graphql.org/October2021/#DefaultValue
+ DefaultValue: Value option
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ }
+
+/// 2.3 Operations
+///
+/// There are three types of operations that GraphQL models:
+///
+/// - query – a read-only fetch.
+/// - mutation – a write followed by a fetch.
+/// - subscription – a long-lived request that fetches data in response to source events.
+///
+/// Each operation is represented by an optional operation name and a selection set.
+///
+/// https://spec.graphql.org/October2021/#sec-Language.Operations
+type OperationDefinition =
+ {
+ /// Defaults to `query`; called "query shorthand".
+ OperationType: OperationType
+
+ /// https://spec.graphql.org/October2021/#Name
+ Name: string option
+
+ /// May be empty
+ /// https://spec.graphql.org/October2021/#VariableDefinitions
+ VariableDefinitions: VariableDefinition list
+
+ /// May be empty
+ Directives: Directive list
+
+ /// May not be empty
+ SelectionSet: Selection list
+ }
+ /// Create a new Operation Definition.
+ static member Create(selectionSet, ?op: OperationType) =
+ {
+ OperationType = defaultArg op Query
+ Name = None
+ VariableDefinitions = []
+ Directives = []
+ SelectionSet = selectionSet
+ }
+
+ member x.IsShortHandQuery =
+ x.OperationType = Query && x.Name.IsNone && x.VariableDefinitions.IsEmpty && x.Directives.IsEmpty
+
+type InputDefinition = string
+
+/// GraphQL field input definition. Can be used as fields for
+/// input objects or as arguments for any ordinary field definition.
+type InputFieldDefinition =
{
+ /// Name of the input field / argument.
Name: string
- Arguments: Argument list
+ /// Optional input field / argument description.
+ Description: string option
+ /// GraphQL type definition of the input type.
+ TypeDef: InputDefinition
+ /// Optional default input value - used when no input was provided.
+ DefaultValue: Value option
+ }
+
+/// 3.3.1 Root Operation Types
+///
+/// A schema defines the initial root operation type for each kind of operation it supports: query, mutation, and subscription;
+/// this determines the place in the type system where those operations begin.
+///
+/// The query root operation type must be provided and must be an Object type.
+///
+/// The mutation root operation type is optional; if it is not provided, the service does not support mutations. If it is
+/// provided, it must be an Object type.
+///
+/// Similarly, the subscription root operation type is also optional; if it is not provided, the service does not support
+/// subscriptions. If it is provided, it must be an Object type.
+///
+/// The query, mutation, and subscription root types must all be different types if provided.
+///
+/// The fields on the query root operation type indicate what fields are available at the top level of a GraphQL query operation.
+///
+/// Default Root Operation Type Names:
+///
+/// While any type can be the root operation type for a GraphQL operation, the type system definition language can omit the schema
+/// definition when the query, mutation, and subscription root types are named "Query", "Mutation", and "Subscription" respectively.
+///
+/// Likewise, when representing a GraphQL schema using the type system definition language, a schema definition should be omitted
+/// if it only uses the default root operation type names.
+///
+/// This example describes a valid complete GraphQL schema, despite not explicitly including a schema definition.
+/// The "Query" type is presumed to be the query root operation type of the schema.
+///
+/// Also see 3.3 Schema.
+/// https://spec.graphql.org/October2021/#RootOperationTypeDefinition
+type RootOperationTypeDefinition =
+ {
+ /// https://spec.graphql.org/October2021/#OperationType
+ Operation: OperationType
+ /// https://spec.graphql.org/October2021/#NamedType
+ NamedType: string
+ }
+
+/// 3.3 Schema
+///
+/// A GraphQL service’s collective type system capabilities are referred to as that service’s “schema”. A schema is defined in
+/// terms of the types and directives it supports as well as the root operation types for each kind of operation: query, mutation,
+/// and subscription; this determines the place in the type system where those operations begin.
+///
+/// A GraphQL schema must itself be internally valid. This section describes the rules for this validation process where relevant.
+///
+/// All types within a GraphQL schema must have unique names. No two provided types may have the same name. No provided type may
+/// have a name which conflicts with any built in types (including Scalar and Introspection types).
+///
+/// All directives within a GraphQL schema must have unique names.
+///
+/// All types and directives defined within a schema must not have a name which begins with "__" (two underscores), as this is
+/// used exclusively by GraphQL’s introspection system.
+///
+/// Example "My schema" schema @important { ... } or schema { ... }.
+///
+/// https://spec.graphql.org/October2021/#sec-Schema
+/// https://spec.graphql.org/October2021/#SchemaDefinition
+type SchemaDefinition =
+ {
+ /// https://spec.graphql.org/October2021/#Description
+ Description: string option
+
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+
+ /// https://spec.graphql.org/October2021/#RootOperationTypeDefinition
+ RootOperationTypes: RootOperationTypeDefinition
+ }
+
+/// 3.6.1 Field Arguments
+///
+/// Object fields are conceptually functions which yield values. Occasionally object fields can accept arguments to further
+/// specify the return value. Object field arguments are defined as a list of all possible argument names and their expected input
+/// types.
+///
+/// All arguments defined within a field must not have a name which begins with "__" (two underscores), as this is used
+/// exclusively by GraphQL’s introspection system.
+///
+/// https://spec.graphql.org/October2021/#InputValueDefinition
+type InputValueDefinition =
+ {
+ Description: string option
+
+ Name: string
+
+ /// https://spec.graphql.org/October2021/#Type
+ Type: TypeReference
+
+ /// https://spec.graphql.org/October2021/#DefaultValue
+ DefaultValue: Value option
+
+ /// May be empty
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ }
+
+/// https://spec.graphql.org/October2021/#FieldDefinition
+type FieldDefinition =
+ {
+ /// https://spec.graphql.org/October2021/#Description
+ Description: string option
+ Name: string
+ /// May be empty
+ /// https://spec.graphql.org/October2021/#ArgumentsDefinition
+ Arguments: InputValueDefinition list
+ /// https://spec.graphql.org/October2021/#Type
+ Type: TypeReference
+ /// May be empty
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ }
+
+// TypeDefinitions:
+
+/// 3.5 Scalars
+///
+/// Scalar types represent primitive leaf values in a GraphQL type system. GraphQL responses take the form of a hierarchical tree;
+/// the leaves of this tree are typically GraphQL Scalar types (but may also be Enum types or null values).
+///
+/// GraphQL provides a number of built-in scalars which are fully defined in the sections below, however type systems may also add
+/// additional custom scalars to introduce additional semantic meaning.
+///
+/// Built-in Scalars:
+///
+/// GraphQL specifies a basic set of well-defined Scalar types: Int, Float, String, Boolean, and ID. A GraphQL framework should
+/// support all of these types, and a GraphQL service which provides a type by these names must adhere to the behavior described
+/// for them in this document. As an example, a service must not include a type called Int and use it to represent 64-bit numbers,
+/// internationalization information, or anything other than what is defined in this document.
+///
+/// When returning the set of types from the __Schema introspection type, all referenced built-in scalars must be included. If a
+/// built-in scalar type is not referenced anywhere in a schema (there is no field, argument, or input field of that type) then it
+/// must not be included.
+///
+/// When representing a GraphQL schema using the type system definition language, all built-in scalars must be omitted for
+/// brevity.
+///
+/// https://spec.graphql.org/October2021/#ScalarTypeDefinition
+type ScalarTypeDefinition =
+ {
+ Description: string option
+
+ Name: string
+
+ /// May be empty.
+ Directives: Directive list
+ }
+
+/// 3.5.6 Scalar Extensions
+///
+/// Scalar type extensions are used to represent a scalar type which has been extended from some original scalar type. For example,
+/// this might be used by a GraphQL tool or service which adds directives to an existing scalar.
+///
+/// Type Validation:
+///
+/// Scalar type extensions have the potential to be invalid if incorrectly defined.
+///
+/// 1. The named type must already be defined and must be a Scalar type.
+/// 2. Any non-repeatable directives provided must not already apply to the original Scalar type.
+///
+/// Example: extend scalar [name] directive...
+///
+/// https://spec.graphql.org/October2021/#sec-Scalar-Extensions
+type ScalarTypeExtension =
+ {
+ Name: string
+
+ /// May not be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ }
+
+/// 3.6 Objects
+///
+/// GraphQL operations are hierarchical and composed, describing a tree of information. While Scalar types describe the leaf
+/// values of these hierarchical operations, Objects describe the intermediate levels.
+///
+/// GraphQL Objects represent a list of named fields, each of which yield a value of a specific type. Object values should be
+/// serialized as ordered maps, where the selected field names (or aliases) are the keys and the result of evaluating the field
+/// is the value, ordered by the order in which they appear in the selection set.
+///
+/// All fields defined within an Object type must not have a name which begins with "__" (two underscores), as this is used
+/// exclusively by GraphQL’s introspection system.
+///
+/// https://spec.graphql.org/October2021/#sec-Objects
+type ObjectTypeDefinition =
+ {
+ Description: string option
+ // "type"
+ Name: string
+ // "implements .. & .. & .."
+ /// May be empty
+ /// https://spec.graphql.org/October2021/#ImplementsInterfaces
+ ImplementsInterfaces: string list
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ // "{" fields "}"
+ Fields: FieldDefinition list
+ }
+
+/// 3.6.3 Object Extensions
+///
+/// Object type extensions are used to represent a type which has been extended from some original type. For example, this might
+/// be used to represent local data, or by a GraphQL service which is itself an extension of another GraphQL service.
+///
+/// Object type extensions may choose not to add additional fields, instead only adding interfaces or directives.
+///
+/// https://spec.graphql.org/October2021/#sec-Object-Extensions
+/// https://spec.graphql.org/October2021/#ObjectTypeExtension
+type ObjectTypeExtension =
+ {
+ /// May be empty.
+ Interfaces: string list
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ /// May be empty.
+ Fields: FieldDefinition list
+ }
+
+/// 3.7 Interfaces
+///
+/// GraphQL interfaces represent a list of named fields and their arguments. GraphQL objects and interfaces can then implement
+/// these interfaces which requires that the implementing type will define all fields defined by those interfaces.
+///
+/// Fields on a GraphQL interface have the same rules as fields on a GraphQL object; their type can be Scalar, Object, Enum,
+/// Interface, or Union, or any wrapping type whose base type is one of those five.
+///
+/// For example, an interface NamedEntity may describe a required field and types such as Person or Business may then implement
+/// this interface to guarantee this field will always exist.
+///
+/// Types may also implement multiple interfaces. For example, Business implements both the NamedEntity and ValuedEntity
+/// interfaces in the example below.
+///
+/// https://spec.graphql.org/October2021/#sec-Interfaces
+type InterfaceTypeDefinition =
+ {
+ Description: string option
+ Name: string
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ /// May not be empty.
+ Fields: FieldDefinition list
+ }
+
+/// 3.7.1 Interface Extensions
+///
+/// Interface type extensions are used to represent an interface which has been extended from some original interface. For
+/// example, this might be used to represent common local data on many types, or by a GraphQL service which is itself an
+/// extension of another GraphQL service.
+///
+/// Interface type extensions may choose not to add additional fields, instead only adding directives.
+///
+/// https://spec.graphql.org/October2021/#sec-Interface-Extensions
+type InterfaceTypeExtension =
+ {
+ Name: string
+
+ /// May be empty if fields is non-empty.
+ ///
+ /// May not be empty if fields is empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+
+ /// May not empty if directives is empty.
+ ///
+ /// May be empty if directives is not empty.
+ Fields: FieldDefinition list
+ }
+
+/// https://spec.graphql.org/October2021/#UnionMemberTypes
+type UnionMemberType = string
+
+/// 3.8 Unions
+///
+/// GraphQL Unions represent an object that could be one of a list of GraphQL Object types, but provides for no guaranteed
+/// fields between those types. They also differ from interfaces in that Object types declare what interfaces they implement,
+/// but are not aware of what unions contain them.
+///
+/// With interfaces and objects, only those fields defined on the type can be queried directly; to query other fields on an
+/// interface, typed fragments must be used. This is the same as for unions, but unions do not define any fields, so no fields
+/// may be queried on this type without the use of type refining fragments or inline fragments (with the exception of the meta-
+/// field __typename).
+///
+/// https://spec.graphql.org/October2021/#sec-Unions
+type UnionTypeDefinition =
+ {
+ /// Optional description
+ Description: string option
+
+ /// The name of the union
+ Name: string
+
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+
+ /// May be empty. (!)
+ /// https://spec.graphql.org/October2021/#UnionMemberTypes
+ Types: UnionMemberType list
+ }
+
+/// 3.8.1 Union Extensions
+///
+/// Union type extensions are used to represent a union type which has been extended from some original union type. For example,
+/// this might be used to represent additional local data, or by a GraphQL service which is itself an extension of another
+/// GraphQL service.
+///
+/// https://spec.graphql.org/October2021/#sec-Unions
+type UnionTypeExtension =
+ {
+ Name: string
+
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+
+ /// May not be empty.
+ /// https://spec.graphql.org/October2021/#UnionMemberTypes
+ Types: UnionMemberType list
+ }
+
+/// 3.9 Enums
+///
+/// GraphQL Enum types, like Scalar types, also represent leaf values in a GraphQL type system. However Enum types describe the
+/// set of possible values.
+///
+/// Enums are not references for a numeric value, but are unique values in their own right. They may serialize as a string: the
+/// name of the represented value.
+///
+/// https://spec.graphql.org/October2021/#sec-Enums
+/// https://spec.graphql.org/October2021/#EnumValueDefinition
+type EnumValueDefinition =
+ {
+ Description: string option
+
+ Name: string
+
+ /// May be empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+ }
+
+/// 3.9 Enums
+///
+/// GraphQL Enum types, like Scalar types, also represent leaf values in a GraphQL type system. However Enum types describe the
+/// set of possible values.
+///
+/// Enums are not references for a numeric value, but are unique values in their own right. They may serialize as a string: the
+/// name of the represented value.
+///
+/// https://spec.graphql.org/October2021/#sec-Enums
+/// https://spec.graphql.org/October2021/#EnumTypeDefinition
+type EnumTypeDefinition =
+ {
+ Description: string option
+ Name: string
+
+ Directives: Directive list
+ Values: EnumValueDefinition list
+ }
+
+/// 3.9.1 Enum Extensions
+///
+/// Enum type extensions are used to represent an enum type which has been extended from some original enum type. For example,
+/// this might be used to represent additional local data, or by a GraphQL service which is itself an extension of another
+/// GraphQL service.
+///
+/// https://spec.graphql.org/October2021/#sec-Enum-Extensions
+type EnumTypeExtension =
+ {
+ Name: string
+
+ /// May be empty if fields is non-empty.
+ ///
+ /// May not be empty if fields is empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+
+ /// May not empty if directives is empty.
+ ///
+ /// May be empty if directives is not empty.
+ Values: EnumValueDefinition list
+ }
+
+
+/// 3.10 Input Objects
+///
+/// Fields may accept arguments to configure their behavior. These inputs are often scalars or enums, but they sometimes need to
+/// represent more complex values.
+///
+/// A GraphQL Input Object defines a set of input fields; the input fields are either scalars, enums, or other input objects.
+/// This allows arguments to accept arbitrarily complex structs.
+///
+/// Circular References:
+///
+/// Input Objects are allowed to reference other Input Objects as field types. A circular reference occurs when an Input Object
+/// references itself either directly or through referenced Input Objects.
+///
+/// Circular references are generally allowed, however they may not be defined as an unbroken chain of Non-Null singular fields.
+/// Such Input Objects are invalid because there is no way to provide a legal value for them.
+///
+/// Note: there's a long section on how input values are coerced in the spec.
+///
+/// https://spec.graphql.org/October2021/#sec-Input-Objects
+type InputObjectTypeDefinition =
+ {
+ Description: string option
+
+ // "input"
+
+ Name: string
+
+ /// May be empty if fields is non-empty.
+ ///
+ /// May not be empty if fields is empty.
+ /// https://spec.graphql.org/October2021/#Directives
+ Directives: Directive list
+
+ /// "{" Fields "}"
+ ///
+ /// May not empty if directives is empty.
+ ///
+ /// May be empty if directives is not empty.
+ ///
+ /// https://spec.graphql.org/October2021/#InputFieldsDefinition
+ Fields: InputValueDefinition list
+ }
+
+/// 3.10.1 Input Object Extensions
+///
+/// Input object type extensions are used to represent an input object type which has been extended from some original input
+/// object type. For example, this might be used by a GraphQL service which is itself an extension of another GraphQL service.
+///
+/// https://spec.graphql.org/October2021/#sec-Input-Object-Extensions
+type InputObjectTypeExtension =
+ {
+ Name: string
+ Directives: Directive list
+ Fields: InputValueDefinition []
}
- member x.If = x.Arguments |> List.find (fun arg -> arg.Name = "if")
-// Type System Definition
-
-and OperationTypeDefinition = {
- Type: string
- Operation: OperationType
-}
-
-and SchemaDefintion = {
- OperationTypes: OperationTypeDefinition
-}
-
-and ObjectTypeDefinition = {
- Name: string
- Interfaces: string []
- Fields: FieldDefinition []
-}
-
-and FieldDefinition = {
- Name: string
- Arguments: InputValueDefinition []
- Type: InputType
-}
-
-and InputValueDefinition = {
- Name: string
- Type: InputType
- DefaultValue: Value option
-}
-
-and InterfaceTypeDefinition = {
- Name: string
- Fields: FieldDefinition []
-}
-
-and UnionTypeDefinition = {
- Name: string
- Types: string []
-}
-
-and EnumTypeDefinition = {
- Name: string
- Values: string []
-}
-
-and InputObjectTypeDefinition = {
- Name: string
- Fields: InputValueDefinition []
-}
-
-and TypeDefinition =
- | ScalarTypeDefinition of string
+type TypeDefinition =
+ /// https://spec.graphql.org/October2021/#ScalarTypeExtension
+ | ScalarTypeDefinition of ScalarTypeDefinition
| ObjectTypeDefinition of ObjectTypeDefinition
| InterfaceTypeDefinition of InterfaceTypeDefinition
| UnionTypeDefinition of UnionTypeDefinition
| EnumTypeDefinition of EnumTypeDefinition
| InputObjectTypeDefinition of InputObjectTypeDefinition
+ member x.Directives =
+ match x with
+ | ScalarTypeDefinition std -> std.Directives
+ | ObjectTypeDefinition otd -> otd.Directives
+ | InterfaceTypeDefinition itd -> itd.Directives
+ | UnionTypeDefinition utd -> utd.Directives
+ | EnumTypeDefinition etd -> etd.Directives
+ | InputObjectTypeDefinition iotd -> iotd.Directives
+
+/// https://spec.graphql.org/October2021/#ExecutableDirectiveLocation
+[]
+type ExecutableDirectiveLocation =
+ | QUERY = 1
+ | MUTATION = 2
+ | SUBSCRIPTION = 4
+ | FIELD = 8
+ | FRAGMENT_DEFINITION = 16
+ | FRAGMENT_SPREAD = 32
+ | INLINE_FRAGMENT = 64
+
+
+/// https://spec.graphql.org/October2021/#TypeSystemDirectiveLocation
+[]
+type TypeSystemDirectiveLocation =
+ | SCHEMA = 1
+ | SCALAR = 2
+ | OBJECT = 4
+ | FIELD_DEFINITION = 8
+ | ARGUMENT_DEFINITION = 16
+ | INTERFACE = 32
+ | UNION = 64
+ | ENUM = 128
+ | ENUM_VALUE = 256
+ | INPUT_OBJECT = 512
+ | INPUT_FIELD_DEFINITION = 1024
+
+
+type DirectiveLocation =
+ /// https://spec.graphql.org/October2021/#ExecutableDirectiveLocation
+ | ExecutableDirectiveLocation of ExecutableDirectiveLocation
+ /// https://spec.graphql.org/October2021/#TypeSystemDirectiveLocation
+ | TypeSystemDirectiveLocation of TypeSystemDirectiveLocation
+
+/// 3.13 Directives
+///
+/// DirectiveDefinition:
+/// Description opt directive @ `Name` `ArgumentsDefinition` opt on `DirectiveLocations`
+///
+/// https://spec.graphql.org/October2021/#sec-Type-System.Directives
+/// https://spec.graphql.org/October2021/#DirectiveDefinition
+type DirectiveDefinition =
+ {
+ /// Optional directive description.
+ Description: string option
+
+ // "directive" "@"
+
+ /// Directive's name - it's NOT '@' prefixed.
+ Name: string
+
+ /// https://spec.graphql.org/October2021/#ArgumentsDefinition
+ Arguments: InputValueDefinition list
+
+ // [ "repeatable" ] "on"
+
+ /// Directive location - describes, which part's of the query AST are valid places to include current directive to.
+ /// https://spec.graphql.org/October2021/#DirectiveLocation
+ Locations: DirectiveLocation
+ }
+
+
+/// 3.0 Type System
+///
+/// The GraphQL Type system describes the capabilities of a GraphQL service and is used to determine if a requested operation is
+/// valid, to guarantee the type of response results, and describes the input types of variables to determine if values provided
+/// at request time are valid.
+///
+/// The GraphQL language includes an IDL used to describe a GraphQL service’s type system. Tools may use this definition language
+/// to provide utilities such as client code generation or service boot-strapping.
+///
+/// GraphQL tools or services which only seek to execute GraphQL requests and not construct a new GraphQL schema may choose not to
+/// allow TypeSystemDefinition. Tools which only seek to produce schema and not execute requests may choose to only allow
+/// TypeSystemDocument and not allow ExecutableDefinition or TypeSystemExtension but should provide a descriptive error if
+/// present.
+///
+/// https://spec.graphql.org/October2021/#sec-Type-System
+/// https://spec.graphql.org/October2021/#TypeSystemDefinition
+type TypeSystemDefinition =
+ /// https://spec.graphql.org/October2021/#SchemaDefinition
+ | SchemaDefinition of SchemaDefinition
+ /// https://spec.graphql.org/October2021/#TypeDefinition
+ | TypeDefinition of TypeDefinition
+ /// https://spec.graphql.org/October2021/#DirectiveDefinition
+ | DirectiveDefinition of DirectiveDefinition
+
+ member x.Directives =
+ match x with
+ | SchemaDefinition sd -> sd.Directives
+ | TypeDefinition td -> td.Directives
+ | DirectiveDefinition _ -> []
+
+/// 3.3.2 Schema Extension
+///
+/// Schema extensions are used to represent a schema which has been extended from an original schema. For example, this might
+/// be used by a GraphQL service which adds additional operation types, or additional directives to an existing schema.
+///
+/// Note: Schema extensions without additional operation type definitions must not be followed by a { (such as a query shorthand)
+/// to avoid parsing ambiguity. The same limitation applies to the type definitions and extensions below.
+///
+/// https://spec.graphql.org/October2021/#sec-Schema-Extension
+/// https://spec.graphql.org/October2021/#SchemaExtension
+type SchemaExtension =
+ {
+ /// May be empty if OperationTypes is not, else it may not be empty.
+ Directives: Directive list
+ /// May be empty if the Directives list is not, else it may not be empty.
+ OperationTypes: RootOperationTypeDefinition list
+ }
+
+// Type Extensions:
+
+/// 3.4.3 Type Extensions
+///
+/// Type extensions are used to represent a GraphQL type which has been extended from some original type. For example, this might
+/// be used by a local service to represent additional fields a GraphQL client only accesses locally.
+///
+/// https://spec.graphql.org/October2021/#sec-Type-Extensions
+type TypeExtension =
+ /// https://spec.graphql.org/October2021/#sec-Scalar-Extensions
+ | ScalarTypeExtension of ScalarTypeExtension
+ /// https://spec.graphql.org/October2021/#sec-Object-Extensions
+ | ObjectTypeExtension of ObjectTypeExtension
+ /// https://spec.graphql.org/October2021/#InterfaceTypeExtension
+ | InterfaceTypeExtension of InterfaceTypeExtension
+ /// https://spec.graphql.org/October2021/#sec-Union-Extensions
+ | UnionTypeExtension of UnionTypeExtension
+ /// https://spec.graphql.org/October2021/#sec-Enum-Extensions
+ | EnumTypeExtension of EnumTypeExtension
+ /// https://spec.graphql.org/October2021/#sec-Input-Object-Extensions
+ | InputObjectTypeExtension of InputObjectTypeExtension
+
+ member x.Directives =
+ match x with
+ | ScalarTypeExtension ste -> ste.Directives
+ | ObjectTypeExtension ote -> ote.Directives
+ | InterfaceTypeExtension ite -> ite.Directives
+ | UnionTypeExtension ute -> ute.Directives
+ | EnumTypeExtension ete -> ete.Directives
+ | InputObjectTypeExtension iote -> iote.Directives
+
+/// 3.1 Type System Extensions
+///
+/// Type system extensions are used to represent a GraphQL type system which has been extended from some original type system. For
+/// example, this might be used by a local service to represent data a GraphQL client only accesses locally, or by a GraphQL
+/// service which is itself an extension of another GraphQL service.
+///
+/// Tools which only seek to produce and extend schema and not execute requests may choose to only allow
+/// TypeSystemExtensionDocument and not allow ExecutableDefinition but should provide a descriptive error if present.
+///
+/// https://spec.graphql.org/October2021/#sec-Type-System-Extensions
+/// https://spec.graphql.org/October2021/#TypeSystemExtension
+type TypeSystemExtension =
+ /// https://spec.graphql.org/October2021/#SchemaExtension
+ | SchemaExtension of SchemaExtension
+ /// https://spec.graphql.org/October2021/#TypeExtension
+ | TypeExtension of TypeExtension
+
+ member x.Directives =
+ match x with
+ | SchemaExtension se -> se.Directives
+ | TypeExtension te -> te.Directives
+
+
+/// https://spec.graphql.org/October2021/#TypeSystemDocument
+type TypeSystemDocument =
+ {
+ /// https://spec.graphql.org/October2021/#TypeSystemDefinition
+ Definitions: TypeSystemDefinition list
+ }
+
+
+/// Prefer to use either TypeSystemDocument or ExecutableDocument.
+/// https://spec.graphql.org/October2021/#Definition
+type Definition =
+ /// https://spec.graphql.org/October2021/#OperationDefinition
+ | OperationDefinition of OperationDefinition
+ /// https://spec.graphql.org/October2021/#FragmentDefinition
+ | FragmentDefinition of FragmentDefinition
+ /// https://spec.graphql.org/October2021/#TypeSystemDefinition
+ | TypeSystemDefinition of TypeSystemDefinition
+ /// https://spec.graphql.org/October2021/#TypeSystemExtension
+ | TypeSystemExtension of TypeSystemExtension
+
+ member x.Name =
+ match x with
+ | OperationDefinition op -> op.Name
+ | FragmentDefinition frag -> Some frag.Name
+ | TypeSystemDefinition _ -> None
+ | TypeSystemExtension _ -> None
+
+ member x.Directives =
+ match x with
+ | OperationDefinition op -> op.Directives
+ | FragmentDefinition frag -> frag.Directives
+ | TypeSystemDefinition tsd -> tsd.Directives
+ | TypeSystemExtension tse -> tse.Directives
+
+ member x.SelectionSet =
+ match x with
+ | OperationDefinition op -> op.SelectionSet
+ | FragmentDefinition frag -> frag.SelectionSet
+ | _ -> []
+
+
+/// https://spec.graphql.org/October2021/#ExecutableDefinition
+type ExecutableDefinition =
+ /// https://spec.graphql.org/October2021/#OperationDefinition
+ | OperationDefinition of OperationDefinition
+ /// https://spec.graphql.org/October2021/#FragmentDefinition
+ | FragmentDefinition of FragmentDefinition
+
+ member x.Directives =
+ match x with
+ | OperationDefinition op -> op.Directives
+ | FragmentDefinition frag -> frag.Directives
+
+
+
+/// https://spec.graphql.org/October2021/#ExecutableDocument
+type ExecutableDocument =
+ {
+ Definitions: ExecutableDefinition list
+ }
+ member x.Directives = x.Definitions |> List.collect (fun y -> y.Directives)
+
+
+
+/// 2.2 Document
+///
+/// A GraphQL Document describes a complete file or request string operated on by a GraphQL service or client. A document contains
+/// multiple definitions, either executable or representative of a GraphQL type system.
+///
+/// Documents are only executable by a GraphQL service if they are ExecutableDocument and contain at least one
+/// OperationDefinition. A Document which contains TypeSystemDefinitionOrExtension must not be executed; GraphQL execution
+/// services which receive a Document containing these should return a descriptive error.
+///
+/// GraphQL services which only seek to execute GraphQL requests and not construct a new GraphQL schema may choose to only permit
+/// ExecutableDocument.
+///
+/// Documents which do not contain OperationDefinition or do contain TypeSystemDefinitionOrExtension may still be parsed and
+/// validated to allow client tools to represent many GraphQL uses which may appear across many individual files.
+///
+/// If a Document contains only one operation, that operation may be unnamed. If that operation is a query without variables or
+/// directives then it may also be represented in the shorthand form, omitting both the query keyword as well as the operation
+/// name. Otherwise, if a GraphQL Document contains multiple operations, each operation must be named. When submitting a Document
+/// with multiple operations to a GraphQL service, the name of the desired operation to be executed must also be provided.
+///
+/// https://spec.graphql.org/October2021/#sec-Document-Syntax
+/// https://spec.graphql.org/October2021/#Document
+type Document =
+ {
+ Definitions: Definition list
+ }
+
+ member x.Directives = x.Definitions |> List.collect (fun y -> y.Directives)
diff --git a/src/FSharp.Data.GraphQL.Shared/AstExtensions.fs b/src/FSharp.Data.GraphQL.Shared/AstExtensions.fs
index 1133d3543..0981660b2 100644
--- a/src/FSharp.Data.GraphQL.Shared/AstExtensions.fs
+++ b/src/FSharp.Data.GraphQL.Shared/AstExtensions.fs
@@ -10,54 +10,88 @@ type Path = string list
type OperationName = string
type AstTypeFieldInfo =
- { Name : string
- Alias : string option
- Fields : AstFieldInfo list }
+ {
+ Name: string
+ Alias: string option
+ Fields: AstFieldInfo list
+ }
member x.AliasOrName = x.Alias |> Option.defaultValue x.Name
and AstFragmentFieldInfo =
- { Name : string
- Alias : string option
- TypeCondition : string
- Fields : AstFieldInfo list }
+ {
+ Name: string
+ Alias: string option
+ TypeCondition: string
+ Fields: AstFieldInfo list
+ }
member x.AliasOrName = x.Alias |> Option.defaultValue x.Name
and internal AstSelectionInfo =
- { TypeCondition : string option
- Name : string
- Alias : string option
- Path : Path
- mutable Fields : AstSelectionInfo list }
+ {
+ TypeCondition: string option
+ Name: string
+ Alias: string option
+ Path: Path
+ mutable Fields: AstSelectionInfo list
+ }
member x.AliasOrName = x.Alias |> Option.defaultValue x.Name
- static member Create(typeCondition : string option, path : Path, name : string, alias : string option, ?fields : AstSelectionInfo list) =
- { TypeCondition = typeCondition
- Name = name
- Alias = alias
- Path = path
- Fields = fields |> Option.defaultValue [] }
- member x.SetFields(fields : AstSelectionInfo list) =
- x.Fields <- fields
+
+ static member Create
+ (
+ typeCondition: string option,
+ path: Path,
+ name: string,
+ alias: string option,
+ ?fields: AstSelectionInfo list
+ ) =
+ {
+ TypeCondition = typeCondition
+ Name = name
+ Alias = alias
+ Path = path
+ Fields = fields |> Option.defaultValue []
+ }
+
+ member x.SetFields(fields: AstSelectionInfo list) = x.Fields <- fields
and AstFieldInfo =
| TypeField of AstTypeFieldInfo
| FragmentField of AstFragmentFieldInfo
- static member internal Create(info : AstSelectionInfo) =
+ static member internal Create(info: AstSelectionInfo) =
let fields = List.map AstFieldInfo.Create info.Fields
+
match info.TypeCondition with
- | Some typeCondition -> FragmentField { Name = info.Name; Alias = info.Alias; TypeCondition = typeCondition; Fields = fields }
- | None -> TypeField { Name = info.Name; Alias = info.Alias; Fields = fields }
+ | Some typeCondition ->
+ FragmentField
+ {
+ Name = info.Name
+ Alias = info.Alias
+ TypeCondition = typeCondition
+ Fields = fields
+ }
+ | None ->
+ TypeField
+ {
+ Name = info.Name
+ Alias = info.Alias
+ Fields = fields
+ }
+
member x.Name =
match x with
| TypeField info -> info.Name
| FragmentField info -> info.Name
+
member x.Alias =
match x with
| TypeField info -> info.Alias
| FragmentField info -> info.Alias
+
member x.AliasOrName =
match x with
| TypeField info -> info.Alias |> Option.defaultValue info.Name
| FragmentField info -> info.Alias |> Option.defaultValue info.Name
+
member x.Fields =
match x with
| TypeField info -> info.Fields
@@ -68,8 +102,11 @@ type internal PaddedStringBuilder() =
let mutable padCount = 0
member __.Pad() = padCount <- padCount + 2
member __.Unpad() = padCount <- padCount - 2
- member __.AppendLine() = sb.AppendLine().Append("".PadLeft(padCount, ' ')) |> ignore
- member __.Append(str : string) = sb.Append(str) |> ignore
+
+ member __.AppendLine() =
+ sb.AppendLine().Append("".PadLeft(padCount, ' ')) |> ignore
+
+ member __.Append(str: string) = sb.Append(str) |> ignore
override __.ToString() = sb.ToString()
/// Specify options when printing an Ast.Document to a query string.
@@ -85,25 +122,33 @@ type Document with
/// Generates a GraphQL query string from this document.
///
/// Specify custom printing options for the query string.
- member x.ToQueryString(?options : QueryStringPrintingOptions) =
+ member x.ToQueryString(?options: QueryStringPrintingOptions) =
let options = defaultArg options QueryStringPrintingOptions.None
+
let sb = PaddedStringBuilder()
- let withQuotes (s : string) = "\"" + s + "\""
+ let withQuotes (s: string) = "\"" + s + "\""
+
let rec printValue x =
let printObjectValue (name, value) =
sb.Append(name)
sb.Append(": ")
printValue value
+
let printOne f n ov =
match n with
| 0 -> f ov
- | _ -> sb.Append(", "); f ov
+ | _ ->
+ sb.Append(", ")
+ f ov
+
let printCompound braces f xs =
match xs with
| [] -> sb.Append(braces)
- | xs -> sb.Append(braces.Substring(0, 1) + " ")
- List.iteri (printOne f) xs
- sb.Append(" " + braces.Substring(1, 1))
+ | xs ->
+ sb.Append(braces.Substring(0, 1) + " ")
+ List.iteri (printOne f) xs
+ sb.Append(" " + braces.Substring(1, 1))
+
match x with
| IntValue x -> sb.Append(x.ToString(CultureInfo.InvariantCulture))
| FloatValue x -> sb.Append(x.ToString(CultureInfo.InvariantCulture))
@@ -114,93 +159,161 @@ type Document with
| ListValue x -> printCompound "[]" printValue x
| ObjectValue x -> printCompound "{}" printObjectValue (Map.toList x)
| Variable x -> sb.Append("$" + x)
- let printVariables (vdefs : VariableDefinition list) =
- let printVariable (vdef : VariableDefinition) =
+
+ let printVariables (vdefs: VariableDefinition list) =
+ let printVariable (vdef: VariableDefinition) =
sb.Append("$")
sb.Append(vdef.VariableName)
sb.Append(": ")
sb.Append(vdef.Type.ToString())
- vdef.DefaultValue |> Option.iter (fun value -> sb.Append(" = "); printValue value)
+
+ vdef.DefaultValue
+ |> Option.iter (fun value ->
+ sb.Append(" = ")
+ printValue value)
+
if vdefs.Length > 0 then sb.Append("(")
+
let rec helper vdefs =
match vdefs with
| [] -> ()
- | [vdef] -> printVariable vdef; sb.Append(") ")
- | vdef :: tail -> printVariable vdef; sb.Append(", "); helper tail
+ | [ vdef ] ->
+ printVariable vdef
+ sb.Append(") ")
+ | vdef :: tail ->
+ printVariable vdef
+ sb.Append(", ")
+ helper tail
+
helper vdefs
- let printArguments (arguments : Argument list) =
- let printArgument (arg : Argument) =
+
+ let printArguments (arguments: Argument list) =
+ let printArgument (arg: Argument) =
sb.Append(arg.Name + ": ")
printValue arg.Value
+
if arguments.Length > 0 then sb.Append("(")
+
let rec helper args =
match args with
| [] -> ()
- | [arg] -> printArgument arg; sb.Append(")")
- | arg :: tail -> printArgument arg; sb.Append(", "); helper tail
+ | [ arg ] ->
+ printArgument arg
+ sb.Append(")")
+ | arg :: tail ->
+ printArgument arg
+ sb.Append(", ")
+ helper tail
+
helper arguments
- let printDirectives (directives : Directive list) =
- let printDirective (directive : Directive) =
+
+ let printDirectives (directives: Directive list) =
+ let printDirective (directive: Directive) =
sb.Append("@" + directive.Name)
printArguments directive.Arguments
+
let rec helper directives =
match directives with
| [] -> ()
- | [directive] -> printDirective directive
- | directive :: tail -> printDirective directive; sb.Append(" "); helper tail
+ | [ directive ] -> printDirective directive
+ | directive :: tail ->
+ printDirective directive
+ sb.Append(" ")
+ helper tail
+
helper directives
- let setSelectionSetOptions (selectionSet : Selection list) =
+
+ let setSelectionSetOptions (selectionSet: Selection list) =
let typeNameMetaField =
- { Alias = None
- Name = "__typename"
- Arguments = []
- Directives = []
- SelectionSet = [] }
+ {
+ Alias = None
+ Name = "__typename"
+ Arguments = []
+ Directives = []
+ SelectionSet = []
+ }
+
let shouldIncludeTypeName = options.HasFlag(QueryStringPrintingOptions.IncludeTypeNames)
- let hasTypeName = selectionSet |> List.exists (function Field f -> f.Name = "__typename" | _ -> false)
- if selectionSet.Length > 0 && shouldIncludeTypeName && not (hasTypeName)
- then selectionSet @ [Field typeNameMetaField]
- else selectionSet
- let rec printSelectionSet (selectionSet : Selection list) =
- let printSelection = function
+
+ let hasTypeName =
+ selectionSet
+ |> List.exists (function
+ | Field f -> f.Name = "__typename"
+ | _ -> false)
+
+ if selectionSet.Length > 0 && shouldIncludeTypeName && not hasTypeName then
+ selectionSet @ [ Field typeNameMetaField ]
+
+ else
+ selectionSet
+
+ let rec printSelectionSet (selectionSet: Selection list) =
+ let printSelection =
+ function
| Field field ->
field.Alias |> Option.iter (fun alias -> sb.Append(alias + ": "))
+
sb.Append(field.Name)
printArguments field.Arguments
+
if field.Directives.Length > 0 then sb.Append(" ")
+
printDirectives field.Directives
+
if field.SelectionSet.Length > 0 then sb.Append(" ")
+
printSelectionSet (setSelectionSetOptions field.SelectionSet)
| FragmentSpread frag ->
sb.Append("..." + frag.Name)
+
if frag.Directives.Length > 0 then sb.Append(" ")
+
printDirectives frag.Directives
| InlineFragment frag ->
sb.Append("... ")
+
frag.TypeCondition |> Option.iter (fun t -> sb.Append("on " + t))
+
printDirectives frag.Directives
sb.Append(" ")
printSelectionSet (setSelectionSetOptions frag.SelectionSet)
- if selectionSet.Length > 0 then sb.Append("{"); sb.Pad()
+
+ if selectionSet.Length > 0 then
+ sb.Append("{")
+ sb.Pad()
+
let rec helper selectionSet =
match selectionSet with
| [] -> ()
- | [selection] -> sb.AppendLine(); printSelection selection; sb.Unpad(); sb.AppendLine(); sb.Append("}")
- | selection :: tail -> sb.AppendLine(); printSelection selection; helper tail
+ | [ selection ] ->
+ sb.AppendLine()
+ printSelection selection
+ sb.Unpad()
+ sb.AppendLine()
+ sb.Append("}")
+ | selection :: tail ->
+ sb.AppendLine()
+ printSelection selection
+ helper tail
+
helper selectionSet
- let rec printDefinitions (definitions : Definition list) =
- let printDefinition = function
+
+ let rec printDefinitions (definitions: Definition list) =
+ let printDefinition =
+ function
+ | TypeSystemDefinition _ -> () // TODO: unit tests for printing https://spec.graphql.org/October2021/#TypeSystemDefinitionOrExtension
+ | TypeSystemExtension _ -> () // TODO: unit tests for printing https://spec.graphql.org/October2021/#TypeSystemDefinitionOrExtension
| OperationDefinition odef ->
match odef.OperationType with
| Query when odef.IsShortHandQuery -> ()
| Query -> sb.Append("query ")
| Mutation -> sb.Append("mutation ")
| Subscription -> sb.Append("subscription ")
+
odef.Name
|> Option.iter (fun name ->
- if odef.VariableDefinitions.Length = 0
- then sb.Append(name + " ")
- else sb.Append(name))
+ if odef.VariableDefinitions.Length = 0 then sb.Append(name + " ") else sb.Append(name))
+
printVariables odef.VariableDefinitions
printDirectives odef.Directives
printSelectionSet (setSelectionSetOptions odef.SelectionSet)
@@ -208,12 +321,20 @@ type Document with
sb.Append("fragment " + fdef.Name.Value + " ")
sb.Append("on " + fdef.TypeCondition.Value + " ")
printDirectives fdef.Directives
+
if fdef.Directives.Length > 0 then sb.Append(" ")
+
printSelectionSet (setSelectionSetOptions fdef.SelectionSet)
+
match definitions with
- | [] -> ()
- | [def] -> printDefinition def
- | def :: tail -> printDefinition def; sb.AppendLine(); sb.AppendLine(); printDefinitions tail
+ | [] -> ()
+ | [ def ] -> printDefinition def
+ | def :: tail ->
+ printDefinition def
+ sb.AppendLine()
+ sb.AppendLine()
+ printDefinitions tail
+
printDefinitions x.Definitions
sb.ToString()
@@ -223,19 +344,37 @@ type Document with
member this.GetInfoMap() : Map =
let fragments =
this.Definitions
- |> List.choose (function | OperationDefinition _ -> None | FragmentDefinition def -> Some def)
+ |> List.choose (function
+ | TypeSystemDefinition _
+ | TypeSystemExtension _
+ | OperationDefinition _ -> None
+ | FragmentDefinition def -> Some def)
|> List.map (fun def -> def.Name.Value, def)
|> Map.ofList
+
let findFragment name =
match Map.tryFind name fragments with
| Some fdef -> fdef
- | None -> failwithf "Can not get information about fragment \"%s\". Fragment spread definition was not found in the query." name
+ | None ->
+ failwith
+ $"Can not get information about fragment \"%s{name}\". Fragment spread definition was not found in the query."
+
let operations =
this.Definitions
- |> List.choose (function | FragmentDefinition _ -> None | OperationDefinition def -> Some def)
+ |> List.choose (function
+ | TypeSystemDefinition _ -> None
+ | TypeSystemExtension _ -> None
+ | FragmentDefinition _ -> None
+ | OperationDefinition def -> Some def)
|> List.map (fun operation -> operation.Name, operation)
- let mapper (selectionSet : Selection list) =
- let rec helper (acc : AstSelectionInfo list) (typeCondition : string option) (path : string list) (selectionSet : Selection list) =
+
+ let mapper (selectionSet: Selection list) =
+ let rec helper
+ (acc: AstSelectionInfo list)
+ (typeCondition: string option)
+ (path: string list)
+ (selectionSet: Selection list)
+ =
match selectionSet with
| [] -> acc
| selection :: tail ->
@@ -243,17 +382,18 @@ type Document with
match selection with
| Field f ->
let finfo = AstSelectionInfo.Create(typeCondition, path, f.Name, f.Alias)
+
let fields = helper [] None (f.AliasOrName :: path) f.SelectionSet
+
finfo.SetFields(fields)
finfo :: acc
| FragmentSpread f ->
let fdef = findFragment f.Name
helper acc fdef.TypeCondition path fdef.SelectionSet
- | InlineFragment fdef ->
- helper acc fdef.TypeCondition path fdef.SelectionSet
+ | InlineFragment fdef -> helper acc fdef.TypeCondition path fdef.SelectionSet
+
helper acc typeCondition path tail
- helper [] None [] selectionSet
- |> List.map AstFieldInfo.Create
- operations
- |> List.map (fun (n, o) -> n, mapper o.SelectionSet)
- |> Map.ofList
+
+ helper [] None [] selectionSet |> List.map AstFieldInfo.Create
+
+ operations |> List.map (fun (n, o) -> n, mapper o.SelectionSet) |> Map.ofList
diff --git a/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj b/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj
index 2a5441633..47a4e51f3 100644
--- a/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj
+++ b/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj
@@ -1,10 +1,37 @@
-
+
+
netstandard2.0
true
+ true
+
+ Shared library for FSharp.Data.GraphQL.Server and FSharp.Data.GraphQL.Cient
+
+
+
+
+
+ <_Parameter1>FSharp.Data.GraphQL.Server
+
+
+ <_Parameter1>FSharp.Data.GraphQL.Client
+
+
+ <_Parameter1>FSharp.Data.GraphQL.Client.DesignTime
+
+
+ <_Parameter1>FSharp.Data.GraphQL.Tests
+
+
+
+
+
+
+
-
@@ -19,7 +46,5 @@
-
-
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj.paket.template b/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj.paket.template
deleted file mode 100644
index f9e667c14..000000000
--- a/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj.paket.template
+++ /dev/null
@@ -1,21 +0,0 @@
-type project
-id FSharp.Data.GraphQL.Shared
-authors Bazinga Technologies Inc
-projectUrl https://github.com/bazingatechnologies/FSharp.Data.GraphQL
-licenseUrl https://github.com/bazingatechnologies/FSharp.Data.GraphQL/blob/dev/LICENSE.txt
-requireLicenseAcceptance false
-copyright Copyright (c) 2016 Bazinga Technologies Inc
-tags
- FSharp GraphQL Relay React Middleware
-summary
- Shared library for FSharp.Data.GraphQL.Server and FSharp.Data.GraphQL.Cient
-description
- Shared library for FSharp.Data.GraphQL.Server and FSharp.Data.GraphQL.Cient
-dependencies
- framework: netstandard2.0
- FParsec >= LOCKEDVERSION-Common
- FSharp.Core >= LOCKEDVERSION-Common
-references
- FSharp.Data.GraphQL.Shared.dll
-files
- bin/Release/netstandard2.0/FSharp.Data.GraphQL.Shared.dll ==> lib/netstandard2.0
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Shared/Introspection.fs b/src/FSharp.Data.GraphQL.Shared/Introspection.fs
index 296d0cc2e..a07d03adb 100644
--- a/src/FSharp.Data.GraphQL.Shared/Introspection.fs
+++ b/src/FSharp.Data.GraphQL.Shared/Introspection.fs
@@ -4,6 +4,7 @@ module FSharp.Data.GraphQL.Introspection
#nowarn "40"
+open FSharp.Data.GraphQL.Ast
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Types.Introspection
open FSharp.Data.GraphQL.Extensions
diff --git a/src/FSharp.Data.GraphQL.Shared/Parser.fs b/src/FSharp.Data.GraphQL.Shared/Parser.fs
index be4051e91..05fc75071 100644
--- a/src/FSharp.Data.GraphQL.Shared/Parser.fs
+++ b/src/FSharp.Data.GraphQL.Shared/Parser.fs
@@ -4,6 +4,8 @@
module FSharp.Data.GraphQL.Parser
+#nowarn "3370" // https://github.com/fsharp/fslang-design/blob/main/FSharp-6.0/FS-1111-refcell-op-information-messages.md
+
open FSharp.Data.GraphQL.Ast
open System
open FParsec
@@ -11,311 +13,469 @@ open FParsec
[]
module internal Internal =
- // 2.1.7 Ignored tokens
- let ignored =
- // 2.1.2 WhiteSpace
- // Horizontal Tab (U+0009) | Space (U+0020)
- let whiteSpace = skipAnyOf [|'\u0009'; '\u000B'; '\u000C'; '\u0020'; '\u00A0'|]
-
- // 2.1.3 LineTerminator
- // New Line (U+000A)
- // Carriage Return (U+000D)New Line (U+000A) | (U+000D)New Line (U+000A)
- let lineTerminators = skipAnyOf [|'\u000A'; '\u000D'; '\u2028'; '\u2029'|]
-
- // 2.1.4 CommentChar
- // SourceCharacter but not LineTerminator
- let comments = pchar '#' >>. skipManyTill anyChar (lineTerminators <|> eof)
-
- // 2.1.5 Comma (Insignificant)
- let comma = skipChar ','
-
- whiteSpace <|> lineTerminators <|> comments <|> comma > "Ignored"
-
- // ignore zero or more whitespaces
- let whitespaces = many ignored |>> ignore
-
-
- // lexical token are indivisible terminal symbols
- let token p = p .>> notFollowedBy (letter <|> digit <|> pchar '_')
- let stoken = pstring >> token
- let token_ws p = token p .>> whitespaces
- let stoken_ws = pstring >> token_ws
- let ctoken_ws = pchar >> token_ws
-
- // helpers to format parser results
- let someOrEmpty = function | Some lst -> lst | None -> []
- let charsToString = Array.ofList >> String
-
- // parse one items between two char punctuators
- let betweenChars left right p =
- (pchar left .>> whitespaces) >>. p .>> (whitespaces .>> pchar right)
-
- // parse one or more items ignoring inconsequential whitespace
- let betweenCharsMany1 left right p =
- between (pchar left .>> whitespaces) (pchar right) (sepEndBy1 p whitespaces)
-
- // parse zero or more items ignoring inconsequential whitespace
- let betweenCharsMany left right p =
- between (pchar left .>> whitespaces) (pchar right) (sepEndBy p whitespaces)
-
- // run the key, seperator, then value parsers while ignoring inconsequential whitespaces
- let pairBetween seperator key value =
- (key .>> whitespaces) .>>. ((pchar seperator .>> whitespaces) >>. value)
-
-
- // 2.9 Input Values
- // forward ref since value is recursive in the case of lists and objects
- let inputValue, inputValueRef = createParserForwardedToRef()
-
-
- // 2.1.9 Names (ASCII only)
- // /[_A-Za-z][_0-9A-Za-z]*/
- let name =
- let isIdentifierFirstChar c = isAsciiLetter c || c = '_'
- let isIdentifierChar c = isAsciiLetter c || isDigit c || c = '_'
- many1Satisfy2 isIdentifierFirstChar isIdentifierChar
-
- // 2.9.4 StringValue
- let stringValue =
- let escapedCharacter =
- let escaped = anyOf [| '"'; '\\'; '/'; 'b'; 'f'; 'n'; 'r'; 't' |]
- |>> function | 'b' -> '\b' | 'f' -> '\u000C' | 'n' -> '\n'
- | 'r' -> '\r' | 't' -> '\t' | c -> c
- let unicode =
- pchar 'u' >>. pipe4 hex hex hex hex (fun h3 h2 h1 h0 ->
- let hex2int c = (int c &&& 15) + (int c >>> 6)*9
- (hex2int h3)*4096 + (hex2int h2)*256 + (hex2int h1)*16 + hex2int h0 |> char)
- pchar '\\' >>. (escaped <|> unicode)
-
- let normalCharacter = noneOf [|'\u000A';'\u000D';'\u2028';'\u2029';'"';'\''|]
- let quote = pchar '"'
-
- between quote quote (manyChars (escapedCharacter <|> normalCharacter))
-
-
- // 2.9.3 Boolean value
- // one of true false
- let booleanValue =
- choice [ stoken "true" >>% true
- stoken "false" >>% false ]
-
-
- // Integer Part
- // (NegativeSign opt) 0
- // (NegativeSign opt) NonZeroDigit (Digit list opt)
- let integerPart =
- let negativeSign = pchar '-'
- let nonZeroDigit = anyOf [|'1';'2';'3';'4';'5';'6';'7';'8';'9'|]
- let zero = pchar '0'
- let zeroInteger = opt negativeSign >>. zero >>% "0"
- let nonZeroInteger = opt negativeSign .>>. (many1Chars2 nonZeroDigit digit)
- |>> function | (Some _, v) -> "-" + v
- | (None, v) -> v
- (attempt zeroInteger) <|> nonZeroInteger
-
-
- // 2.9.1 IntValue
- // IntegerPart
- let integerValue = integerPart |>> int64
-
-
- // 2.9.2 FloatValue
- // IntegerPart FractionalPart
- // IntegerPart ExponentPart
- // IntegerPart FractionalPart ExponentPart
- let floatValue =
- let exponentPart =
- let sign = pchar '+' <|> pchar '-'
- let exponentIndicator = pchar 'e' <|> pchar 'E'
-
- pipe3 exponentIndicator (opt sign) (many1 digit)
- (fun exp sign digits ->
- charsToString (match sign with
- | Some sign -> exp::sign::digits
- | None -> exp::digits ))
-
- let fractionPart =
- pchar '.' .>>. (many1 digit)
- |>> (fun (dot, digits) -> charsToString(dot::digits))
-
- choice [
- integerPart .>>. (exponentPart <|> fractionPart) |>> fun(p1, p2)-> p1 + p2
- pipe3 integerPart fractionPart exponentPart
- (fun integer fraction exponent -> integer + fraction + exponent ) ] |>> float
-
- // 2.9.5 Null Value
- let nullValue = stoken "null" >>% NullValue
-
- // 2.9.6 Enum Value
- // Name but not true or false or null
- // (boolean parser is run first)
- let enumValue = name
-
-
- // 2.10 Variable
- // $ Name
- let variable = pchar '$' >>. name
-
-
- // 2.9.8 Input Object Values
- let inputObject =
- betweenCharsMany '{' '}' (pairBetween ':' name inputValue > "ObjectField")
- |>> Map.ofList
-
- // 2.9.7 List Value
- let listValue =
- betweenCharsMany '[' ']' (token_ws inputValue > "Value")
-
-
- // 2.9 Value
- // Variable|IntValue|FloatValue|StringValue|
- // BooleanValue|NullValue|EnumValue|ListValue|ObjectValue
- inputValueRef :=
- choice [ variable |>> Variable > "Variable"
- (attempt floatValue) |>> FloatValue > "Float"
- integerValue |>> IntValue > "Integer"
- stringValue |>> StringValue > "String"
- (attempt booleanValue) |>> BooleanValue > "Boolean"
- nullValue
- enumValue |>> EnumValue > "Enum"
- inputObject |>> ObjectValue > "InputObject"
- listValue |>> ListValue > "ListValue" ]
-
-
- // 2.6 Arguments
- // Argument list
- let arguments =
- // Argument
- // Name:Value
- let argument =
- pairBetween ':' name inputValue
- |>> fun (name, value) -> { Argument.Name = name; Value = value }
- > "Argument"
- betweenCharsMany '(' ')' argument > "Arguments"
-
-
- // 2.1.2 Directives
- // Directive list
- let directives =
- // Directive
- // @ Name (Arguments opt)
- let directive =
- pchar '@' >>. (name .>> whitespaces) .>>. (opt arguments)
- |>> fun (name, args) -> { Directive.Name = name; Arguments = someOrEmpty args}
- > "Directive"
- sepEndBy directive whitespaces > "Directives"
-
-
- // 2.11 Type
- // |NamedType|ListType|NonNullType
- let inputType, inputTypeRef = createParserForwardedToRef()
- let namedType = name |>> NamedType > "NamedType"
- let listType =
- betweenChars '[' ']' inputType
- |>> ListType > "ListType"
- let nonNullType =
- (listType <|> namedType) .>> pchar '!'
- |>> NonNullType > "NonNullType"
- inputTypeRef :=
- choice [ attempt nonNullType
- namedType
- listType ]
-
-
- // 2.4 Selection Sets
- // Selection list
- let selection, selectionRef = createParserForwardedToRef()
- let selectionSet, selectionSetRef = createParserForwardedToRef()
-
-
- // 2.5 Fields
- // (Alias opt) Name (Arguments opt) (Directives opt) (SelectionSet opt)
- let field =
- let alias = token_ws name .>> pchar ':' .>> whitespaces
- pipe5 (opt(attempt alias)) (token_ws name) (opt(token_ws arguments)) (opt directives) (opt selectionSet)
- (fun oalias name oargs directives oselection ->
- (Field { Alias = oalias; Name = name; Arguments = someOrEmpty oargs;
- Directives = someOrEmpty directives; SelectionSet = match oselection with None -> [] | Some s -> s }))
- > "Field"
-
-
- // 2.8 Fragments
- // FragmentSpread|FragmentDefinition|FragmentName
- let selectionFragment =
- let inlineFragment =
- pipe3 (opt(stoken_ws "on" >>. token_ws name)) (opt(token_ws directives)) selectionSet
- (fun typeCondition directives selectionSet ->
- { FragmentDefinition.Name = None
- Directives = someOrEmpty directives
- SelectionSet = selectionSet
- TypeCondition = typeCondition })
- |>> InlineFragment > "InlineFragment"
-
- let fragmentSpread =
- token_ws name .>>. opt directives
- |>> fun (name, directives) -> { FragmentSpread.Name = name; Directives = someOrEmpty directives }
- |>> FragmentSpread > "FragmentSpread"
-
- pstring "..." .>> whitespaces >>. (inlineFragment <|> fragmentSpread) > "Fragment"
-
- selectionRef :=
- field <|> selectionFragment > "Selection"
-
- selectionSetRef :=
- betweenCharsMany1 '{' '}' selection > "SelectionSet"
-
-
- // 2.3 Operations
- // OperationDefinition List
- let definitions =
- let operationType =
- (stoken_ws "query" >>% Query) <|> (stoken_ws "mutation" >>% Mutation) <|> (stoken_ws "subscription" >>% Subscription)
-
- let operationDefinition =
- let variableDefinition =
- pipe2 (pairBetween ':' variable inputType) (whitespaces >>. opt((ctoken_ws '=') >>. inputValue))
- (fun (variableName, variableType) defaultVal ->
- { VariableName = variableName; Type = variableType
- DefaultValue = defaultVal })
- let variableDefinitions =
- betweenCharsMany '(' ')' variableDefinition
-
- pipe5 operationType (opt(token_ws name)) (opt(token_ws variableDefinitions)) (opt(token_ws directives)) (token_ws selectionSet)
- (fun otype name ovars directives selection ->
- { OperationType = otype; Name = name; SelectionSet = selection
- VariableDefinitions = someOrEmpty ovars; Directives = someOrEmpty directives })
-
- // Short hand format where operation defaults to a Query
- let shortHandQueryDefinition =
- selectionSet |>> (fun selectionSet ->
- { OperationType = Query; SelectionSet = selectionSet;
- VariableDefinitions = []; Directives = []; Name = None })
-
- // SelectionSet |
- // (OperationType (Name opt) (VariableDefinitions opt) (Directives opt) SelectionSet)
- let operationDefinition =
- shortHandQueryDefinition <|> operationDefinition |>> OperationDefinition
-
- let fragmentDefinition =
- pipe4 ((stoken_ws "fragment") >>. token_ws name .>> (stoken_ws "on")) (token_ws name) directives selectionSet
- (fun name typeCond directives selSet ->
- FragmentDefinition
- { Name = Some name; Directives = directives; SelectionSet = selSet
- TypeCondition = if String.IsNullOrEmpty typeCond then None else Some typeCond })
-
- // GraphQL documents can contain zero definitions
- sepEndBy (operationDefinition <|> fragmentDefinition) whitespaces
-
-
- // 2.2 Document
- // Definitionlist
- let documents =
- whitespaces >>. definitions .>> (skipMany ignored <|> eof)
- |>> (fun definitions -> { Document.Definitions = definitions })
+ // 2.1.7 Ignored tokens
+ let ignored =
+ // 2.1.2 WhiteSpace
+ // Horizontal Tab (U+0009) | Space (U+0020)
+ let whiteSpace =
+ skipAnyOf [| '\u0009'
+ '\u000B'
+ '\u000C'
+ '\u0020'
+ '\u00A0' |]
+
+ // 2.1.3 LineTerminator
+ // New Line (U+000A)
+ // Carriage Return (U+000D)New Line (U+000A) | (U+000D)New Line (U+000A)
+ let lineTerminators =
+ skipAnyOf [| '\u000A'
+ '\u000D'
+ '\u2028'
+ '\u2029' |]
+
+ // 2.1.4 CommentChar
+ // SourceCharacter but not LineTerminator
+ let comments =
+ pchar '#'
+ >>. skipManyTill anyChar (lineTerminators <|> eof)
+
+ // 2.1.5 Comma (Insignificant)
+ let comma = skipChar ','
+
+ whiteSpace
+ <|> lineTerminators
+ <|> comments
+ <|> comma
+ > "Ignored"
+
+ // ignore zero or more whitespaces
+ let whitespaces = many ignored |>> ignore
+
+
+ // lexical token are indivisible terminal symbols
+ let token p =
+ p
+ .>> notFollowedBy (letter <|> digit <|> pchar '_')
+
+ let stoken = pstring >> token
+ let token_ws p = token p .>> whitespaces
+ let stoken_ws = pstring >> token_ws
+ let ctoken_ws = pchar >> token_ws
+
+ // helpers to format parser results
+ let someOrEmpty =
+ function
+ | Some lst -> lst
+ | None -> []
+
+ let charsToString = Array.ofList >> String
+
+ // parse one items between two char punctuators
+ let betweenChars left right p =
+ (pchar left .>> whitespaces) >>. p
+ .>> (whitespaces .>> pchar right)
+
+ // parse one or more items ignoring inconsequential whitespace
+ let betweenCharsMany1 left right p =
+ between (pchar left .>> whitespaces) (pchar right) (sepEndBy1 p whitespaces)
+
+ // parse zero or more items ignoring inconsequential whitespace
+ let betweenCharsMany left right p =
+ between (pchar left .>> whitespaces) (pchar right) (sepEndBy p whitespaces)
+
+ // run the key, seperator, then value parsers while ignoring inconsequential whitespaces
+ let pairBetween seperator key value =
+ (key .>> whitespaces)
+ .>>. ((pchar seperator .>> whitespaces) >>. value)
+
+
+ // 2.9 Input Values
+ // forward ref since value is recursive in the case of lists and objects
+ let inputValue, inputValueRef =
+ createParserForwardedToRef ()
+
+
+ // 2.1.9 Names (ASCII only)
+ // /[_A-Za-z][_0-9A-Za-z]*/
+ let name =
+ let isIdentifierFirstChar c = isAsciiLetter c || c = '_'
+ let isIdentifierChar c = isAsciiLetter c || isDigit c || c = '_'
+ many1Satisfy2 isIdentifierFirstChar isIdentifierChar
+
+ // 2.9.4 StringValue
+ let stringValue =
+ let escapedCharacter =
+ let escaped =
+ anyOf [| '"'
+ '\\'
+ '/'
+ 'b'
+ 'f'
+ 'n'
+ 'r'
+ 't' |]
+ |>> function
+ | 'b' -> '\b'
+ | 'f' -> '\u000C'
+ | 'n' -> '\n'
+ | 'r' -> '\r'
+ | 't' -> '\t'
+ | c -> c
+
+ let unicode =
+ pchar 'u'
+ >>. pipe4 hex hex hex hex (fun h3 h2 h1 h0 ->
+ let hex2int c = (int c &&& 15) + (int c >>> 6) * 9
+
+ (hex2int h3) * 4096
+ + (hex2int h2) * 256
+ + (hex2int h1) * 16
+ + hex2int h0
+ |> char)
+
+ pchar '\\' >>. (escaped <|> unicode)
+
+ let normalCharacter =
+ noneOf [| '\u000A'
+ '\u000D'
+ '\u2028'
+ '\u2029'
+ '"'
+ '\'' |]
+
+ let quote = pchar '"'
+
+ between quote quote (manyChars (escapedCharacter <|> normalCharacter))
+
+
+ // 2.9.3 Boolean value
+ // one of true false
+ let booleanValue =
+ choice [ stoken "true" >>% true
+ stoken "false" >>% false ]
+
+
+ // Integer Part
+ // (NegativeSign opt) 0
+ // (NegativeSign opt) NonZeroDigit (Digit list opt)
+ let integerPart =
+ let negativeSign = pchar '-'
+
+ let nonZeroDigit =
+ anyOf [| '1'
+ '2'
+ '3'
+ '4'
+ '5'
+ '6'
+ '7'
+ '8'
+ '9' |]
+
+ let zero = pchar '0'
+
+ let zeroInteger =
+ opt negativeSign >>. zero >>% "0"
+
+ let nonZeroInteger =
+ opt negativeSign
+ .>>. (many1Chars2 nonZeroDigit digit)
+ |>> function
+ | Some _, v -> "-" + v
+ | None, v -> v
+
+ (attempt zeroInteger) <|> nonZeroInteger
+
+
+ // 2.9.1 IntValue
+ // IntegerPart
+ let integerValue = integerPart |>> int64
+
+
+ // 2.9.2 FloatValue
+ // IntegerPart FractionalPart
+ // IntegerPart ExponentPart
+ // IntegerPart FractionalPart ExponentPart
+ let floatValue =
+ let exponentPart =
+ let sign = pchar '+' <|> pchar '-'
+
+ let exponentIndicator =
+ pchar 'e' <|> pchar 'E'
+
+ pipe3 exponentIndicator (opt sign) (many1 digit) (fun exp sign digits ->
+ charsToString (
+ match sign with
+ | Some sign -> exp :: sign :: digits
+ | None -> exp :: digits
+ ))
+
+ let fractionPart =
+ pchar '.' .>>. (many1 digit)
+ |>> (fun (dot, digits) -> charsToString (dot :: digits))
+
+ choice [ integerPart .>>. (exponentPart <|> fractionPart)
+ |>> fun (p1, p2) -> p1 + p2
+ pipe3 integerPart fractionPart exponentPart (fun integer fraction exponent -> integer + fraction + exponent) ]
+ |>> float
+
+ // 2.9.5 Null Value
+ let nullValue = stoken "null" >>% NullValue
+
+ // 2.9.6 Enum Value
+ // Name but not true or false or null
+ // (boolean parser is run first)
+ let enumValue = name
+
+
+ // 2.10 Variable
+ // $ Name
+ let variable = pchar '$' >>. name
+
+
+ // 2.9.8 Input Object Values
+ let inputObject =
+ betweenCharsMany '{' '}' (pairBetween ':' name inputValue > "ObjectField")
+ |>> Map.ofList
+
+ // 2.9.7 List Value
+ let listValue =
+ betweenCharsMany '[' ']' (token_ws inputValue > "Value")
+
+
+ // 2.9 Value
+ // Variable|IntValue|FloatValue|StringValue|
+ // BooleanValue|NullValue|EnumValue|ListValue|ObjectValue
+ inputValueRef
+ := choice [ variable |>> Variable > "Variable"
+ (attempt floatValue) |>> FloatValue > "Float"
+ integerValue |>> IntValue > "Integer"
+ stringValue |>> StringValue > "String"
+ (attempt booleanValue) |>> BooleanValue
+ > "Boolean"
+ nullValue
+ enumValue |>> EnumValue > "Enum"
+ inputObject |>> ObjectValue > "InputObject"
+ listValue |>> ListValue > "ListValue" ]
+
+
+ // 2.6 Arguments
+ // Argument list
+ let arguments =
+ // Argument
+ // Name:Value
+ let argument =
+ pairBetween ':' name inputValue
+ |>> fun (name, value) -> { Argument.Name = name; Value = value }
+ > "Argument"
+
+ betweenCharsMany '(' ')' argument > "Arguments"
+
+
+ // 2.1.2 Directives
+ // Directive list
+ let directives =
+ // Directive
+ // @ Name (Arguments opt)
+ let directive =
+ pchar '@' >>. (name .>> whitespaces)
+ .>>. (opt arguments)
+ |>> fun (name, args) ->
+ {
+ Directive.Name = name
+ Arguments = someOrEmpty args
+ }
+ > "Directive"
+
+ sepEndBy directive whitespaces > "Directives"
+
+
+ // 2.11 Type
+ // |NamedType|ListType|NonNullType
+ let inputType, inputTypeRef =
+ createParserForwardedToRef ()
+
+ let namedType =
+ name |>> NamedType > "NamedType"
+
+ let listType =
+ betweenChars '[' ']' inputType |>> ListType
+ > "ListType"
+
+ let nonNullType =
+ (listType <|> namedType) .>> pchar '!'
+ |>> NonNullNameType
+ > "NonNullType"
+
+ inputTypeRef
+ := choice [ attempt nonNullType
+ namedType
+ listType ]
+
+
+ // 2.4 Selection Sets
+ // Selection list
+ let selection, selectionRef =
+ createParserForwardedToRef ()
+
+ let selectionSet, selectionSetRef =
+ createParserForwardedToRef ()
+
+
+ // 2.5 Fields
+ // (Alias opt) Name (Arguments opt) (Directives opt) (SelectionSet opt)
+ let field =
+ let alias =
+ token_ws name .>> pchar ':' .>> whitespaces
+
+ pipe5
+ (opt (attempt alias))
+ (token_ws name)
+ (opt (token_ws arguments))
+ (opt directives)
+ (opt selectionSet)
+ (fun oalias name oargs directives oselection ->
+ (Field
+ {
+ Alias = oalias
+ Name = name
+ Arguments = someOrEmpty oargs
+ Directives = someOrEmpty directives
+ SelectionSet =
+ match oselection with
+ | None -> []
+ | Some s -> s
+ }))
+ > "Field"
+
+
+ // 2.8 Fragments
+ // FragmentSpread|FragmentDefinition|FragmentName
+ let selectionFragment =
+ let inlineFragment =
+ pipe3
+ (opt (stoken_ws "on" >>. token_ws name))
+ (opt (token_ws directives))
+ selectionSet
+ (fun typeCondition directives selectionSet ->
+ {
+ FragmentDefinition.Name = None
+ Directives = someOrEmpty directives
+ SelectionSet = selectionSet
+ TypeCondition = typeCondition
+ })
+ |>> InlineFragment
+ > "InlineFragment"
+
+ let fragmentSpread =
+ token_ws name .>>. opt directives
+ |>> fun (name, directives) ->
+ {
+ FragmentSpread.Name = name
+ Directives = someOrEmpty directives
+ }
+ |>> FragmentSpread
+ > "FragmentSpread"
+
+ pstring "..." .>> whitespaces
+ >>. (inlineFragment <|> fragmentSpread)
+ > "Fragment"
+
+ selectionRef
+ := field <|> selectionFragment > "Selection"
+
+ selectionSetRef
+ := betweenCharsMany1 '{' '}' selection
+ > "SelectionSet"
+
+
+ // 2.3 Operations
+ // OperationDefinition List
+ let definitions =
+ let operationType =
+ (stoken_ws "query" >>% Query)
+ <|> (stoken_ws "mutation" >>% Mutation)
+ <|> (stoken_ws "subscription" >>% Subscription)
+
+ let operationDefinition =
+ let variableDefinition =
+ pipe2
+ (pairBetween ':' variable inputType)
+ (whitespaces
+ >>. opt ((ctoken_ws '=') >>. inputValue))
+ (fun (variableName, variableType) defaultVal ->
+ {
+ VariableName = variableName
+ Type = variableType
+ DefaultValue = defaultVal
+ })
+
+ let variableDefinitions =
+ betweenCharsMany '(' ')' variableDefinition
+
+ pipe5
+ operationType
+ (opt (token_ws name))
+ (opt (token_ws variableDefinitions))
+ (opt (token_ws directives))
+ (token_ws selectionSet)
+ (fun otype name ovars directives selection ->
+ {
+ OperationType = otype
+ Name = name
+ SelectionSet = selection
+ VariableDefinitions = someOrEmpty ovars
+ Directives = someOrEmpty directives
+ })
+
+ // Short hand format where operation defaults to a Query
+ let shortHandQueryDefinition =
+ selectionSet
+ |>> (fun selectionSet ->
+ {
+ OperationType = Query
+ SelectionSet = selectionSet
+ VariableDefinitions = []
+ Directives = []
+ Name = None
+ })
+
+ // SelectionSet |
+ // (OperationType (Name opt) (VariableDefinitions opt) (Directives opt) SelectionSet)
+ let operationDefinition =
+ shortHandQueryDefinition <|> operationDefinition
+ |>> OperationDefinition
+
+ let fragmentDefinition =
+ pipe4
+ ((stoken_ws "fragment") >>. token_ws name
+ .>> (stoken_ws "on"))
+ (token_ws name)
+ directives
+ selectionSet
+ (fun name typeCond directives selSet ->
+ FragmentDefinition
+ {
+ Name = Some name
+ Directives = directives
+ SelectionSet = selSet
+ TypeCondition = if String.IsNullOrEmpty typeCond then None else Some typeCond
+ })
+
+ // GraphQL documents can contain zero definitions
+ sepEndBy (operationDefinition <|> fragmentDefinition) whitespaces
+
+
+ // 2.2 Document
+ // DefinitionList
+ let documents =
+ whitespaces >>. definitions
+ .>> (skipMany ignored <|> eof)
+ |>> (fun definitions -> { Document.Definitions = definitions })
/// Parses a GraphQL Document. Throws exception on invalid formats.
let parse query =
- match run documents query with
- | Success(result, _, _) -> result
- | Failure(errorMsg, _, _) -> raise (System.FormatException(errorMsg))
\ No newline at end of file
+ match run documents query with
+ | Success (result, _, _) -> result
+ | Failure (errorMsg, _, _) -> raise (FormatException(errorMsg))
diff --git a/src/FSharp.Data.GraphQL.Shared/TypeSystem.fs b/src/FSharp.Data.GraphQL.Shared/TypeSystem.fs
index df6dca4d3..9fdefc9fc 100644
--- a/src/FSharp.Data.GraphQL.Shared/TypeSystem.fs
+++ b/src/FSharp.Data.GraphQL.Shared/TypeSystem.fs
@@ -1,5 +1,6 @@
-/// The MIT License (MIT)
-/// Copyright (c) 2016 Bazinga Technologies Inc
+// The MIT License (MIT)
+// Copyright (c) 2016 Bazinga Technologies Inc
+
namespace FSharp.Data.GraphQL.Types
open System
@@ -16,35 +17,12 @@ open FSharp.Quotations.Patterns
open FSharp.Reflection
open FSharp.Linq.RuntimeHelpers
-/// Enum describing parts of the GraphQL query document AST, where
-/// related directive is valid to be used.
-[]
-type DirectiveLocation =
- | QUERY = 1
- | MUTATION = 2
- | SUBSCRIPTION = 4
- | FIELD = 8
- | FRAGMENT_DEFINITION = 16
- | FRAGMENT_SPREAD = 32
- | INLINE_FRAGMENT = 64
- | SCHEMA = 128
- | SCALAR = 256
- | OBJECT = 512
- | FIELD_DEFINITION = 1024
- | ARGUMENT_DEFINITION = 2048
- | INTERFACE = 4096
- | UNION = 8192
- | ENUM = 16384
- | ENUM_VALUE = 32768
- | INPUT_OBJECT = 65536
- | INPUT_FIELD_DEFINITION = 131072
-
module Introspection =
/// Type kind. GraphQL type system puts all types into one of eight categories.
type TypeKind =
| SCALAR = 1
- | OBJECT = 2
+ | OBJECT = 2
| INTERFACE = 3
| UNION = 4
| ENUM = 5
@@ -54,54 +32,60 @@ module Introspection =
/// Introspection descriptor of a directive (i.e. @skip(if:...), @include(if:...) etc).
type IntrospectionDirective =
- { /// Directive name.
- Name : string
- /// Description of a target directive.
- Description : string option
- /// Array of AST locations, where it's valid to place target directive.
- Locations : DirectiveLocation []
- /// Array of arguments, current directive can be parametrized with.
- Args : IntrospectionInputVal [] }
-
- /// Introspection descriptor of a GraphQL type defintion.
+ {
+ /// Directive name.
+ Name: string
+ /// Description of a target directive.
+ Description: string option
+ /// Array of AST locations, where it's valid to place target directive.
+ Locations: DirectiveLocation []
+ /// Array of arguments, current directive can be parametrized with.
+ Args: IntrospectionInputVal []
+ }
+
+ /// Introspection descriptor of a GraphQL type definition.
and IntrospectionType =
- { /// Which kind category current type belongs to.
- Kind : TypeKind
- /// Type name. Must be unique in scope of the defined schema.
- Name : string
- /// Optional type description.
- Description : string option
- /// Array of field descriptors defined within current type.
- /// Only present for Object and Interface types.
- Fields : IntrospectionField [] option
- /// Array of interfaces implemented by output object type defintion.
- Interfaces : IntrospectionTypeRef [] option
- /// Array of type references being possible implementation of current type.
- /// Only present for Union types (list of union cases) and Interface types
- /// (list of all objects implementing interface in scope of the schema).
- PossibleTypes : IntrospectionTypeRef [] option
- /// Array of enum values defined by current Enum type.
- EnumValues : IntrospectionEnumVal [] option
- /// Array of input fields defined by current InputObject type.
- InputFields : IntrospectionInputVal [] option
- /// Type param reference - used only by List and NonNull types.
- OfType : IntrospectionTypeRef option }
+ {
+ /// Which kind category current type belongs to.
+ Kind: TypeKind
+ /// Type name. Must be unique in scope of the defined schema.
+ Name: string
+ /// Optional type description.
+ Description: string option
+ /// Array of field descriptors defined within current type.
+ /// Only present for Object and Interface types.
+ Fields: IntrospectionField [] option
+ /// Array of interfaces implemented by output object type definition.
+ Interfaces: IntrospectionTypeRef [] option
+ /// Array of type references being possible implementation of current type.
+ /// Only present for Union types (list of union cases) and Interface types
+ /// (list of all objects implementing interface in scope of the schema).
+ PossibleTypes: IntrospectionTypeRef [] option
+ /// Array of enum values defined by current Enum type.
+ EnumValues: IntrospectionEnumVal [] option
+ /// Array of input fields defined by current InputObject type.
+ InputFields: IntrospectionInputVal [] option
+ /// Type param reference - used only by List and NonNull types.
+ OfType: IntrospectionTypeRef option
+ }
///
/// Constructs an introspection descriptor for a types.
///
/// Type name (unique in the scope of current schema).
/// Optional type description.
- static member Scalar(name : string, description : string option) =
- { Kind = TypeKind.SCALAR
- Name = name
- Description = description
- Fields = None
- Interfaces = None
- PossibleTypes = None
- EnumValues = None
- InputFields = None
- OfType = None }
+ static member Scalar(name: string, description: string option) =
+ {
+ Kind = TypeKind.SCALAR
+ Name = name
+ Description = description
+ Fields = None
+ Interfaces = None
+ PossibleTypes = None
+ EnumValues = None
+ InputFields = None
+ OfType = None
+ }
///
/// Constructs an introspection descriptor for a types.
@@ -110,17 +94,24 @@ module Introspection =
/// Optional type description.
/// Array of fields defined in current object.
/// Array of interfaces, current object implements.
- static member Object(name : string, description : string option, fields : IntrospectionField [],
- interfaces : IntrospectionTypeRef []) =
- { Kind = TypeKind.OBJECT
- Name = name
- Description = description
- Fields = Some fields
- Interfaces = Some interfaces
- PossibleTypes = None
- EnumValues = None
- InputFields = None
- OfType = None }
+ static member Object
+ (
+ name: string,
+ description: string option,
+ fields: IntrospectionField [],
+ interfaces: IntrospectionTypeRef []
+ ) =
+ {
+ Kind = TypeKind.OBJECT
+ Name = name
+ Description = description
+ Fields = Some fields
+ Interfaces = Some interfaces
+ PossibleTypes = None
+ EnumValues = None
+ InputFields = None
+ OfType = None
+ }
///
/// Constructs an introspection descriptor for a types.
@@ -128,16 +119,18 @@ module Introspection =
/// Type name (unique in the scope of current schema).
/// Optional type description.
/// Array of input fields defined in current input object.
- static member InputObject(name : string, description : string option, inputFields : IntrospectionInputVal []) =
- { Kind = TypeKind.INPUT_OBJECT
- Name = name
- Description = description
- Fields = None
- Interfaces = None
- PossibleTypes = None
- EnumValues = None
- InputFields = Some inputFields
- OfType = None }
+ static member InputObject(name: string, description: string option, inputFields: IntrospectionInputVal []) =
+ {
+ Kind = TypeKind.INPUT_OBJECT
+ Name = name
+ Description = description
+ Fields = None
+ Interfaces = None
+ PossibleTypes = None
+ EnumValues = None
+ InputFields = Some inputFields
+ OfType = None
+ }
///
/// Constructs an introspection descriptor for a types.
@@ -145,16 +138,18 @@ module Introspection =
/// Type name (unique in the scope of current schema).
/// Optional type description.
/// Array of union case types. They can be any type defined in GraphQL schema.
- static member Union(name : string, description : string option, possibleTypes : IntrospectionTypeRef []) =
- { Kind = TypeKind.UNION
- Name = name
- Description = description
- Fields = None
- Interfaces = None
- PossibleTypes = Some possibleTypes
- EnumValues = None
- InputFields = None
- OfType = None }
+ static member Union(name: string, description: string option, possibleTypes: IntrospectionTypeRef []) =
+ {
+ Kind = TypeKind.UNION
+ Name = name
+ Description = description
+ Fields = None
+ Interfaces = None
+ PossibleTypes = Some possibleTypes
+ EnumValues = None
+ InputFields = None
+ OfType = None
+ }
///
/// Constructs an introspection descriptor for a types.
@@ -162,16 +157,18 @@ module Introspection =
/// Type name (unique in the scope of current schema).
/// Optional type description.
/// Array of enum value descriptors.
- static member Enum(name : string, description : string option, enumValues : IntrospectionEnumVal []) =
- { Kind = TypeKind.ENUM
- Name = name
- Description = description
- Fields = None
- Interfaces = None
- PossibleTypes = None
- EnumValues = Some enumValues
- InputFields = None
- OfType = None }
+ static member Enum(name: string, description: string option, enumValues: IntrospectionEnumVal []) =
+ {
+ Kind = TypeKind.ENUM
+ Name = name
+ Description = description
+ Fields = None
+ Interfaces = None
+ PossibleTypes = None
+ EnumValues = Some enumValues
+ InputFields = None
+ OfType = None
+ }
///
/// Constructs an introspection descriptor for a types.
@@ -180,132 +177,158 @@ module Introspection =
/// Optional type description.
/// Array of fields being part of the interface contract.
/// Array of schema objects implementing target interface.
- static member Interface(name : string, description : string option, fields : IntrospectionField [],
- possibleTypes : IntrospectionTypeRef []) =
- { Kind = TypeKind.INTERFACE
- Name = name
- Description = description
- Fields = Some fields
- Interfaces = None
- PossibleTypes = Some possibleTypes
- EnumValues = None
- InputFields = None
- OfType = None }
+ static member Interface
+ (
+ name: string,
+ description: string option,
+ fields: IntrospectionField [],
+ possibleTypes: IntrospectionTypeRef []
+ ) =
+ {
+ Kind = TypeKind.INTERFACE
+ Name = name
+ Description = description
+ Fields = Some fields
+ Interfaces = None
+ PossibleTypes = Some possibleTypes
+ EnumValues = None
+ InputFields = None
+ OfType = None
+ }
/// Introspection type reference. Used to navigate between type dependencies inside introspected schema.
and IntrospectionTypeRef =
- { /// Referenced type kind.
- Kind : TypeKind
- /// Type name. None if referenced type is List or NonNull.
- Name : string option
- /// Optional type description.
- Description : string option
- /// Type param reference. Used only by List and NonNull types.
- OfType : IntrospectionTypeRef option }
+ {
+ /// Referenced type kind.
+ Kind: TypeKind
+ /// Type name. None if referenced type is List or NonNull.
+ Name: string option
+ /// Optional type description.
+ Description: string option
+ /// Type param reference. Used only by List and NonNull types.
+ OfType: IntrospectionTypeRef option
+ }
///
/// Constructs an introspection type reference for List types.
///
/// Type reference for type used as List's type param.
- static member List(inner : IntrospectionTypeRef) =
- { Kind = TypeKind.LIST
- Name = None
- Description = None
- OfType = Some inner }
+ static member List(inner: IntrospectionTypeRef) =
+ {
+ Kind = TypeKind.LIST
+ Name = None
+ Description = None
+ OfType = Some inner
+ }
///
/// Constructs an introspection type reference for NonNull types.
///
/// Type reference for type used as NonNull's type param.
- static member NonNull(inner : IntrospectionTypeRef) =
- { Kind = TypeKind.NON_NULL
- Name = None
- Description = None
- OfType = Some inner }
+ static member NonNull(inner: IntrospectionTypeRef) =
+ {
+ Kind = TypeKind.NON_NULL
+ Name = None
+ Description = None
+ OfType = Some inner
+ }
///
- /// Constructs an introspection type reference for any named type defintion
+ /// Constructs an introspection type reference for any named type definition
/// (any type other than List or NonNull) with unique name included.
///
/// Introspection type descriptor to construct reference from.
- static member Named(inner : IntrospectionType) =
- { Kind = inner.Kind
- Name = Some inner.Name
- Description = inner.Description
- OfType = None }
+ static member Named(inner: IntrospectionType) =
+ {
+ Kind = inner.Kind
+ Name = Some inner.Name
+ Description = inner.Description
+ OfType = None
+ }
/// Introspection descriptor for input values (InputObject fields or field arguments).
and IntrospectionInputVal =
- { /// Input argument name.
- Name : string
- /// Optional input argument description.
- Description : string option
- /// Introspection reference to argument's type.
- Type : IntrospectionTypeRef
- /// Default arguments value, if provided.
- DefaultValue : string option }
+ {
+ /// Input argument name.
+ Name: string
+ /// Optional input argument description.
+ Description: string option
+ /// Introspection reference to argument's type.
+ Type: IntrospectionTypeRef
+ /// Default arguments value, if provided.
+ DefaultValue: string option
+ }
/// Introspection descriptor for enum values.
and IntrospectionEnumVal =
- { /// Enum value name - must be unique in scope of defining enum.
- Name : string
- /// Optional enum value description.
- Description : string option
- /// If true, marks current value as deprecated, but still
- /// available for compatibility reasons.
- IsDeprecated : bool
- /// If value is deprecated this field may describe a deprecation reason.
- DeprecationReason : string option }
+ {
+ /// Enum value name - must be unique in scope of defining enum.
+ Name: string
+ /// Optional enum value description.
+ Description: string option
+ /// If true, marks current value as deprecated, but still
+ /// available for compatibility reasons.
+ IsDeprecated: bool
+ /// If value is deprecated this field may describe a deprecation reason.
+ DeprecationReason: string option
+ }
/// Introspection descriptor for Object and Interface fields.
and IntrospectionField =
- { /// Field name. Must be unique in scope of the definin object/interface.
- Name : string
- /// Optional field description.
- Description : string option
- /// Array of field arguments. In GraphQL fields can be parametrized,
- /// working effectively like methods.
- Args : IntrospectionInputVal []
- /// Introspection reference to field's type.
- Type : IntrospectionTypeRef
- /// If true, marks current field as deprecated, but still
- /// available for compatibility reasons.
- IsDeprecated : bool
- /// If field is deprecated here a deprecation reason may be set.
- DeprecationReason : string option }
+ {
+ /// Field name. Must be unique in scope of the definin object/interface.
+ Name: string
+ /// Optional field description.
+ Description: string option
+ /// Array of field arguments. In GraphQL fields can be parametrized,
+ /// working effectively like methods.
+ Args: IntrospectionInputVal []
+ /// Introspection reference to field's type.
+ Type: IntrospectionTypeRef
+ /// If true, marks current field as deprecated, but still
+ /// available for compatibility reasons.
+ IsDeprecated: bool
+ /// If field is deprecated here a deprecation reason may be set.
+ DeprecationReason: string option
+ }
/// Introspection descriptor for target schema. Contains informations about
/// all types defined within current schema.
and IntrospectionSchema =
- { /// Introspection reference to schema's query root.
- QueryType : IntrospectionTypeRef
- /// Introspection reference to schema's mutation root.
- MutationType : IntrospectionTypeRef option
- /// Introspection reference to schema's subscription root.
- SubscriptionType : IntrospectionTypeRef option
- /// Array of all introspection types defined within current schema.
- /// Includes types for queries, mutations and subscriptions.
- Types : IntrospectionType []
- /// Array of all directives supported by current schema.
- Directives : IntrospectionDirective [] }
+ {
+ /// Introspection reference to schema's query root.
+ QueryType: IntrospectionTypeRef
+ /// Introspection reference to schema's mutation root.
+ MutationType: IntrospectionTypeRef option
+ /// Introspection reference to schema's subscription root.
+ SubscriptionType: IntrospectionTypeRef option
+ /// Array of all introspection types defined within current schema.
+ /// Includes types for queries, mutations and subscriptions.
+ Types: IntrospectionType []
+ /// Array of all directives supported by current schema.
+ Directives: IntrospectionDirective []
+ }
/// Represents a subscription as described in the schema.
-type Subscription = {
- /// The name of the subscription type in the schema.
- Name : string
- /// Filter function, used to determine what events we will propagate.
- /// The first object is the boxed root value, the second is the boxed value of the input object.
- Filter : ResolveFieldContext -> obj -> obj -> Async }
+type Subscription =
+ {
+ /// The name of the subscription type in the schema.
+ Name: string
+ /// Filter function, used to determine what events we will propagate.
+ /// The first object is the boxed root value, the second is the boxed value of the input object.
+ Filter: ResolveFieldContext -> obj -> obj -> Async
+ }
/// Describes the backing implementation for a subscription system.
and ISubscriptionProvider =
interface
/// Registers a new subscription type, called at schema compilation time.
- abstract member AsyncRegister : Subscription -> Async
+ abstract member AsyncRegister: Subscription -> Async
/// Creates an active subscription, and returns the IObservable stream of POCO objects that will be projected on.
- abstract member Add : ResolveFieldContext -> obj -> SubscriptionFieldDef -> IObservable
+ abstract member Add: ResolveFieldContext -> obj -> SubscriptionFieldDef -> IObservable
/// Publishes an event to the subscription system given the identifier of the subscription type.
abstract member AsyncPublish<'T> : string -> 'T -> Async
+
/// Publishes an event to the subscription system given the identifier of the subscription type
/// and a filter identity that can be used to choose which filter functions will be applied.
abstract member AsyncPublishTag<'T> : string -> Tag -> 'T -> Async
@@ -315,13 +338,13 @@ and ISubscriptionProvider =
and ILiveFieldSubscription =
interface
/// Determine if we should propagate the event
- abstract member Filter : obj -> obj -> bool
+ abstract member Filter: obj -> obj -> bool
/// Project out the field marked with the @live directive
- abstract member Project : obj -> obj
+ abstract member Project: obj -> obj
/// The type name of the object that is ready for live query in this subscription.
- abstract member TypeName : string
+ abstract member TypeName: string
/// The field name of the object that is ready for live query in this subscription.
- abstract member FieldName : string
+ abstract member FieldName: string
end
/// Represents a generic typed, subscription field in a live query.
@@ -329,21 +352,23 @@ and ILiveFieldSubscription<'Object, 'Field> =
interface
inherit ILiveFieldSubscription
/// Determine if we should propagate the event
- abstract member Filter : 'Object -> 'Object -> bool
+ abstract member Filter: 'Object -> 'Object -> bool
/// Project out the field marked with the @live directive
- abstract member Project : 'Object -> 'Field
+ abstract member Project: 'Object -> 'Field
end
/// Represents a subscription of a field in a live query.
and LiveFieldSubscription =
- { /// Determine if we should propagate the event
- Filter : obj -> obj -> bool
- /// Project out the field marked with the @live directive
- Project : obj -> obj
- /// The type name of the object that is ready for live query in this subscription.
- TypeName : string
- /// The field name of the object that is ready for live query in this subscription.
- FieldName : string }
+ {
+ /// Determine if we should propagate the event
+ Filter: obj -> obj -> bool
+ /// Project out the field marked with the @live directive
+ Project: obj -> obj
+ /// The type name of the object that is ready for live query in this subscription.
+ TypeName: string
+ /// The field name of the object that is ready for live query in this subscription.
+ FieldName: string
+ }
interface ILiveFieldSubscription with
member this.Filter x y = this.Filter x y
member this.Project x = this.Project x
@@ -352,20 +377,23 @@ and LiveFieldSubscription =
/// Represents a generic typed, subscription field in a live query.
and LiveFieldSubscription<'Object, 'Field> =
- { /// Determine if we should propagate the event
- Filter : 'Object -> 'Object -> bool
- /// Project out the field marked with the @live directive
- Project : 'Object -> 'Field
- /// The type name of the object that is ready for live query in this subscription.
- TypeName : string
- /// The field name of the object that is ready for live query in this subscription.
- FieldName : string }
+ {
+ /// Determine if we should propagate the event
+ Filter: 'Object -> 'Object -> bool
+ /// Project out the field marked with the @live directive
+ Project: 'Object -> 'Field
+ /// The type name of the object that is ready for live query in this subscription.
+ TypeName: string
+ /// The field name of the object that is ready for live query in this subscription.
+ FieldName: string
+ }
interface ILiveFieldSubscription<'Object, 'Field> with
member this.Filter x y = this.Filter x y
member this.Project x = this.Project x
+
interface ILiveFieldSubscription with
member this.Filter x y = this.Filter (downcast x) (downcast y)
- member this.Project x = upcast this.Project (downcast x)
+ member this.Project x = upcast this.Project(downcast x)
member this.TypeName = this.TypeName
member this.FieldName = this.FieldName
@@ -373,15 +401,15 @@ and LiveFieldSubscription<'Object, 'Field> =
and ILiveFieldSubscriptionProvider =
interface
/// Checks if a live field subscription has subscribers.
- abstract member HasSubscribers : string -> string -> bool
+ abstract member HasSubscribers: string -> string -> bool
/// Checks if a type and a field is registered in the provider.
- abstract member IsRegistered : string -> string -> bool
+ abstract member IsRegistered: string -> string -> bool
/// Registers a new live query subscription type, called at schema compilation time.
- abstract member AsyncRegister : ILiveFieldSubscription -> Async
+ abstract member AsyncRegister: ILiveFieldSubscription -> Async
/// Tries to find a subscription based on the type name and field name.
- abstract member TryFind : string -> string -> ILiveFieldSubscription option
+ abstract member TryFind: string -> string -> ILiveFieldSubscription option
/// Creates an active subscription, and returns the IObservable stream of projected POCO objects
- abstract member Add : (obj -> bool) -> string -> string -> IObservable
+ abstract member Add: (obj -> bool) -> string -> string -> IObservable
/// Publishes an event to the subscription system, given the key of the subscription type.
abstract member AsyncPublish<'T> : string -> string -> 'T -> Async
end
@@ -393,60 +421,60 @@ and ISchema =
inherit seq
/// Map of defined types by their names.
- abstract TypeMap : TypeMap
+ abstract TypeMap: TypeMap
/// A query root object. Defines all top level fields,
/// that can be accessed from GraphQL queries.
- abstract Query : ObjectDef
+ abstract Query: ObjectDef
/// A mutation root object. Defines all top level operations,
/// that can be performed from GraphQL mutations.
- abstract Mutation : ObjectDef option
+ abstract Mutation: ObjectDef option
// A subscription root object. Defines all top level operations,
// that can be performed from GraphQL subscriptions.
- abstract Subscription : SubscriptionObjectDef option
+ abstract Subscription: SubscriptionObjectDef option
/// List of all directives supported by the current schema.
- abstract Directives : DirectiveDef []
+ abstract Directives: DirectiveDefinition []
/// Method which, given type name, returns Some if provided
/// type has been defined in current schema. Otherwise None.
- abstract TryFindType : string -> NamedDef option
+ abstract TryFindType: string -> NamedDef option
/// Returns array of all possible types for provided abstract
/// type. For Union types, it's the array of all union options.
/// For Interface types, it's an array of all types - within
/// schema - implementing target interface.
- abstract GetPossibleTypes : TypeDef -> ObjectDef []
+ abstract GetPossibleTypes: TypeDef -> ObjectDef []
/// Checks if provided object is a possible type type (case
/// for Unions and implementation for Interfaces) of provided
/// abstract type.
- abstract IsPossibleType : AbstractDef -> ObjectDef -> bool
+ abstract IsPossibleType: AbstractDef -> ObjectDef -> bool
/// Returns an introspected representation of current schema.
- abstract Introspected : Introspection.IntrospectionSchema
+ abstract Introspected: Introspection.IntrospectionSchema
/// Returns a function called when errors occurred during query execution.
/// It's used to retrieve messages shown as output to the client.
/// May be also used to log messages before returning them.
- abstract ParseError : exn -> string
+ abstract ParseError: exn -> string
/// Returns the subscription provider implementation for this schema.
- abstract SubscriptionProvider : ISubscriptionProvider
+ abstract SubscriptionProvider: ISubscriptionProvider
/// Returns the live query subscription provider implementation for this schema.
- abstract LiveFieldSubscriptionProvider : ILiveFieldSubscriptionProvider
-
+ abstract LiveFieldSubscriptionProvider: ILiveFieldSubscriptionProvider
end
+
and ISchema<'Root> =
interface
inherit ISchema
- abstract Query : ObjectDef<'Root>
- abstract Mutation : ObjectDef<'Root> option
- abstract Subscription : SubscriptionObjectDef<'Root> option
+ abstract Query: ObjectDef<'Root>
+ abstract Mutation: ObjectDef<'Root> option
+ abstract Subscription: SubscriptionObjectDef<'Root> option
end
/// A type alias for a field execute compiler function.
@@ -454,13 +482,14 @@ and FieldExecuteCompiler = FieldDef -> ExecuteField
/// A field execute map object.
/// Field execute maps are mutable objects built to compile fields at runtime.
-and FieldExecuteMap(compiler : FieldExecuteCompiler) =
- let map = new Dictionary()
+and FieldExecuteMap(compiler: FieldExecuteCompiler) =
+ let map = Dictionary()
let getKey typeName fieldName =
- if List.exists ((=) fieldName) ["__schema"; "__type"; "__typename" ]
- then "", fieldName
- else typeName, fieldName
+ if List.exists ((=) fieldName) [ "__schema"; "__type"; "__typename" ] then
+ "", fieldName
+ else
+ typeName, fieldName
///
/// Sets an execute function for a field of a named type of the schema.
@@ -471,13 +500,16 @@ and FieldExecuteMap(compiler : FieldExecuteCompiler) =
/// If set to true, and an exists an entry with the and the name of the FieldDef,
/// then it will be overwritten.
///
- member __.SetExecute(typeName: string, def: FieldDef, ?overwrite : bool) =
+ member __.SetExecute(typeName: string, def: FieldDef, ?overwrite: bool) =
let overwrite = defaultArg overwrite false
let key = typeName, def.Name
let compiled = compiler def
let args = def.Args
+
match map.ContainsKey(key), overwrite with
- | true, true -> map.Remove(key) |> ignore; map.Add(key, (compiled, args))
+ | true, true ->
+ map.Remove(key) |> ignore
+ map.Add(key, (compiled, args))
| false, _ -> map.Add(key, (compiled, args))
| _ -> ()
@@ -486,7 +518,7 @@ and FieldExecuteMap(compiler : FieldExecuteCompiler) =
///
/// The FieldDef that will have its execute function configured into the FieldExecuteMap.
/// If set to true, and an exists an entry with the FieldDef name, then it will be overwritten.
- member this.SetExecute(def : FieldDef, ?overwrite : bool) =
+ member this.SetExecute(def: FieldDef, ?overwrite: bool) =
let overwrite = defaultArg overwrite false
this.SetExecute("", def, overwrite)
@@ -497,40 +529,39 @@ and FieldExecuteMap(compiler : FieldExecuteCompiler) =
/// The field name of the object that has the field that needs to be executed.
member __.GetExecute(typeName: string, fieldName: string) =
let key = getKey typeName fieldName
- if map.ContainsKey(key) then fst map.[key] else Unchecked.defaultof
+ if map.ContainsKey(key) then fst map[key] else Unchecked.defaultof
///
/// Gets the field arguments based on the name of the type and the name of the field.
///
/// The type name of the parent object that has the field that needs to be executed.
/// The field name of the object that has the field that needs to be executed.
- member __.GetArgs(typeName : string, fieldName : string) =
+ member __.GetArgs(typeName: string, fieldName: string) =
let key = getKey typeName fieldName
- if map.ContainsKey(key) then snd map.[key] else Unchecked.defaultof
+ if map.ContainsKey(key) then snd map[key] else Unchecked.defaultof
interface IEnumerable with
member __.GetEnumerator() =
- let seq = map |> Seq.map(fun kvp -> fst kvp.Key, snd kvp.Key, fst kvp.Value)
+ let seq = map |> Seq.map (fun kvp -> fst kvp.Key, snd kvp.Key, fst kvp.Value)
seq.GetEnumerator()
interface IEnumerable with
member __.GetEnumerator() =
- let seq = map |> Seq.map(fun kvp -> fst kvp.Value)
+ let seq = map |> Seq.map (fun kvp -> fst kvp.Value)
upcast seq.GetEnumerator()
/// Root of GraphQL type system. All type definitions use TypeDef as
/// a common root.
and TypeDef =
interface
-
/// Return .NET CLR type associated with current type definition.
- abstract Type : Type
+ abstract Type: Type
/// INTERNAL API: creates a List definition of a current type.
- abstract MakeList : unit -> ListOfDef
+ abstract MakeList: unit -> ListOfDef
/// INTERNAL API: creates a Nullable definition of a current type.
- abstract MakeNullable : unit -> NullableDef
+ abstract MakeNullable: unit -> NullableDef
end
/// Root of GraphQL type system. Constrained to represent .NET type
@@ -611,18 +642,20 @@ and NamedDef =
/// Returns a name of the current named type. It must be unique
/// in scope of the defining schema.
- abstract Name : string
+ abstract Name: string
end
/// A context holding all the information needed for planning an operation.
and PlanningContext =
- { Schema : ISchema
- RootDef : ObjectDef
- Document : Document
- Operation : OperationDefinition
- DocumentId : int
- Metadata : Metadata
- ValidationResult : ValidationResult }
+ {
+ Schema: ISchema
+ RootDef: ObjectDef
+ Document: Document
+ Operation: OperationDefinition
+ DocumentId: int
+ Metadata: Metadata
+ ValidationResult: ValidationResult
+ }
/// A function type, which upon execution returns true if related field should
/// be included in result set for the query.
@@ -632,28 +665,30 @@ and Includer = Map -> bool
/// It contains info about both document AST fragment of incoming query as well,
/// as field defintion and type info of related fields, defined in schema.
and ExecutionInfo =
- { /// Field identifier, which may be either field name or alias. For top level execution plan it will be None.
- Identifier : string
- /// Field definition of corresponding type found in current schema.
- Definition : FieldDef
- /// AST node of the parsed query document.
- Ast : Field
- /// A type of execution plan.
- Kind : ExecutionInfoKind
- /// Logic describing, if correlated field should be included in result set.
- Include : Includer
- /// Composite definition being the parent of the current field, execution plan refers to.
- ParentDef : OutputDef
- /// Type definition marking returned type.
- ReturnDef : OutputDef
- /// Flag determining if flag allows to have nullable output.
- IsNullable : bool }
+ {
+ /// Field identifier, which may be either field name or alias. For top level execution plan it will be None.
+ Identifier: string
+ /// Field definition of corresponding type found in current schema.
+ Definition: FieldDef
+ /// AST node of the parsed query document.
+ Ast: Field
+ /// A type of execution plan.
+ Kind: ExecutionInfoKind
+ /// Logic describing, if correlated field should be included in result set.
+ Include: Includer
+ /// Composite definition being the parent of the current field, execution plan refers to.
+ ParentDef: OutputDef
+ /// Type definition marking returned type.
+ ReturnDef: OutputDef
+ /// Flag determining if flag allows to have nullable output.
+ IsNullable: bool
+ }
/// Get a nested info recognized by path provided as parameter. Path may consist of fields names or aliases.
- member this.GetPath (keys: string list) : ExecutionInfo option =
+ member this.GetPath(keys: string list) : ExecutionInfo option =
let rec path info segments =
match segments with
- | [] ->
+ | [] ->
match info.Kind with
| ResolveCollection inner -> Some inner
| _ -> Some info
@@ -665,9 +700,7 @@ and ExecutionInfo =
| ResolveValue -> None
| ResolveCollection inner -> path inner segments
| SelectFields fields ->
- fields
- |> List.tryFind (fun f -> f.Identifier = head)
- |> Option.bind (fun f -> path f tail)
+ fields |> List.tryFind (fun f -> f.Identifier = head) |> Option.bind (fun f -> path f tail)
| ResolveAbstraction typeMap ->
typeMap
|> Map.toSeq
@@ -675,49 +708,89 @@ and ExecutionInfo =
|> Seq.collect id
|> Seq.tryFind (fun f -> f.Identifier = head)
|> Option.bind (fun f -> path f tail)
+
path this keys
- override this.ToString () =
- let pad indent (sb: Text.StringBuilder) = for i = 0 to indent do sb.Append '\t' |> ignore
+
+ override this.ToString() =
+ let pad indent (sb: Text.StringBuilder) =
+ for i = 0 to indent do
+ sb.Append '\t' |> ignore
+
let nameAs info =
match info.Ast.Alias with
| Some alias ->
- info.Ast.Name + " as " + alias + " of " + info.ReturnDef.ToString() + (if info.IsNullable then "" else "!")
+ info.Ast.Name
+ + " as "
+ + alias
+ + " of "
+ + info.ReturnDef.ToString()
+ + (if info.IsNullable then "" else "!")
| None -> info.Ast.Name + " of " + info.ReturnDef.ToString() + (if info.IsNullable then "" else "!")
+
let rec str indent sb info =
match info.Kind with
| ResolveValue ->
pad indent sb
- sb.Append("ResolveValue: ").AppendLine(nameAs info) |> ignore
+
+ sb
+ .Append("ResolveValue: ")
+ .AppendLine(nameAs info)
+ |> ignore
| ResolveDeferred inner ->
pad indent sb
- sb.Append("ResolveDeferred: ").AppendLine(nameAs info) |> ignore
- str (indent+1) sb inner
+
+ sb
+ .Append("ResolveDeferred: ")
+ .AppendLine(nameAs info)
+ |> ignore
+
+ str (indent + 1) sb inner
| ResolveLive inner ->
pad indent sb
sb.Append("ResolveLive: ").AppendLine(nameAs info) |> ignore
- str (indent+1) sb inner
+ str (indent + 1) sb inner
| ResolveStreamed (inner, mode) ->
pad indent sb
- sb.Append("ResolveStreamed: ").AppendLine(nameAs info) |> ignore
- str (indent+1) sb inner
+
+ sb
+ .Append("ResolveStreamed: ")
+ .AppendLine(nameAs info)
+ |> ignore
+
+ str (indent + 1) sb inner
| SelectFields fields ->
pad indent sb
- sb.Append("SelectFields: ").AppendLine(nameAs info) |> ignore
- fields |> List.iter (str (indent+1) sb)
+
+ sb
+ .Append("SelectFields: ")
+ .AppendLine(nameAs info)
+ |> ignore
+
+ fields |> List.iter (str (indent + 1) sb)
| ResolveCollection inner ->
pad indent sb
- sb.Append("ResolveCollection: ").AppendLine(nameAs info) |> ignore
- str (indent+1) sb inner
+
+ sb
+ .Append("ResolveCollection: ")
+ .AppendLine(nameAs info)
+ |> ignore
+
+ str (indent + 1) sb inner
| ResolveAbstraction types ->
pad indent sb
- sb.Append("ResolveAbstraction: ").AppendLine(nameAs info) |> ignore
+
+ sb
+ .Append("ResolveAbstraction: ")
+ .AppendLine(nameAs info)
+ |> ignore
+
types
|> Map.iter (fun tname fields ->
- pad (indent+1) sb
+ pad (indent + 1) sb
sb.Append("Case: ").AppendLine(tname) |> ignore
- fields |> List.iter (str (indent+2) sb))
+ fields |> List.iter (str (indent + 2) sb))
- let sb = Text.StringBuilder ()
+ let sb = Text.StringBuilder()
str 0 sb this
sb.ToString()
@@ -728,14 +801,14 @@ and ExecutionInfoKind =
/// Reduce result set by selecting provided set of fields,
/// defined inside composite type, current execution info
/// refers to.
- | SelectFields of fields : ExecutionInfo list
+ | SelectFields of fields: ExecutionInfo list
/// Reduce current field as a collection, applying provided
/// execution info on each of the collection's element.
- | ResolveCollection of elementPlan : ExecutionInfo
+ | ResolveCollection of elementPlan: ExecutionInfo
/// Reduce union or interface types by applying provided set of
/// field infos depending on what concrete object implementation
/// will be found.
- | ResolveAbstraction of typeFields : Map
+ | ResolveAbstraction of typeFields: Map
/// Reduce result set as a deferred result.
| ResolveDeferred of ExecutionInfo
/// Reduce the current field as a stream, applying
@@ -747,10 +820,11 @@ and ExecutionInfoKind =
/// Buffered stream options. Used to specify how the buffer will behavior in a stream.
and BufferedStreamOptions =
- /// The maximum time in milliseconds that the buffer will be filled before being sent to the subscriber.
- { Interval : int option
- /// The maximum number of items that will be buffered before being sent to the subscriber.
- PreferredBatchSize : int option }
+ {
+ Interval: int option
+ /// The maximum number of items that will be buffered before being sent to the subscriber.
+ PreferredBatchSize: int option
+ }
/// Wrapper for a resolve method defined by the user or generated by a runtime.
and Resolve =
@@ -761,37 +835,37 @@ and Resolve =
/// input defines .NET type of the provided object
/// output defines .NET type of the returned value
/// expr is untyped version of Expr'Input->'Output>
- | Sync of input:Type * output:Type * expr:Expr
+ | Sync of input: Type * output: Type * expr: Expr
/// Resolve field value as part of Async computation.
/// input defines .NET type of the provided object
/// output defines .NET type of the returned value
/// expr is untyped version of Expr'Input->Async<'Output>>
- | Async of input:Type * output:Type * expr:Expr
+ | Async of input: Type * output: Type * expr: Expr
/// Resolves the filter function of a subscription.
/// root defines the .NET type of the root object
/// input defines the .NET type of the value being subscribed to
/// expr is the untyped version of Expr 'Root -> 'Input -> bool>
- | Filter of root: Type * input:Type * output:Type * expr:Expr
+ | Filter of root: Type * input: Type * output: Type * expr: Expr
/// Resolves the filter function of a subscription that has asyncronous fields.
/// root defines the .NET type of the root object
/// input defines the .NET type of the value being subscribed to
/// expr is the untyped version of Expr 'Root -> 'Input -> bool>
- | AsyncFilter of root: Type * input:Type * output:Type * expr:Expr
+ | AsyncFilter of root: Type * input: Type * output: Type * expr: Expr
- | ResolveExpr of expr:Expr
+ | ResolveExpr of expr: Expr
/// Returns an expression defining resolver function.
member x.Expr =
match x with
- | Sync(_,_,e) -> e
- | Async(_,_,e) -> e
- | ResolveExpr(e) -> e
+ | Sync (_, _, e) -> e
+ | Async (_, _, e) -> e
+ | ResolveExpr e -> e
| Undefined -> failwith "Resolve function was not defined"
- | x -> failwith <| sprintf "Unexpected resolve function %A" x
+ | x -> failwith $"Unexpected resolve function %A{x}"
/// Execution strategy for provided queries. Defines if object fields should
/// be resolved either sequentially one-by-one or in parallel.
@@ -805,98 +879,113 @@ and ExecutionStrategy =
/// Type representing a variable definition inside GraphQL query.
and VarDef =
- { /// Variable name without prefixed '$'.
- Name: string
- /// Type definition in corresponding GraphQL schema.
- TypeDef: InputDef
- /// Optional default value.
- DefaultValue: Value option }
+ {
+ /// Variable name without prefixed '$'.
+ Name: string
+ /// Type definition in corresponding GraphQL schema.
+ TypeDef: InputDef
+ /// Optional default value.
+ DefaultValue: Value option
+ }
/// The context used to hold all the information for a schema compiling proccess.
and SchemaCompileContext =
- { Schema : ISchema
- TypeMap : TypeMap
- FieldExecuteMap : FieldExecuteMap }
+ {
+ Schema: ISchema
+ TypeMap: TypeMap
+ FieldExecuteMap: FieldExecuteMap
+ }
/// A planning of an execution phase.
/// It is used by the execution process to execute an operation.
and ExecutionPlan =
- { /// Unique identifier of the current execution plan.
- DocumentId : int
- /// AST defintion of current operation.
- Operation : OperationDefinition
- /// Definition of the root type (either query or mutation) used by the
- /// current operation.
- RootDef : ObjectDef
- /// Execution strategy applied on the underlying object's fields.
- Strategy : ExecutionStrategy
- /// List of fields of top level query/mutation object to be resolved.
- Fields : ExecutionInfo list
- /// List of variables defined within executed query.
- Variables : VarDef list
- /// A dictionary of metadata associated with custom operations on the planning of this plan.
- Metadata : Metadata
- /// The validation result for the document being processed.
- ValidationResult : ValidationResult }
- member x.Item with get(id) = x.Fields |> List.find (fun f -> f.Identifier = id)
+ {
+ /// Unique identifier of the current execution plan.
+ DocumentId: int
+ /// AST defintion of current operation.
+ Operation: OperationDefinition
+ /// Definition of the root type (either query or mutation) used by the
+ /// current operation.
+ RootDef: ObjectDef
+ /// Execution strategy applied on the underlying object's fields.
+ Strategy: ExecutionStrategy
+ /// List of fields of top level query/mutation object to be resolved.
+ Fields: ExecutionInfo list
+ /// List of variables defined within executed query.
+ Variables: VarDef list
+ /// A dictionary of metadata associated with custom operations on the planning of this plan.
+ Metadata: Metadata
+ /// The validation result for the document being processed.
+ ValidationResult: ValidationResult
+ }
+ member x.Item
+ with get id = x.Fields |> List.find (fun f -> f.Identifier = id)
/// Execution context of the current GraphQL operation. It contains a full
/// knowledge about which fields will be accessed, what types are associated
/// with them and what variable values have been set by incoming query.
and ExecutionContext =
- { /// GraphQL schema definition.
- Schema : ISchema
- /// Boxed value of the top level type, root query/mutation.
- RootValue : obj
- /// Execution plan describing, what fiedls are going to be resolved.
- ExecutionPlan : ExecutionPlan
- /// Collection of variables provided to execute current operation.
- Variables : Map
- /// Collection of errors that occurred while executing current operation.
- Errors : ConcurrentBag
- /// A map of all fields of the query and their respective execution operations.
- FieldExecuteMap : FieldExecuteMap
- /// A simple dictionary to hold metadata that can be used by execution customizations.
- Metadata : Metadata }
+ {
+ /// GraphQL schema definition.
+ Schema: ISchema
+ /// Boxed value of the top level type, root query/mutation.
+ RootValue: obj
+ /// Execution plan describing, what fiedls are going to be resolved.
+ ExecutionPlan: ExecutionPlan
+ /// Collection of variables provided to execute current operation.
+ Variables: Map
+ /// Collection of errors that occurred while executing current operation.
+ Errors: ConcurrentBag
+ /// A map of all fields of the query and their respective execution operations.
+ FieldExecuteMap: FieldExecuteMap
+ /// A simple dictionary to hold metadata that can be used by execution customizations.
+ Metadata: Metadata
+ }
/// An execution context for the particular field, applied as the first
/// parameter for target resolve function.
and ResolveFieldContext =
- { /// Fragment of the overall execution plan related to current field.
- ExecutionInfo : ExecutionInfo
- /// Current operation execution context.
- Context : ExecutionContext
- /// GraphQL type definition for the returned value.
- ReturnType : TypeDef
- /// GraphQL type definition for a parent object, current value needs
- /// to be resolved from.
- ParentType : ObjectDef
- /// Current GraphQL schema.
- Schema : ISchema
- /// Untyped map of all argument values used for as current field's
- /// parametrized inputs.
- Args : Map
- /// Variables provided by the operation caller.
- Variables : Map
- /// Field path
- Path : obj list }
+ {
+ /// Fragment of the overall execution plan related to current field.
+ ExecutionInfo: ExecutionInfo
+ /// Current operation execution context.
+ Context: ExecutionContext
+ /// GraphQL type definition for the returned value.
+ ReturnType: TypeDef
+ /// GraphQL type definition for a parent object, current value needs
+ /// to be resolved from.
+ ParentType: ObjectDef
+ /// Current GraphQL schema.
+ Schema: ISchema
+ /// Untyped map of all argument values used for as current field's
+ /// parametrized inputs.
+ Args: Map
+ /// Variables provided by the operation caller.
+ Variables: Map
+ /// Field path
+ Path: obj list
+ }
/// Remembers an exception, so it can be included in the final response.
- member x.AddError(error : exn) = x.Context.Errors.Add error
+ member x.AddError(error: exn) = x.Context.Errors.Add error
/// Tries to find an argument by provided name.
- member x.TryArg(name : string) : 't option =
+ member x.TryArg(name: string) : 't option =
match Map.tryFind name x.Args with
| Some o -> Some(o :?> 't)
| None -> None
/// Returns an argument by provided name. If argument was not found
/// and exception will be thrown.
- member x.Arg(name : string) : 't =
+ member x.Arg(name: string) : 't =
match Map.tryFind name x.Args with
| Some found -> downcast found
- | None -> raise (System.Collections.Generic.KeyNotFoundException(sprintf "Argument '%s' was not provided within context of a field '%s'. Check if it was supplied within GraphQL query." name x.ExecutionInfo.Identifier))
+ | None ->
+ raise (
+ KeyNotFoundException
+ $"Argument '%s{name}' was not provided within context of a field '%s{x.ExecutionInfo.Identifier}'. Check if it was supplied within GraphQL query."
+ )
/// Function type for the compiled field executor.
and ExecuteField = ResolveFieldContext -> obj -> AsyncVal
@@ -906,20 +995,19 @@ and ExecuteField = ResolveFieldContext -> obj -> AsyncVal
and FieldDef =
interface
/// Name of the field.
- abstract Name : string
+ abstract Name: string
/// Optional field description.
- abstract Description : string option
+ abstract Description: string option
/// Optional field deprecation warning.
- abstract DeprecationReason : string option
+ abstract DeprecationReason: string option
/// Field's GraphQL type definition.
- abstract TypeDef : OutputDef
+ abstract TypeDef: OutputDef
/// Field's arguments list.
- abstract Args : InputFieldDef []
+ abstract Args: InputFieldDef []
/// Field's metadata.
- abstract Metadata : Metadata
+ abstract Metadata: Metadata
/// Field resolution function.
- abstract Resolve : Resolve
- /// INTERNAL API: Compiled field executor. To be set only by the runtime.
+ abstract Resolve: Resolve
inherit IEquatable
end
@@ -932,21 +1020,22 @@ and FieldDef<'Val> =
end
and [] internal FieldDefinition<'Val, 'Res> =
- { /// Name of the field.
- Name : string
- /// Optional field description.
- Description : string option
- /// Field's GraphQL type definition.
- TypeDef : OutputDef<'Res>
- /// Field resolution function.
- Resolve : Resolve
- /// Field's arguments list.
- Args : InputFieldDef []
- /// Optional field deprecation warning.
- DeprecationReason : string option
- /// Field metadata definition.
- Metadata : Metadata
- }
+ {
+ /// Name of the field.
+ Name: string
+ /// Optional field description.
+ Description: string option
+ /// Field's GraphQL type definition.
+ TypeDef: OutputDef<'Res>
+ /// Field resolution function.
+ Resolve: Resolve
+ /// Field's arguments list.
+ Args: InputFieldDef []
+ /// Optional field deprecation warning.
+ DeprecationReason: string option
+ /// Field metadata definition.
+ Metadata: Metadata
+ }
interface FieldDef with
member x.Name = x.Name
@@ -969,27 +1058,30 @@ and [] internal FieldDefinition<'Val, 'Res> =
override x.GetHashCode() =
let mutable hash = x.Name.GetHashCode()
- hash <- (hash * 397) ^^^ (x.TypeDef.GetHashCode())
- hash <- (hash * 397) ^^^ (x.Args.GetHashCode())
+ hash <- (hash * 397) ^^^ x.TypeDef.GetHashCode()
+ hash <- (hash * 397) ^^^ x.Args.GetHashCode()
hash
override x.ToString() =
- if not (Array.isEmpty x.Args)
- then x.Name + "(" + String.Join(", ", x.Args) + "): " + x.TypeDef.ToString()
- else x.Name + ": " + x.TypeDef.ToString()
+ if not (Array.isEmpty x.Args) then
+ x.Name + "(" + String.Join(", ", x.Args) + "): " + x.TypeDef.ToString()
+ else
+ x.Name + ": " + x.TypeDef.ToString()
/// An untyped representation of GraphQL scalar type.
and ScalarDef =
interface
/// Name of the scalar type.
- abstract Name : string
+ abstract Name: string
/// Optional scalar type description.
- abstract Description : string option
+ abstract Description: string option
/// A function used to retrieve a .NET object from provided GraphQL query.
- abstract CoerceInput : Value -> obj option
+ abstract CoerceInput: Value -> obj option
+
/// A function used to set a surrogate representation to be
/// returned as a query result.
- abstract CoerceValue : obj -> obj option
+ abstract CoerceValue: obj -> obj option
+
inherit TypeDef
inherit NamedDef
inherit InputDef
@@ -999,25 +1091,27 @@ and ScalarDef =
/// Concrete representation of the scalar types.
and [] ScalarDefinition<'Val> =
- { /// Name of the scalar type.
- Name : string
- /// Optional type description.
- Description : string option
- /// A function used to retrieve a .NET object from provided GraphQL query.
- CoerceInput : Value -> 'Val option
- /// A function used to set a surrogate representation to be
- /// returned as a query result.
- CoerceValue : obj -> 'Val option }
+ {
+ /// Name of the scalar type.
+ Name: string
+ /// Optional type description.
+ Description: string option
+ /// A function used to retrieve a .NET object from provided GraphQL query.
+ CoerceInput: Value -> 'Val option
+ /// A function used to set a surrogate representation to be
+ /// returned as a query result.
+ CoerceValue: obj -> 'Val option
+ }
interface TypeDef with
member __.Type = typeof<'Val>
member x.MakeNullable() =
- let nullable : NullableDefinition<_> = { OfType = x }
+ let nullable: NullableDefinition<_> = { OfType = x }
upcast nullable
member x.MakeList() =
- let list: ListOfDefinition<_,_> = { OfType = x }
+ let list: ListOfDefinition<_, _> = { OfType = x }
upcast list
interface InputDef
@@ -1049,26 +1143,28 @@ and [] ScalarDefinition<'Val> =
and EnumVal =
interface
/// Identifier of the enum value.
- abstract Name : string
+ abstract Name: string
/// Optional enum value description.
- abstract Description : string option
+ abstract Description: string option
/// Value to be stringified as a result to the user.
- abstract Value : obj
+ abstract Value: obj
/// Optional description of the deprecation reason.
- abstract DeprecationReason : string option
+ abstract DeprecationReason: string option
end
/// A GraphQL representation of single case of the enum type.
/// Enum value return value is always represented as string.
and EnumValue<'Val> =
- { /// Identifier of the enum value.
- Name : string
- /// Value to be stringified as a result to the user.
- Value : 'Val
- /// Optional enum value description.
- Description : string option
- /// Optional description of the deprecation reason.
- DeprecationReason : string option }
+ {
+ /// Identifier of the enum value.
+ Name: string
+ /// Value to be stringified as a result to the user.
+ Value: 'Val
+ /// Optional enum value description.
+ Description: string option
+ /// Optional description of the deprecation reason.
+ DeprecationReason: string option
+ }
interface EnumVal with
member x.Name = x.Name
@@ -1084,11 +1180,11 @@ and EnumValue<'Val> =
and EnumDef =
interface
/// Enum type name.
- abstract Name : string
+ abstract Name: string
/// Optional enum type description.
- abstract Description : string option
+ abstract Description: string option
/// List of available enum cases.
- abstract Options : EnumVal []
+ abstract Options: EnumVal []
inherit TypeDef
inherit InputDef
inherit OutputDef
@@ -1102,7 +1198,7 @@ and EnumDef =
and EnumDef<'Val> =
interface
/// List of available enum cases (typed).
- abstract Options : EnumValue<'Val> []
+ abstract Options: EnumValue<'Val> []
inherit EnumDef
inherit TypeDef<'Val>
inherit InputDef<'Val>
@@ -1110,12 +1206,14 @@ and EnumDef<'Val> =
end
and internal EnumDefinition<'Val> =
- { /// Enum type name.
- Name : string
- /// Optional enum type description.
- Description : string option
- /// List of available enum cases.
- Options : EnumValue<'Val> [] }
+ {
+ /// Enum type name.
+ Name: string
+ /// Optional enum type description.
+ Description: string option
+ /// List of available enum cases.
+ Options: EnumValue<'Val> []
+ }
interface InputDef
interface OutputDef
@@ -1123,11 +1221,11 @@ and internal EnumDefinition<'Val> =
member __.Type = typeof<'Val>
member x.MakeNullable() =
- let nullable : NullableDefinition<_> = { OfType = x }
+ let nullable: NullableDefinition<_> = { OfType = x }
upcast nullable
member x.MakeList() =
- let list: ListOfDefinition<_,_> = { OfType = x }
+ let list: ListOfDefinition<_, _> = { OfType = x }
upcast list
interface EnumDef<'Val> with
@@ -1136,11 +1234,7 @@ and internal EnumDefinition<'Val> =
interface EnumDef with
member x.Name = x.Name
member x.Description = x.Description
- member x.Options =
- x.Options
- |> Seq.ofArray
- |> Seq.cast
- |> Seq.toArray
+ member x.Options = x.Options |> Seq.ofArray |> Seq.cast |> Seq.toArray
interface NamedDef with
member x.Name = x.Name
@@ -1153,16 +1247,18 @@ and internal EnumDefinition<'Val> =
and ObjectDef =
interface
/// Name of the object type definition.
- abstract Name : string
+ abstract Name: string
/// Optional object definition description.
- abstract Description : string option
+ abstract Description: string option
/// Collection of fields defined by the current object.
- abstract Fields : Map
+ abstract Fields: Map
/// Collection of interfaces implemented by the current object.
- abstract Implements : InterfaceDef []
+ abstract Implements: InterfaceDef []
+
/// Optional function used to recognize of provided
/// .NET object is valid for this GraphQL object definition.
- abstract IsTypeOf : (obj -> bool) option
+ abstract IsTypeOf: (obj -> bool) option
+
inherit TypeDef
inherit NamedDef
inherit OutputDef
@@ -1175,35 +1271,37 @@ and ObjectDef =
and ObjectDef<'Val> =
interface
/// Collection of fields defined by the current object.
- abstract Fields : Map>
+ abstract Fields: Map>
inherit ObjectDef
inherit TypeDef<'Val>
inherit OutputDef<'Val>
end
and [] internal ObjectDefinition<'Val> =
- { /// Name of the object type definition.
- Name : string
- /// Optional object definition description.
- Description : string option
- /// Lazy resolver for the object fields. It must be lazy in
- /// order to allow self-recursive type references.
- FieldsFn : Lazy
/// The NamedDef to be added to the type map. It's name will be used as the key.
/// If set to true, and another NamedDef exists with the same name, it will be overwritten.
- member __.AddType(def : NamedDef, ?overwrite : bool) =
+ member __.AddType(def: NamedDef, ?overwrite: bool) =
let overwrite = defaultArg overwrite false
+
let add name def overwrite =
- if not (map.ContainsKey(name))
- then map.Add(name, def)
- elif overwrite
- then map.[name] <- def
+ if not (map.ContainsKey(name)) then map.Add(name, def)
+ elif overwrite then map[name] <- def
+
let asNamed x =
match named x with
| Some n -> n
| _ -> failwith "Expected a Named type!"
- let rec insert (def : NamedDef) =
+
+ let rec insert (def: NamedDef) =
match def with
| :? ScalarDef as sdef -> add sdef.Name def overwrite
| :? EnumDef as edef -> add edef.Name def overwrite
| :? SubscriptionObjectDef as sdef ->
add sdef.Name def overwrite
+
sdef.Fields
|> Map.toSeq
|> Seq.map snd
- |> Seq.collect (fun x -> Array.append [| x.OutputTypeDef :> TypeDef |] (x.Args |> Array.map (fun a -> upcast a.TypeDef)))
+ |> Seq.collect (fun x ->
+ Array.append [| x.OutputTypeDef :> TypeDef |] (x.Args |> Array.map (fun a -> upcast a.TypeDef)))
|> Seq.map asNamed
|> Seq.filter (fun x -> not (map.ContainsKey(x.Name)))
|> Seq.iter insert
| :? ObjectDef as odef ->
add odef.Name def overwrite
+
odef.Fields
|> Map.toSeq
|> Seq.map snd
- |> Seq.collect (fun x -> Seq.append (x.TypeDef :> TypeDef |> Seq.singleton) (x.Args |> Seq.map (fun a -> upcast a.TypeDef)))
+ |> Seq.collect (fun x ->
+ Seq.append (x.TypeDef :> TypeDef |> Seq.singleton) (x.Args |> Seq.map (fun a -> upcast a.TypeDef)))
|> Seq.map asNamed
|> Seq.filter (fun x -> not (map.ContainsKey(x.Name)))
|> Seq.iter insert
- odef.Implements
- |> Seq.iter insert
+
+ odef.Implements |> Seq.iter insert
| :? InterfaceDef as idef ->
add idef.Name def overwrite
+
idef.Fields
|> Seq.map (fun x -> asNamed x.TypeDef)
|> Seq.filter (fun x -> not (map.ContainsKey(x.Name)))
|> Seq.iter insert
| :? UnionDef as udef ->
add udef.Name def overwrite
- udef.Options
- |> Seq.iter insert
+ udef.Options |> Seq.iter insert
| :? ListOfDef as ldef ->
match named ldef.OfType with
| Some innerdef -> insert innerdef
@@ -1875,12 +2007,17 @@ and TypeMap() =
| None -> ()
| :? InputObjectDef as iodef ->
add iodef.Name def overwrite
+
iodef.Fields
|> Seq.collect (fun x -> (x.TypeDef :> TypeDef) |> Seq.singleton)
- |> Seq.map (fun x -> match named x with Some n -> n | _ -> failwith "Expected a Named type!")
+ |> Seq.map (fun x ->
+ match named x with
+ | Some n -> n
+ | _ -> failwith "Expected a Named type!")
|> Seq.filter (fun x -> not (map.ContainsKey(x.Name)))
|> Seq.iter insert
| _ -> failwith "Unexpected type!"
+
insert def
///
@@ -1888,20 +2025,22 @@ and TypeMap() =
///
/// The NamedDef sequence to be added to the type map. Their names will be used as keys.
/// If set to true, and another NamedDef exists with the same name on the sequence, it will be overwritten.
- member this.AddTypes(defs : NamedDef seq, ?overwrite : bool) =
+ member this.AddTypes(defs: NamedDef seq, ?overwrite: bool) =
let overwrite = defaultArg overwrite false
defs |> Seq.iter (fun def -> this.AddType(def, overwrite))
/// Converts this type map to a sequence of string * NamedDef values, with the first item being the key.
- member __.ToSeq(?includeDefaultTypes : bool) =
+ member __.ToSeq(?includeDefaultTypes: bool) =
let includeDefaultTypes = defaultArg includeDefaultTypes true
let result = map |> Seq.map (fun kvp -> (kvp.Key, kvp.Value))
- if not includeDefaultTypes
- then result |> Seq.filter (fun (k, _) -> not (isDefaultType k))
- else result
+
+ if not includeDefaultTypes then
+ result |> Seq.filter (fun (k, _) -> not (isDefaultType k))
+ else
+ result
/// Converts this type map to a list of string * NamedDef values, with the first item being the key.
- member this.ToList(?includeDefaultTypes : bool) =
+ member this.ToList(?includeDefaultTypes: bool) =
let includeDefaultTypes = defaultArg includeDefaultTypes true
this.ToSeq(includeDefaultTypes) |> List.ofSeq
@@ -1910,14 +2049,14 @@ and TypeMap() =
///
/// The name of the NamedDef to be searched for.
/// If set to true, it will search for the NamedDef among the default types.
- member __.TryFind(name : string, ?includeDefaultTypes : bool) =
+ member __.TryFind(name: string, ?includeDefaultTypes: bool) =
let includeDefaultTypes = defaultArg includeDefaultTypes false
- if not includeDefaultTypes && isDefaultType name
- then
+
+ if not includeDefaultTypes && isDefaultType name then
None
else
match map.TryGetValue(name) with
- | (true, item) -> Some item
+ | true, item -> Some item
| _ -> None
///
@@ -1925,8 +2064,9 @@ and TypeMap() =
///
/// The name of the NamedDef to be searched for.
/// If set to true, it will search for the NamedDef among the default types.
- member this.TryFind<'Type when 'Type :> NamedDef>(name : string, ?includeDefaultTypes : bool) =
+ member this.TryFind<'Type when 'Type :> NamedDef>(name: string, ?includeDefaultTypes: bool) =
let includeDefaultTypes = defaultArg includeDefaultTypes false
+
match this.TryFind(name, includeDefaultTypes) with
| Some item ->
match item with
@@ -1938,11 +2078,18 @@ and TypeMap() =
/// Gets all NamedDef's inside the map that are, or implements the specified type.
///
/// If set to true, it will search for the NamedDef among the default types.
- member this.OfType<'Type when 'Type :> NamedDef>(?includeDefaultTypes : bool) =
+ member this.OfType<'Type when 'Type :> NamedDef>(?includeDefaultTypes: bool) =
let includeDefaultTypes = defaultArg includeDefaultTypes false
+
this.ToSeq()
|> Seq.filter (fun (name, _) -> not includeDefaultTypes && not (isDefaultType name))
- |> Seq.map (snd >> (fun x -> match x with :? 'Type as x -> Some x | _ -> None))
+ |> Seq.map (
+ snd
+ >> (fun x ->
+ match x with
+ | :? 'Type as x -> Some x
+ | _ -> None)
+ )
|> Seq.choose id
|> List.ofSeq
@@ -1952,7 +2099,7 @@ and TypeMap() =
///
/// The name of the ObjectDef that has the field that are being searched.
/// The name of the FieldDef to be searched for.
- member this.TryFindField(objname : string, fname : string) =
+ member this.TryFindField(objname: string, fname: string) =
match this.TryFind(objname) with
| Some odef -> odef.Fields |> Map.tryFind fname
| None -> None
@@ -1962,7 +2109,7 @@ and TypeMap() =
///
/// The name of the ObjectDef that has the field that are being searched.
/// The name of the FieldDef to be searched for.
- member this.TryFindField<'Type when 'Type :> OutputDef>(objname : string, fname : string) =
+ member this.TryFindField<'Type when 'Type :> OutputDef>(objname: string, fname: string) =
match this.TryFindField(objname, fname) with
| Some fdef ->
match fdef.TypeDef with
@@ -1974,16 +2121,19 @@ and TypeMap() =
/// Tries to find ObjectDef<'Val> types inside the map, that have fields that are lists of 'Res type.
///
/// If set to true, it will search for the NamedDef among the default types.
- member this.GetTypesWithListFields<'Val, 'Res>(?includeDefaultTypes : bool) =
+ member this.GetTypesWithListFields<'Val, 'Res>(?includeDefaultTypes: bool) =
let includeDefaultTypes = defaultArg includeDefaultTypes false
let toSeq map = map |> Map.toSeq |> Seq.map snd
- let map (f : FieldDef<'Val>) =
- let rec isList (fieldTypeDef : TypeDef) =
+
+ let map (f: FieldDef<'Val>) =
+ let rec isList (fieldTypeDef: TypeDef) =
match fieldTypeDef with
| :? NullableDef as x -> isList x.OfType
| :? ListOfDef<'Res, 'Res seq> -> true
| _ -> false
+
if isList f.TypeDef then Some f else None
+
this.OfType>(includeDefaultTypes)
|> Seq.map (fun x -> x, (x.Fields |> toSeq |> Seq.map map |> Seq.choose id |> List.ofSeq))
|> List.ofSeq
@@ -1992,76 +2142,81 @@ and TypeMap() =
/// Creates a new TypeMap instance, using a sequence of NamedDef's to fill it.
///
/// The NamedDef sequence that has the NamedDef's that will be filled into the TypeMap.
- static member FromSeq(defs : NamedDef seq) =
+ static member FromSeq(defs: NamedDef seq) =
let map = TypeMap()
defs |> Seq.iter (fun def -> map.AddType(def))
map
module Tags =
- let from (x : #Tag) : Tag seq = Seq.singleton (upcast x)
+ let from (x: #Tag) : Tag seq = Seq.singleton (upcast x)
let fromSeq x : Tag seq = x |> Seq.map (fun t -> upcast t)
[]
module SubscriptionExtensions =
type ISubscriptionProvider with
- member this.Register subscription =
- this.AsyncRegister subscription |> Async.RunSynchronously
+ member this.Register subscription = this.AsyncRegister subscription |> Async.RunSynchronously
- member this.Publish<'T> name subType =
- this.AsyncPublish name subType |> Async.RunSynchronously
+ member this.Publish<'T> name subType = this.AsyncPublish name subType |> Async.RunSynchronously
- member this.PublishTag<'T> name index subType =
- this.AsyncPublishTag name index subType |> Async.RunSynchronously
+ member this.PublishTag<'T> name index subType = this.AsyncPublishTag name index subType |> Async.RunSynchronously
type ILiveFieldSubscriptionProvider with
- member this.Register subscription =
- this.AsyncRegister subscription |> Async.RunSynchronously
+ member this.Register subscription = this.AsyncRegister subscription |> Async.RunSynchronously
member this.Publish<'T> typeName fieldName subType =
this.AsyncPublish typeName fieldName subType |> Async.RunSynchronously
[]
module Resolve =
- type private Marker = class end
+ type private Marker =
+ class
+ end
- let private (|FSharpFunc|_|) (typ : Type) =
+ let private (|FSharpFunc|_|) (typ: Type) =
if FSharpType.IsFunction typ then
- let d,c = FSharpType.GetFunctionElements typ
- Some(d,c)
- else None
+ let d, c = FSharpType.GetFunctionElements typ
+ Some(d, c)
+ else
+ None
- let private (|FSharpOption|_|) (typ : Type) =
+ let private (|FSharpOption|_|) (typ: Type) =
if typ.GetTypeInfo().IsGenericType && typ.GetGenericTypeDefinition() = typedefof