Logo Xantham

ProtoJson Module

Serialisation for the generated wire types, and the typed request helpers built on it.

Functions and values

Function or value Description

ProtoJson.batchEntry method parameters

Full Usage: ProtoJson.batchEntry method parameters

Parameters:
    method : string
    parameters : 'Params

Returns: BatchRequest
Type parameters: 'Params

Encodes any parameter record for use as `BatchRequest.Params`. The field is raw UTF-8 JSON, so a batch entry carries byte-for-byte what the single-shot call would have sent - there is no second encoding to keep in step, and every parameter type works here without the generator knowing anything about batching.

method : string
parameters : 'Params
Returns: BatchRequest

ProtoJson.batchEntryNoParams method

Full Usage: ProtoJson.batchEntryNoParams method

Parameters:
    method : string

Returns: BatchRequest

A batch entry for one of the methods the schema types as taking no parameters. The payload is left absent rather than sent as a literal null, which is what those methods expect inside a batch.

method : string
Returns: BatchRequest

ProtoJson.deserialize bytes

Full Usage: ProtoJson.deserialize bytes

Parameters:
    bytes : byte[]

Returns: 'T
Type parameters: 'T
bytes : byte[]
Returns: 'T

ProtoJson.isAbsent bytes

Full Usage: ProtoJson.isAbsent bytes

Parameters:
    bytes : byte[]

Returns: bool

An empty payload is the server's `undefined`; a literal `null` is its `null`. Both mean "no result" to a caller, and both must be caught before `Deserialize` sees them - asking for a record and getting null back yields a null record rather than an exception.

bytes : byte[]
Returns: bool

ProtoJson.options

Full Usage: ProtoJson.options

Returns: JsonSerializerOptions

The only sanctioned options for wire types. The generated records carry explicit `JsonPropertyName` attributes rather than relying on a naming policy, so the wire names are pinned even where they are not a plain camel-casing of the F# name.

Returns: JsonSerializerOptions

ProtoJson.request channel method parameters

Full Usage: ProtoJson.request channel method parameters

Parameters:
    channel : TscChannel
    method : string
    parameters : 'Params

Returns: 'Result
Type parameters: 'Params, 'Result

A request whose result the schema says is always present.

channel : TscChannel
method : string
parameters : 'Params
Returns: 'Result

ProtoJson.requestAst channel method parameters

Full Usage: ProtoJson.requestAst channel method parameters

Parameters:
    channel : TscChannel
    method : string
    parameters : 'Params

Returns: SourceFile voption
Type parameters: 'Params

The four AST-returning methods. The schema types their result as `SourceFileResponse = { data: string }`, a base64 blob in a JSON envelope. That describes the compiler's *async* client, which speaks JSON-RPC and so has no way to carry raw bytes - it base64s them into an envelope and decodes on arrival. This is the sync client: the msgpack transport carries bytes natively, so the AST arrives raw, with no envelope and no base64, and goes straight to the decoder.

channel : TscChannel
method : string
parameters : 'Params
Returns: SourceFile voption

ProtoJson.requestNoParams channel method

Full Usage: ProtoJson.requestNoParams channel method

Parameters:
Returns: 'Result voption
Type parameters: 'Result

A request taking no parameters. The schema types these as `null`, and the server rejects an empty payload, so the four bytes are required.

channel : TscChannel
method : string
Returns: 'Result voption

ProtoJson.requestOption channel method parameters

Full Usage: ProtoJson.requestOption channel method parameters

Parameters:
    channel : TscChannel
    method : string
    parameters : 'Params

Returns: 'Result voption
Type parameters: 'Params, 'Result

A request whose result the schema permits to be null.

channel : TscChannel
method : string
parameters : 'Params
Returns: 'Result voption

ProtoJson.requestUnit channel method parameters

Full Usage: ProtoJson.requestUnit channel method parameters

Parameters:
    channel : TscChannel
    method : string
    parameters : 'Params

Type parameters: 'Params

A request that returns nothing.

channel : TscChannel
method : string
parameters : 'Params

ProtoJson.serialize value

Full Usage: ProtoJson.serialize value

Parameters:
    value : 'T

Returns: byte[]
Type parameters: 'T
value : 'T
Returns: byte[]

Type something to start searching.