ProtoJson Module
Serialisation for the generated wire types, and the typed request helpers built on it.
Functions and values
| Function or value |
Description
|
Full Usage:
ProtoJson.batchEntry method parameters
Parameters:
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.
|
|
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.
|
Full Usage:
ProtoJson.deserialize bytes
Parameters:
byte[]
Returns: 'T
Type parameters: 'T |
|
Full Usage:
ProtoJson.isAbsent bytes
Parameters:
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.
|
|
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.
|
Full Usage:
ProtoJson.request channel method parameters
Parameters:
TscChannel
method : string
parameters : 'Params
Returns: 'Result
Type parameters: 'Params, 'Result |
A request whose result the schema says is always present.
|
Full Usage:
ProtoJson.requestAst channel method parameters
Parameters:
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.
|
Full Usage:
ProtoJson.requestNoParams channel method
Parameters:
TscChannel
method : string
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.
|
Full Usage:
ProtoJson.requestOption channel method parameters
Parameters:
TscChannel
method : string
parameters : 'Params
Returns: 'Result voption
Type parameters: 'Params, 'Result |
A request whose result the schema permits to be null.
|
Full Usage:
ProtoJson.requestUnit channel method parameters
Parameters:
TscChannel
method : string
parameters : 'Params
Type parameters: 'Params |
A request that returns nothing.
|
Full Usage:
ProtoJson.serialize value
Parameters:
'T
Returns: byte[]
Type parameters: 'T |
|