diff --git a/Packages.props b/Packages.props
index 44c95500b..46ef28beb 100644
--- a/Packages.props
+++ b/Packages.props
@@ -73,7 +73,6 @@
-
diff --git a/samples/chat-app/server/Program.fs b/samples/chat-app/server/Program.fs
index 134fd0672..bb3f47ef6 100644
--- a/samples/chat-app/server/Program.fs
+++ b/samples/chat-app/server/Program.fs
@@ -29,7 +29,6 @@ let main args =
if app.Environment.IsDevelopment () then
app.UseGraphQLAltair "/altair" |> ignore
app.UseGraphQLGraphiQL "/graphiql" |> ignore
- app.UseGraphQLPlayground "/playground" |> ignore
app.UseGraphQLVoyager "/voyager" |> ignore
app.UseRouting () |> ignore
app.UseEndpoints (fun endpoints -> endpoints.MapNitroApp (PathString "/nitro") |> ignore)
diff --git a/samples/chat-app/server/chat-app.fsproj b/samples/chat-app/server/chat-app.fsproj
index ee76e08a0..2c7da7a10 100644
--- a/samples/chat-app/server/chat-app.fsproj
+++ b/samples/chat-app/server/chat-app.fsproj
@@ -10,7 +10,6 @@
-
diff --git a/samples/relay-book-store/Program.fs b/samples/relay-book-store/Program.fs
index 7b96462ef..066c9bdb4 100644
--- a/samples/relay-book-store/Program.fs
+++ b/samples/relay-book-store/Program.fs
@@ -35,7 +35,6 @@ let main argv =
if app.Environment.IsDevelopment () then
app.UseGraphQLAltair "/altair" |> ignore
app.UseGraphQLGraphiQL "/graphiql" |> ignore
- app.UseGraphQLPlayground "/playground" |> ignore
app.UseGraphQLVoyager "/voyager" |> ignore
app.UseRouting () |> ignore
app.UseEndpoints (fun endpoints -> endpoints.MapNitroApp (PathString "/nitro") |> ignore)
diff --git a/samples/relay-book-store/relay-book-store.fsproj b/samples/relay-book-store/relay-book-store.fsproj
index e79c61732..8ab45f6d7 100644
--- a/samples/relay-book-store/relay-book-store.fsproj
+++ b/samples/relay-book-store/relay-book-store.fsproj
@@ -11,7 +11,6 @@
-
diff --git a/samples/star-wars-api/Startup.fs b/samples/star-wars-api/Startup.fs
index 7ca6dd703..1f9d2aab9 100644
--- a/samples/star-wars-api/Startup.fs
+++ b/samples/star-wars-api/Startup.fs
@@ -47,7 +47,6 @@ type Startup private () =
if env.IsDevelopment () then
app.UseGraphQLAltair "/altair" |> ignore
app.UseGraphQLGraphiQL "/graphiql" |> ignore
- app.UseGraphQLPlayground "/playground" |> ignore
app.UseGraphQLVoyager "/voyager" |> ignore
app.UseRouting () |> ignore
app.UseEndpoints (fun endpoints -> endpoints.MapNitroApp (PathString "/nitro") |> ignore)
diff --git a/samples/star-wars-api/star-wars-api.fsproj b/samples/star-wars-api/star-wars-api.fsproj
index 0873122d7..f307136b9 100644
--- a/samples/star-wars-api/star-wars-api.fsproj
+++ b/samples/star-wars-api/star-wars-api.fsproj
@@ -11,7 +11,6 @@
-
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/Exceptions.fs b/src/FSharp.Data.GraphQL.Server.AspNetCore/Exceptions.fs
deleted file mode 100644
index a7252b3ac..000000000
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/Exceptions.fs
+++ /dev/null
@@ -1,4 +0,0 @@
-namespace FSharp.Data.GraphQL.Server.AspNetCore
-
-type InvalidWebsocketMessageException (explanation : string) =
- inherit System.Exception (explanation)
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/FSharp.Data.GraphQL.Server.AspNetCore.fsproj b/src/FSharp.Data.GraphQL.Server.AspNetCore/FSharp.Data.GraphQL.Server.AspNetCore.fsproj
index cd5694ff9..543a96f1c 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/FSharp.Data.GraphQL.Server.AspNetCore.fsproj
+++ b/src/FSharp.Data.GraphQL.Server.AspNetCore/FSharp.Data.GraphQL.Server.AspNetCore.fsproj
@@ -13,11 +13,6 @@
-
-
-
-
-
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLRequestHandler.fs b/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLRequestHandler.fs
index 2d820ed7a..89df9a458 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLRequestHandler.fs
+++ b/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLRequestHandler.fs
@@ -13,6 +13,7 @@ open FSharp.Data.GraphQL
open FsToolkit.ErrorHandling
open FSharp.Data.GraphQL.Server
+open FSharp.Data.GraphQL.Shared
type DefaultGraphQLRequestHandler<'Root> (
httpContextAccessor : IHttpContextAccessor,
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLSubscriptionsManagement.fs b/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLSubscriptionsManagement.fs
index bc416f93a..7cd4ba431 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLSubscriptionsManagement.fs
+++ b/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLSubscriptionsManagement.fs
@@ -1,6 +1,6 @@
module internal FSharp.Data.GraphQL.Server.AspNetCore.GraphQLSubscriptionsManagement
-open FSharp.Data.GraphQL.Server.AspNetCore.WebSockets
+open FSharp.Data.GraphQL.Shared.WebSockets
let addSubscription
(id : SubscriptionId, unsubscriber : SubscriptionUnsubscriber, onUnsubscribe : OnUnsubscribeAction)
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLWebsocketMiddleware.fs b/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLWebsocketMiddleware.fs
index 09dd738d6..d06d0d559 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLWebsocketMiddleware.fs
+++ b/src/FSharp.Data.GraphQL.Server.AspNetCore/GraphQLWebsocketMiddleware.fs
@@ -20,7 +20,7 @@ open FsToolkit.ErrorHandling
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Execution
-open FSharp.Data.GraphQL.Server.AspNetCore.WebSockets
+open FSharp.Data.GraphQL.Shared.WebSockets
type GraphQLWebSocketMiddleware<'Root>
(
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/StartupExtensions.fs b/src/FSharp.Data.GraphQL.Server.AspNetCore/StartupExtensions.fs
index 15076e74c..3fe07840e 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/StartupExtensions.fs
+++ b/src/FSharp.Data.GraphQL.Server.AspNetCore/StartupExtensions.fs
@@ -17,7 +17,7 @@ module ServiceCollectionExtensions =
SchemaExecutor = executor
RootFactory = rootFactory
ReadBufferSize = GraphQLOptionsDefaults.ReadBufferSize
- SerializerOptions = Json.getWSSerializerOptions additionalConverters
+ SerializerOptions = Shared.Json.getWSSerializerOptions additionalConverters
WebsocketOptions = {
EndpointUrl = endpointUrl
ConnectionInitTimeout = TimeSpan.FromMilliseconds (GraphQLOptionsDefaults.WebSocketConnectionInitTimeoutInMs)
@@ -67,7 +67,7 @@ module ServiceCollectionExtensions =
// Use if you want to return HTTP responses using minmal APIs IResult interface
.Configure(
Action(fun o ->
- Json.configureDefaultSerializerOptions additionalConverters o.SerializerOptions
+ Shared.Json.configureDefaultSerializerOptions additionalConverters o.SerializerOptions
)
)
.AddSingleton>>(
diff --git a/src/FSharp.Data.GraphQL.Server/Execution.fs b/src/FSharp.Data.GraphQL.Server/Execution.fs
index 715507715..0c472d40b 100644
--- a/src/FSharp.Data.GraphQL.Server/Execution.fs
+++ b/src/FSharp.Data.GraphQL.Server/Execution.fs
@@ -13,12 +13,11 @@ open FSharp.Data.GraphQL.Ast
open FSharp.Data.GraphQL.Errors
open FSharp.Data.GraphQL.Extensions
open FSharp.Data.GraphQL.Helpers
+open FSharp.Data.GraphQL.Shared
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Types.Patterns
open FSharp.Data.GraphQL
-type Output = IDictionary
-
let (|RequestError|Direct|Deferred|Stream|) (response : GQLExecutionResult) =
match response.Content with
| RequestError errs -> RequestError errs
@@ -26,145 +25,6 @@ let (|RequestError|Direct|Deferred|Stream|) (response : GQLExecutionResult) =
| Deferred (data, errors, deferred) -> Deferred (data, errors, deferred)
| Stream data -> Stream data
-
-/// Name value lookup used as output to be serialized into JSON.
-/// It has a form of a dictionary with fixed set of keys. Values under keys
-/// can be set, but no new entry can be added or removed, once lookup
-/// has been initialized.
-/// This dictionary implements structural equality.
-type NameValueLookup(keyValues: KeyValuePair []) =
-
- let kvals = keyValues |> Array.distinctBy (fun kv -> kv.Key)
-
- let setValue key value =
- let mutable i = 0
- while i < kvals.Length do
- if kvals.[i].Key = key then
- kvals.[i] <- KeyValuePair(key, value)
- i <- Int32.MaxValue
- else i <- i+1
- let getValue key = (kvals |> Array.find (fun kv -> kv.Key = key)).Value
-
- let (|BoxedSeq|_|) (xs : obj) =
- match xs with
- | (:? System.Collections.IEnumerable as enumerable) -> Some (Seq.cast enumerable)
- | _ -> None
-
- let rec structEq (x: NameValueLookup) (y: NameValueLookup) =
- if Object.ReferenceEquals(x, y) then true
- elif Object.ReferenceEquals(y, null) then false
- elif Object.ReferenceEquals(x, null) then false
- elif x.Count <> y.Count then false
- else
- x.Buffer
- |> Array.forall2 (fun (a: KeyValuePair) (b: KeyValuePair) ->
- if a.Key <> b.Key then false
- else
- match a.Value, b.Value with
- | (:? NameValueLookup as x), (:? NameValueLookup as y) -> structEq x y
- | (BoxedSeq x), (BoxedSeq y) ->
- if Seq.length x <> Seq.length y then false else Seq.forall2 (=) x y
- | a1, b1 -> a1 = b1) y.Buffer
-
- let pad (sb: System.Text.StringBuilder) times =
- for _ in 0..times do sb.Append("\t") |> ignore
-
- let rec stringify (sb: System.Text.StringBuilder) deep (o:obj) =
- match o with
- | :? NameValueLookup as lookup ->
- if lookup.Count > 0 then
- sb.Append("{ ") |> ignore
- lookup.Buffer
- |> Array.iter (fun kv ->
- sb.Append(kv.Key).Append(": ") |> ignore
- stringify sb (deep+1) kv.Value
- sb.Append(",\r\n") |> ignore
- pad sb deep)
- sb.Remove(sb.Length - 4 - deep, 4 + deep).Append(" }") |> ignore
- | :? string as s ->
- sb.Append("\"").Append(s).Append("\"") |> ignore
- | :? System.Collections.IEnumerable as s ->
- sb.Append("[") |> ignore
- for i in s do
- stringify sb (deep + 1) i
- sb.Append(", ") |> ignore
- sb.Append("]") |> ignore
- | other ->
- if isNull other |> not
- then sb.Append(other.ToString()) |> ignore
- else sb.Append("null") |> ignore
- ()
- /// Returns raw content of the current lookup.
- member _.Buffer : KeyValuePair [] = kvals
-
- /// Return a number of entries stored in current lookup. It's fixed size.
- member _.Count = kvals.Length
-
- /// Updates an entry's value under given key. It will throw an exception
- /// if provided key cannot be found in provided lookup.
- member _.Update key value = setValue key value
-
- override x.Equals(other) =
- match other with
- | :? NameValueLookup as lookup -> structEq x lookup
- | _ -> false
-
- override _.GetHashCode() =
- let mutable hash = 0
- for kv in kvals do
- hash <- (hash*397) ^^^ (kv.Key.GetHashCode()) ^^^ (if isNull kv.Value then 0 else kv.Value.GetHashCode())
- hash
-
- override x.ToString() =
- let sb = Text.StringBuilder()
- stringify sb 1 x
- sb.ToString()
-
- interface IEquatable with
- member x.Equals(other) = structEq x other
-
- interface System.Collections.IEnumerable with
- member _.GetEnumerator() = (kvals :> System.Collections.IEnumerable).GetEnumerator()
-
- interface IEnumerable> with
- member _.GetEnumerator() = (kvals :> IEnumerable>).GetEnumerator()
-
- interface IDictionary with
- member _.Add(_, _) = raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
- member _.Add(_) = raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
- member _.Clear() = raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
- member _.Contains(item) = kvals |> Array.exists ((=) item)
- member _.ContainsKey(key) = kvals |> Array.exists (fun kv -> kv.Key = key)
- member _.CopyTo(array, arrayIndex) = kvals.CopyTo(array, arrayIndex)
- member x.Count = x.Count
- member _.IsReadOnly = true
- member _.Item
- with get (key) = getValue key
- and set (key) v = setValue key v
- member _.Keys = upcast (kvals |> Array.map (fun kv -> kv.Key))
- member _.Values = upcast (kvals |> Array.map (fun kv -> kv.Value))
- member _.Remove(_:string) =
- raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
- false
- member _.Remove(_:KeyValuePair) =
- raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
- false
- member _.TryGetValue(key, value) =
- match kvals |> Array.tryFind (fun kv -> kv.Key = key) with
- | Some kv -> value <- kv.Value; true
- | None -> value <- null; false
-
- new(t: (string * obj) list) =
- NameValueLookup(t |> List.map (fun (k, v) -> KeyValuePair(k, v)) |> List.toArray)
-
- new(t: string []) =
- NameValueLookup(t |> Array.map (fun k -> KeyValuePair(k, null)))
-
-module NameValueLookup =
- /// Create new NameValueLookup from given list of key-value tuples.
- let ofList (l: (string * obj) list) = NameValueLookup(l)
-
-
let private collectDefaultArgValue acc (argdef: InputFieldDef) =
match argdef.DefaultValue with
| Some defVal -> Map.add argdef.Name defVal acc
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 852fbd06b..8d270a060 100644
--- a/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj
+++ b/src/FSharp.Data.GraphQL.Shared/FSharp.Data.GraphQL.Shared.fsproj
@@ -39,6 +39,7 @@
+
@@ -58,6 +59,10 @@
+
+
+
+
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/GQLRequest.fs b/src/FSharp.Data.GraphQL.Shared/GQLRequest.fs
similarity index 95%
rename from src/FSharp.Data.GraphQL.Server.AspNetCore/GQLRequest.fs
rename to src/FSharp.Data.GraphQL.Shared/GQLRequest.fs
index 87aa9589d..2ce21f0a2 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/GQLRequest.fs
+++ b/src/FSharp.Data.GraphQL.Shared/GQLRequest.fs
@@ -1,4 +1,4 @@
-namespace FSharp.Data.GraphQL.Server.AspNetCore
+namespace FSharp.Data.GraphQL.Shared
open System.Collections.Immutable
open System.Text.Json
diff --git a/src/FSharp.Data.GraphQL.Shared/Output.fs b/src/FSharp.Data.GraphQL.Shared/Output.fs
new file mode 100644
index 000000000..c044f139f
--- /dev/null
+++ b/src/FSharp.Data.GraphQL.Shared/Output.fs
@@ -0,0 +1,143 @@
+namespace FSharp.Data.GraphQL.Shared
+
+open System.Collections.Generic
+open System
+
+type Output = IDictionary
+
+/// Name value lookup used as output to be serialized into JSON.
+/// It has a form of a dictionary with fixed set of keys. Values under keys
+/// can be set, but no new entry can be added or removed, once lookup
+/// has been initialized.
+/// This dictionary implements structural equality.
+type NameValueLookup(keyValues: KeyValuePair []) =
+
+ let kvals = keyValues |> Array.distinctBy (fun kv -> kv.Key)
+
+ let setValue key value =
+ let mutable i = 0
+ while i < kvals.Length do
+ if kvals.[i].Key = key then
+ kvals.[i] <- KeyValuePair(key, value)
+ i <- Int32.MaxValue
+ else i <- i+1
+ let getValue key = (kvals |> Array.find (fun kv -> kv.Key = key)).Value
+
+ let (|BoxedSeq|_|) (xs : obj) =
+ match xs with
+ | (:? System.Collections.IEnumerable as enumerable) -> Some (Seq.cast enumerable)
+ | _ -> None
+
+ let rec structEq (x: NameValueLookup) (y: NameValueLookup) =
+ if Object.ReferenceEquals(x, y) then true
+ elif Object.ReferenceEquals(y, null) then false
+ elif Object.ReferenceEquals(x, null) then false
+ elif x.Count <> y.Count then false
+ else
+ x.Buffer
+ |> Array.forall2 (fun (a: KeyValuePair) (b: KeyValuePair) ->
+ if a.Key <> b.Key then false
+ else
+ match a.Value, b.Value with
+ | (:? NameValueLookup as x), (:? NameValueLookup as y) -> structEq x y
+ | (BoxedSeq x), (BoxedSeq y) ->
+ if Seq.length x <> Seq.length y then false else Seq.forall2 (=) x y
+ | a1, b1 -> a1 = b1) y.Buffer
+
+ let pad (sb: System.Text.StringBuilder) times =
+ for _ in 0..times do sb.Append("\t") |> ignore
+
+ let rec stringify (sb: System.Text.StringBuilder) deep (o:obj) =
+ match o with
+ | :? NameValueLookup as lookup ->
+ if lookup.Count > 0 then
+ sb.Append("{ ") |> ignore
+ lookup.Buffer
+ |> Array.iter (fun kv ->
+ sb.Append(kv.Key).Append(": ") |> ignore
+ stringify sb (deep+1) kv.Value
+ sb.Append(",\r\n") |> ignore
+ pad sb deep)
+ sb.Remove(sb.Length - 4 - deep, 4 + deep).Append(" }") |> ignore
+ | :? string as s ->
+ sb.Append("\"").Append(s).Append("\"") |> ignore
+ | :? System.Collections.IEnumerable as s ->
+ sb.Append("[") |> ignore
+ for i in s do
+ stringify sb (deep + 1) i
+ sb.Append(", ") |> ignore
+ sb.Append("]") |> ignore
+ | other ->
+ if isNull other |> not
+ then sb.Append(other.ToString()) |> ignore
+ else sb.Append("null") |> ignore
+ ()
+ /// Returns raw content of the current lookup.
+ member _.Buffer : KeyValuePair [] = kvals
+
+ /// Return a number of entries stored in current lookup. It's fixed size.
+ member _.Count = kvals.Length
+
+ /// Updates an entry's value under given key. It will throw an exception
+ /// if provided key cannot be found in provided lookup.
+ member _.Update key value = setValue key value
+
+ override x.Equals(other) =
+ match other with
+ | :? NameValueLookup as lookup -> structEq x lookup
+ | _ -> false
+
+ override _.GetHashCode() =
+ let mutable hash = 0
+ for kv in kvals do
+ hash <- (hash*397) ^^^ (kv.Key.GetHashCode()) ^^^ (if isNull kv.Value then 0 else kv.Value.GetHashCode())
+ hash
+
+ override x.ToString() =
+ let sb = Text.StringBuilder()
+ stringify sb 1 x
+ sb.ToString()
+
+ interface IEquatable with
+ member x.Equals(other) = structEq x other
+
+ interface System.Collections.IEnumerable with
+ member _.GetEnumerator() = (kvals :> System.Collections.IEnumerable).GetEnumerator()
+
+ interface IEnumerable> with
+ member _.GetEnumerator() = (kvals :> IEnumerable>).GetEnumerator()
+
+ interface IDictionary with
+ member _.Add(_, _) = raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
+ member _.Add(_) = raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
+ member _.Clear() = raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
+ member _.Contains(item) = kvals |> Array.exists ((=) item)
+ member _.ContainsKey(key) = kvals |> Array.exists (fun kv -> kv.Key = key)
+ member _.CopyTo(array, arrayIndex) = kvals.CopyTo(array, arrayIndex)
+ member x.Count = x.Count
+ member _.IsReadOnly = true
+ member _.Item
+ with get (key) = getValue key
+ and set (key) v = setValue key v
+ member _.Keys = upcast (kvals |> Array.map (fun kv -> kv.Key))
+ member _.Values = upcast (kvals |> Array.map (fun kv -> kv.Value))
+ member _.Remove(_:string) =
+ raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
+ false
+ member _.Remove(_:KeyValuePair) =
+ raise (NotSupportedException "NameValueLookup doesn't allow to add/remove entries")
+ false
+ member _.TryGetValue(key, value) =
+ match kvals |> Array.tryFind (fun kv -> kv.Key = key) with
+ | Some kv -> value <- kv.Value; true
+ | None -> value <- null; false
+
+ new(t: (string * obj) list) =
+ NameValueLookup(t |> List.map (fun (k, v) -> KeyValuePair(k, v)) |> List.toArray)
+
+ new(t: string []) =
+ NameValueLookup(t |> Array.map (fun k -> KeyValuePair(k, null)))
+
+module NameValueLookup =
+ /// Create new NameValueLookup from given list of key-value tuples.
+ let ofList (l: (string * obj) list) = NameValueLookup(l)
\ No newline at end of file
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/Serialization/JSON.fs b/src/FSharp.Data.GraphQL.Shared/Serialization/JSON.fs
similarity index 97%
rename from src/FSharp.Data.GraphQL.Server.AspNetCore/Serialization/JSON.fs
rename to src/FSharp.Data.GraphQL.Shared/Serialization/JSON.fs
index 32dd59c7f..74515d556 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/Serialization/JSON.fs
+++ b/src/FSharp.Data.GraphQL.Shared/Serialization/JSON.fs
@@ -1,5 +1,5 @@
[]
-module FSharp.Data.GraphQL.Server.AspNetCore.Json
+module FSharp.Data.GraphQL.Shared.Json
open System.Text.Json
open System.Text.Json.Serialization
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/Serialization/JsonConverters.fs b/src/FSharp.Data.GraphQL.Shared/Serialization/JsonConverters.fs
similarity index 97%
rename from src/FSharp.Data.GraphQL.Server.AspNetCore/Serialization/JsonConverters.fs
rename to src/FSharp.Data.GraphQL.Shared/Serialization/JsonConverters.fs
index 69253da7b..88e83d62d 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/Serialization/JsonConverters.fs
+++ b/src/FSharp.Data.GraphQL.Shared/Serialization/JsonConverters.fs
@@ -1,11 +1,12 @@
-namespace FSharp.Data.GraphQL.Server.AspNetCore
+namespace FSharp.Data.GraphQL.Shared
open System
open System.Text.Json
open System.Text.Json.Serialization
open FSharp.Data.GraphQL
-open FSharp.Data.GraphQL.Server.AspNetCore.WebSockets
+open FSharp.Data.GraphQL.Shared
+open FSharp.Data.GraphQL.Shared.WebSockets
[]
type ClientMessageConverter () =
@@ -18,7 +19,7 @@ type ClientMessageConverter () =
let invalidMsg (explanation : string) = InvalidMessage (4400, explanation) |> Result.Error
let errMsgToStr (struct (docId : int, graphQLErrorMsgs : GQLProblemDetails list)) =
- String.Join ('\n', graphQLErrorMsgs |> Seq.map (fun err -> err.Message))
+ String.Join ("\n", graphQLErrorMsgs |> Seq.map (fun err -> err.Message))
let unpackRopResult ropResult =
match ropResult with
diff --git a/src/FSharp.Data.GraphQL.Server.AspNetCore/Messages.fs b/src/FSharp.Data.GraphQL.Shared/WebSockets.fs
similarity index 88%
rename from src/FSharp.Data.GraphQL.Server.AspNetCore/Messages.fs
rename to src/FSharp.Data.GraphQL.Shared/WebSockets.fs
index 93db7cd40..20b1c5403 100644
--- a/src/FSharp.Data.GraphQL.Server.AspNetCore/Messages.fs
+++ b/src/FSharp.Data.GraphQL.Shared/WebSockets.fs
@@ -1,10 +1,12 @@
-namespace FSharp.Data.GraphQL.Server.AspNetCore.WebSockets
+namespace FSharp.Data.GraphQL.Shared.WebSockets
open System
open System.Collections.Generic
open System.Text.Json
-open FSharp.Data.GraphQL.Execution
-open FSharp.Data.GraphQL.Server.AspNetCore
+open FSharp.Data.GraphQL.Shared
+
+type InvalidWebsocketMessageException (explanation : string) =
+ inherit System.Exception (explanation)
type SubscriptionId = string
type SubscriptionUnsubscriber = IDisposable
diff --git a/tests/FSharp.Data.GraphQL.IntegrationTests.Server/FSharp.Data.GraphQL.IntegrationTests.Server.fsproj b/tests/FSharp.Data.GraphQL.IntegrationTests.Server/FSharp.Data.GraphQL.IntegrationTests.Server.fsproj
index 3cfd70918..51f15be26 100644
--- a/tests/FSharp.Data.GraphQL.IntegrationTests.Server/FSharp.Data.GraphQL.IntegrationTests.Server.fsproj
+++ b/tests/FSharp.Data.GraphQL.IntegrationTests.Server/FSharp.Data.GraphQL.IntegrationTests.Server.fsproj
@@ -7,7 +7,6 @@
-
diff --git a/tests/FSharp.Data.GraphQL.IntegrationTests/introspection.json b/tests/FSharp.Data.GraphQL.IntegrationTests/introspection.json
index c3fe6fa10..fed38ddc5 100644
--- a/tests/FSharp.Data.GraphQL.IntegrationTests/introspection.json
+++ b/tests/FSharp.Data.GraphQL.IntegrationTests/introspection.json
@@ -1,5 +1,5 @@
{
- "documentId": -727244275,
+ "documentId": -837497709,
"data": {
"__schema": {
"queryType": {
diff --git a/tests/FSharp.Data.GraphQL.Tests/AbstractionTests.fs b/tests/FSharp.Data.GraphQL.Tests/AbstractionTests.fs
index e5d737d68..98297ab33 100644
--- a/tests/FSharp.Data.GraphQL.Tests/AbstractionTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/AbstractionTests.fs
@@ -10,7 +10,7 @@ open Xunit
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
type IPet =
interface
diff --git a/tests/FSharp.Data.GraphQL.Tests/AspNetCore/InvalidMessageTests.fs b/tests/FSharp.Data.GraphQL.Tests/AspNetCore/InvalidMessageTests.fs
index 076d39bde..f536da6c8 100644
--- a/tests/FSharp.Data.GraphQL.Tests/AspNetCore/InvalidMessageTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/AspNetCore/InvalidMessageTests.fs
@@ -2,8 +2,7 @@ module FSharp.Data.GraphQL.Tests.AspNetCore.InvalidMessageTests
open System.Text.Json
open Xunit
-open FSharp.Data.GraphQL.Server.AspNetCore
-open FSharp.Data.GraphQL.Server.AspNetCore.WebSockets
+open FSharp.Data.GraphQL.Shared.WebSockets
let toClientMessage (theInput : string) =
JsonSerializer.Deserialize (theInput, serializerOptions)
@@ -56,7 +55,7 @@ let ``Null payload json in subscribe message will result in invalid message`` ()
"payload": null
}
"""
- |> willResultInInvalidMessage "Invalid payload received: Failed to parse type FSharp.Data.GraphQL.Server.AspNetCore.GQLRequestContent: expected JSON object, found Null."
+ |> willResultInInvalidMessage "Invalid payload received: Failed to parse type FSharp.Data.GraphQL.Shared.GQLRequestContent: expected JSON object, found Null."
[]
let ``Payload type of number in subscribe message will result in invalid message`` () =
@@ -67,7 +66,7 @@ let ``Payload type of number in subscribe message will result in invalid message
}
"""
|> willResultInInvalidMessage
- "Invalid payload received: Failed to parse type FSharp.Data.GraphQL.Server.AspNetCore.GQLRequestContent: expected JSON object, found Number."
+ "Invalid payload received: Failed to parse type FSharp.Data.GraphQL.Shared.GQLRequestContent: expected JSON object, found Number."
[]
let ``No id in subscribe message will result in invalid message`` () =
@@ -89,7 +88,7 @@ let ``String payload wrongly used in subscribe will result in invalid message``
}
"""
|> willResultInInvalidMessage
- "Invalid payload received: Failed to parse type FSharp.Data.GraphQL.Server.AspNetCore.GQLRequestContent: expected JSON object, found String."
+ "Invalid payload received: Failed to parse type FSharp.Data.GraphQL.Shared.GQLRequestContent: expected JSON object, found String."
[]
let ``Id is incorrectly a number in a subscribe message will result in JsonException`` () =
diff --git a/tests/FSharp.Data.GraphQL.Tests/AspNetCore/SerializationTests.fs b/tests/FSharp.Data.GraphQL.Tests/AspNetCore/SerializationTests.fs
index c36faa8d0..3ba85567b 100644
--- a/tests/FSharp.Data.GraphQL.Tests/AspNetCore/SerializationTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/AspNetCore/SerializationTests.fs
@@ -3,8 +3,8 @@ module FSharp.Data.GraphQL.Tests.AspNetCore.SerializationTests
open Xunit
open System.Text.Json
open FSharp.Data.GraphQL.Ast
-open FSharp.Data.GraphQL.Server.AspNetCore
-open FSharp.Data.GraphQL.Server.AspNetCore.WebSockets
+open FSharp.Data.GraphQL.Shared
+open FSharp.Data.GraphQL.Shared.WebSockets
open System.Text.Json.Serialization
[]
diff --git a/tests/FSharp.Data.GraphQL.Tests/DeferredTests.fs b/tests/FSharp.Data.GraphQL.Tests/DeferredTests.fs
index c7278f49f..8c45c458a 100644
--- a/tests/FSharp.Data.GraphQL.Tests/DeferredTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/DeferredTests.fs
@@ -6,7 +6,7 @@ open System.Threading
open FSharp.Control
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
open FSharp.Data.GraphQL.Types
#nowarn "40"
diff --git a/tests/FSharp.Data.GraphQL.Tests/DirectivesTests.fs b/tests/FSharp.Data.GraphQL.Tests/DirectivesTests.fs
index 5ec6143bb..a46cc2856 100644
--- a/tests/FSharp.Data.GraphQL.Tests/DirectivesTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/DirectivesTests.fs
@@ -8,7 +8,7 @@ open Xunit
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
type Data = { A: string; B: string }
let data = { A = "a"; B = "b" }
diff --git a/tests/FSharp.Data.GraphQL.Tests/ExecutionTests.fs b/tests/FSharp.Data.GraphQL.Tests/ExecutionTests.fs
index 2f0e4e2a6..f4e745c80 100644
--- a/tests/FSharp.Data.GraphQL.Tests/ExecutionTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/ExecutionTests.fs
@@ -13,6 +13,7 @@ open System.Collections.Immutable
#nowarn "0040"
open FSharp.Data.GraphQL
+open FSharp.Data.GraphQL.Shared
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
open FSharp.Data.GraphQL.Execution
diff --git a/tests/FSharp.Data.GraphQL.Tests/ExecutorMiddlewareTests.fs b/tests/FSharp.Data.GraphQL.Tests/ExecutorMiddlewareTests.fs
index f86e123db..3cfa0f0c6 100644
--- a/tests/FSharp.Data.GraphQL.Tests/ExecutorMiddlewareTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/ExecutorMiddlewareTests.fs
@@ -2,6 +2,7 @@ module FSharp.Data.GraphQL.Tests.ExecutorMiddlewareTests
open Xunit
open FSharp.Data.GraphQL
+open FSharp.Data.GraphQL.Shared
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Types.Patterns
open FSharp.Data.GraphQL.Parser
diff --git a/tests/FSharp.Data.GraphQL.Tests/Helpers and Extensions/NameValueLookupTests.fs b/tests/FSharp.Data.GraphQL.Tests/Helpers and Extensions/NameValueLookupTests.fs
index 33cdee3f2..339419dfb 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Helpers and Extensions/NameValueLookupTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Helpers and Extensions/NameValueLookupTests.fs
@@ -2,7 +2,7 @@
open Helpers
open Xunit
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
[]
let ``Lookups containing different lists as inner items should not be equal`` () =
diff --git a/tests/FSharp.Data.GraphQL.Tests/Helpers.fs b/tests/FSharp.Data.GraphQL.Tests/Helpers.fs
index d536d1dff..74baef05f 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Helpers.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Helpers.fs
@@ -11,9 +11,8 @@ open System.Threading
open System.Threading.Tasks
open Xunit
open FSharp.Data.GraphQL
-open FSharp.Data.GraphQL.Server.AspNetCore
-let serializerOptions = Json.getWSSerializerOptions Seq.empty
+let serializerOptions = Shared.Json.getWSSerializerOptions Seq.empty
let isType<'a> actual = Assert.IsAssignableFrom<'a>(actual)
let isSeq<'a> actual = isType<'a seq> actual
diff --git a/tests/FSharp.Data.GraphQL.Tests/IntrospectionTests.fs b/tests/FSharp.Data.GraphQL.Tests/IntrospectionTests.fs
index 195e24a11..a7fd9c052 100644
--- a/tests/FSharp.Data.GraphQL.Tests/IntrospectionTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/IntrospectionTests.fs
@@ -14,7 +14,7 @@ open FSharp.Data.GraphQL.Server.AspNetCore
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
open FSharp.Data.GraphQL.Types.Introspection
type IntrospectionResult = {
diff --git a/tests/FSharp.Data.GraphQL.Tests/MiddlewareTests.fs b/tests/FSharp.Data.GraphQL.Tests/MiddlewareTests.fs
index 5731ebd54..7aa9893a9 100644
--- a/tests/FSharp.Data.GraphQL.Tests/MiddlewareTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/MiddlewareTests.fs
@@ -5,6 +5,7 @@ open Xunit
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Server.Middleware
+open FSharp.Data.GraphQL.Shared
open FSharp.Data.GraphQL.Parser
open FSharp.Data.GraphQL.Execution
open FSharp.Data.GraphQL.Ast
diff --git a/tests/FSharp.Data.GraphQL.Tests/MutationTests.fs b/tests/FSharp.Data.GraphQL.Tests/MutationTests.fs
index def1055f7..5d1ac5ef5 100644
--- a/tests/FSharp.Data.GraphQL.Tests/MutationTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/MutationTests.fs
@@ -7,6 +7,7 @@ open System
open Xunit
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
+open FSharp.Data.GraphQL.Shared
open FSharp.Data.GraphQL.Parser
open FSharp.Data.GraphQL.Execution
diff --git a/tests/FSharp.Data.GraphQL.Tests/Relay/ConnectionTests.fs b/tests/FSharp.Data.GraphQL.Tests/Relay/ConnectionTests.fs
index 799b956aa..39c344723 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Relay/ConnectionTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Relay/ConnectionTests.fs
@@ -10,6 +10,7 @@ open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Execution
open FSharp.Data.GraphQL.Server.Relay
+open FSharp.Data.GraphQL.Shared
type Pet =
| Cat of name : string * barks : bool
diff --git a/tests/FSharp.Data.GraphQL.Tests/Relay/NodeTests.fs b/tests/FSharp.Data.GraphQL.Tests/Relay/NodeTests.fs
index 9a8918f92..540866ae9 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Relay/NodeTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Relay/NodeTests.fs
@@ -11,6 +11,7 @@ open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Execution
open FSharp.Data.GraphQL.Server.Relay
+open FSharp.Data.GraphQL.Shared
type Person = { Id : string; Name : string; Age : int }
type Car = { Id : string; Model : string }
diff --git a/tests/FSharp.Data.GraphQL.Tests/ResolveTests.fs b/tests/FSharp.Data.GraphQL.Tests/ResolveTests.fs
index 679cc301d..b1dfbf576 100644
--- a/tests/FSharp.Data.GraphQL.Tests/ResolveTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/ResolveTests.fs
@@ -8,7 +8,7 @@ open Xunit
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
type TestData = {
Test : string
diff --git a/tests/FSharp.Data.GraphQL.Tests/SchemaTests.fs b/tests/FSharp.Data.GraphQL.Tests/SchemaTests.fs
index 3283de540..bf04b8322 100644
--- a/tests/FSharp.Data.GraphQL.Tests/SchemaTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/SchemaTests.fs
@@ -6,7 +6,7 @@ module FSharp.Data.GraphQL.Tests.SchemaTests
open Xunit
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
[]
let ``Object type must be able to merge fields with matching signatures from different interfaces`` () =
diff --git a/tests/FSharp.Data.GraphQL.Tests/SubscriptionTests.fs b/tests/FSharp.Data.GraphQL.Tests/SubscriptionTests.fs
index dcffe583a..398d2ddb4 100644
--- a/tests/FSharp.Data.GraphQL.Tests/SubscriptionTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/SubscriptionTests.fs
@@ -4,6 +4,7 @@ open Xunit
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Parser
open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
open FSharp.Data.GraphQL.Types
type Value =
diff --git a/tests/FSharp.Data.GraphQL.Tests/UnionInterfaceTests.fs b/tests/FSharp.Data.GraphQL.Tests/UnionInterfaceTests.fs
index 01d34cf32..e1c344142 100644
--- a/tests/FSharp.Data.GraphQL.Tests/UnionInterfaceTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/UnionInterfaceTests.fs
@@ -9,7 +9,7 @@ open System
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
type INamed =
interface
diff --git a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputComplexTests.fs b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputComplexTests.fs
index 86c3d4913..d0fb398e0 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputComplexTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputComplexTests.fs
@@ -16,6 +16,7 @@ open FSharp.Data.GraphQL.Ast
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
open ErrorHelpers
let TestComplexScalar =
diff --git a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputEnumTests.fs b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputEnumTests.fs
index 6ef3387ad..82651cb0d 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputEnumTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputEnumTests.fs
@@ -13,7 +13,7 @@ open System.Text.Json
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
let stringifyArg name (ctx : ResolveFieldContext) () =
let arg = ctx.TryArg name |> Option.toObj
diff --git a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputListTests.fs b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputListTests.fs
index 96c0d3ea0..a5ecf858d 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputListTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputListTests.fs
@@ -13,7 +13,7 @@ open System.Text.Json
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
open ErrorHelpers
let stringifyArg name (ctx : ResolveFieldContext) () =
diff --git a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputNestedTests.fs b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputNestedTests.fs
index 99331364c..15de95bf9 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputNestedTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputNestedTests.fs
@@ -12,7 +12,7 @@ open System.Text.Json
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
let InputArrayOf (innerDef : #TypeDef<'Val>) : ListOfDef<'Val, 'Val array> = ListOf innerDef
diff --git a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputNullableStringTests.fs b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputNullableStringTests.fs
index 5d4288b87..9f84587ff 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputNullableStringTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputNullableStringTests.fs
@@ -13,7 +13,7 @@ open System.Text.Json
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
open ErrorHelpers
let stringifyArg name (ctx : ResolveFieldContext) () =
diff --git a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputScalarAndAutoFieldScalarTests.fs b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputScalarAndAutoFieldScalarTests.fs
index 0c16b2f53..186202a50 100644
--- a/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputScalarAndAutoFieldScalarTests.fs
+++ b/tests/FSharp.Data.GraphQL.Tests/Variables and Inputs/InputScalarAndAutoFieldScalarTests.fs
@@ -11,7 +11,7 @@ open System.Text.Json.Serialization
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types
open FSharp.Data.GraphQL.Parser
-open FSharp.Data.GraphQL.Execution
+open FSharp.Data.GraphQL.Shared
type InputRecord = InputRecordTests.InputRecord