Table of Contents

Class JobStateJsonConverter

Namespace
DatabentoDotNet.Historical.Json
Assembly
DatabentoDotNet.Historical.dll

Reads and writes JobState as its wire string.

public sealed class JobStateJsonConverter : JsonConverter<JobState>
Inheritance
JobStateJsonConverter
Inherited Members

Remarks

An unrecognised state throws rather than yielding default, for the reason SchemaJsonConverter gives about Schema: the zero value here is Received, a perfectly ordinary state, so a silent fallback would be indistinguishable from a real job that has just been accepted.

Throwing is what turns Databento adding an eighth state into a visible failure. JobState already has three members upstream lacks, found by asking the API rather than by reading its client; the same widening will be needed again one day, and it should arrive as an exception naming the unknown spelling rather than as a listing in which some jobs are quietly Received.

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type JobState.

public override JobState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader

The reader.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

An object that specifies serialization options to use.

Returns

JobState

The converted value.

Write(Utf8JsonWriter, JobState, JsonSerializerOptions)

Writes a specified value as JSON.

public override void Write(Utf8JsonWriter writer, JobState value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter

The writer to write to.

value JobState

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.