Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify signature file for JsonValue #400

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<ItemGroup>
<Compile Include="MimeTypes.fs" />
<Compile Include="TextConversions.fs" />
<Compile Include="JsonValue.fsi" />
<Compile Include="JsonValue.fs" />
<Compile Include="Extensions.fs" />
<Compile Include="Schema.fs" />
Expand Down
3 changes: 0 additions & 3 deletions src/FSharp.Data.GraphQL.Client/JsonValue.fs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ type JsonValue =
| Boolean of bool
| Null

/// <exclude />
[<EditorBrowsableAttribute(EditorBrowsableState.Never)>]
[<CompilerMessageAttribute("This property is intended for use in generated code only.", 10001, IsHidden=true, IsError=false)>]
member x._Print =
let str = x.ToString()
if str.Length > 512 then str.Substring(0, 509) + "..."
Expand Down
45 changes: 45 additions & 0 deletions src/FSharp.Data.GraphQL.Client/JsonValue.fsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
namespace FSharp.Data.GraphQL.Client
open System.ComponentModel
/// Specifies the formatting behaviour of JSON values.
[<RequireQualifiedAccess; Struct>]
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.
[<RequireQualifiedAccess; StructuredFormatDisplay ("{_Print}")>]
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

/// <exclude />
[<EditorBrowsableAttribute(EditorBrowsableState.Never);
CompilerMessageAttribute("This property is intended for use in generated code only.", 10001, IsHidden=true, IsError=false)>]
member _Print: string