NewtonsoftParityEnumConverter
Namespace: Meshmakers.Octo.Runtime.Contracts.Serialization
System.Text.Json enum converter that matches Newtonsoft's enum wire form: a plain CLR enum is
WRITTEN as its underlying integer (Newtonsoft's serializer has no StringEnumConverter),
and is READ from EITHER the integer OR the member-name string (Newtonsoft's reader is lenient).
public sealed class NewtonsoftParityEnumConverter : JsonConverterFactory
Inheritance Object → JsonConverter → JsonConverterFactory → NewtonsoftParityEnumConverter
Remarks:
This is the enum sibling of NewtonsoftParityDoubleConverter /
NewtonsoftParitySingleConverter / NewtonsoftParityDecimalConverter: all
exist purely so RtSystemTextJsonSerializer produces the same bytes as its Newtonsoft
twin RtNewtonsoftSerializer. It replaces a that emitted
the member NAME — a parity regression: SystemTextJsonOptions.Default (octo-sdk) derives from
this bundle and feeds the ETL pipeline DataContext, so a CLR enum (e.g. the EDA adapter's
EnergyDirection) surfaced as "Consumption" instead of 1, breaking pipeline
consumers that read it as Int (DataMapping@1 sourceValueType: Int, If@1/Switch@1 valueType: Int).
Write emits the underlying integer; read accepts a number, a member-name string (case-insensitive), or a numeric string — keeping the historical Newtonsoft read tolerance so externally-supplied name-form payloads (e.g. inbound EDA process data) still deserialize.
Properties
Type
public Type Type { get; }
Property Value
Constructors
NewtonsoftParityEnumConverter()
public NewtonsoftParityEnumConverter()
Methods
CanConvert(Type)
public bool CanConvert(Type typeToConvert)
Parameters
typeToConvert Type
Returns
CreateConverter(Type, JsonSerializerOptions)
public JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
Parameters
typeToConvert Type
options JsonSerializerOptions
Returns
JsonConverter