From dc4a5f37dcd28b7bdd824ddb631a44289bf4f652 Mon Sep 17 00:00:00 2001 From: Oskar Gewalli Date: Mon, 24 Oct 2022 22:17:05 +0300 Subject: [PATCH 1/2] Add JsonValue signature file --- .../FSharp.Data.GraphQL.Client.fsproj | 1 + src/FSharp.Data.GraphQL.Client/JsonValue.fs | 3 -- src/FSharp.Data.GraphQL.Client/JsonValue.fsi | 51 +++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 src/FSharp.Data.GraphQL.Client/JsonValue.fsi 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 87a6f3a98..5f7714765 100644 --- a/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj +++ b/src/FSharp.Data.GraphQL.Client/FSharp.Data.GraphQL.Client.fsproj @@ -23,6 +23,7 @@ + diff --git a/src/FSharp.Data.GraphQL.Client/JsonValue.fs b/src/FSharp.Data.GraphQL.Client/JsonValue.fs index fc8efe51d..ad5119009 100644 --- a/src/FSharp.Data.GraphQL.Client/JsonValue.fs +++ b/src/FSharp.Data.GraphQL.Client/JsonValue.fs @@ -40,9 +40,6 @@ type JsonValue = | Boolean of bool | Null - /// - [] - [] member x._Print = let str = x.ToString() if str.Length > 512 then str.Substring(0, 509) + "..." diff --git a/src/FSharp.Data.GraphQL.Client/JsonValue.fsi b/src/FSharp.Data.GraphQL.Client/JsonValue.fsi new file mode 100644 index 000000000..f7ca6f5e8 --- /dev/null +++ b/src/FSharp.Data.GraphQL.Client/JsonValue.fsi @@ -0,0 +1,51 @@ +namespace FSharp.Data.GraphQL.Client +open System.ComponentModel + /// Specifies the formatting behaviour of JSON values. + [] + type JsonSaveOptions = + | None = 0 + | DisableFormatting = 1 + + /// Represents a JSON value. Large numbers that do not fit in the + /// Decimal type are represented using the Float case, while + /// smaller numbers are represented as decimals to avoid precision loss. + [] + type JsonValue = + | Integer of int + | String of string + | Float of float + | Record of properties: (string * JsonValue)[] + | Array of elements: JsonValue[] + | Boolean of bool + | Null + + static member + internal JsonStringEncodeTo: w: System.IO.TextWriter -> + value: string -> unit + + /// Parses the specified JSON string. + static member Parse: text: string -> JsonValue + + /// Attempts to parse the specified JSON string. + static member TryParse: text: string -> JsonValue option + + override ToString: unit -> string + + member ToString: saveOptions: JsonSaveOptions -> string + + /// Serializes the JsonValue to the specified System.IO.TextWriter. + member + WriteTo: w: System.IO.TextWriter * saveOptions: JsonSaveOptions -> + unit + + /// + [] + member _Print: string + + type private JsonParser = + + new: jsonText: string -> JsonParser + + member Parse: unit -> JsonValue + From a4e394f95f53b23a88c7f4195270b003c2dfb194 Mon Sep 17 00:00:00 2001 From: Oskar Gewalli Date: Mon, 24 Oct 2022 22:18:24 +0300 Subject: [PATCH 2/2] No need for price type --- src/FSharp.Data.GraphQL.Client/JsonValue.fsi | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/FSharp.Data.GraphQL.Client/JsonValue.fsi b/src/FSharp.Data.GraphQL.Client/JsonValue.fsi index f7ca6f5e8..eddb9de91 100644 --- a/src/FSharp.Data.GraphQL.Client/JsonValue.fsi +++ b/src/FSharp.Data.GraphQL.Client/JsonValue.fsi @@ -43,9 +43,3 @@ open System.ComponentModel CompilerMessageAttribute("This property is intended for use in generated code only.", 10001, IsHidden=true, IsError=false)>] member _Print: string - type private JsonParser = - - new: jsonText: string -> JsonParser - - member Parse: unit -> JsonValue -