FixPortal.FixAtdl.Contracts
1.4.0
dotnet add package FixPortal.FixAtdl.Contracts --version 1.4.0
NuGet\Install-Package FixPortal.FixAtdl.Contracts -Version 1.4.0
<PackageReference Include="FixPortal.FixAtdl.Contracts" Version="1.4.0" />
<PackageVersion Include="FixPortal.FixAtdl.Contracts" Version="1.4.0" />
<PackageReference Include="FixPortal.FixAtdl.Contracts" />
paket add FixPortal.FixAtdl.Contracts --version 1.4.0
#r "nuget: FixPortal.FixAtdl.Contracts, 1.4.0"
#:package FixPortal.FixAtdl.Contracts@1.4.0
#addin nuget:?package=FixPortal.FixAtdl.Contracts&version=1.4.0
#tool nuget:?package=FixPortal.FixAtdl.Contracts&version=1.4.0
FixPortal.FixAtdl.Contracts
The JSON contract consumed by
@fix-portal/fixatdl-react,
produced from a FIXatdl document parsed by
FixPortal.FixAtdl.
It contains:
- the DTO records the React package renders (
AtdlStrategiesDto,AtdlStrategyDto,AtdlParameterDto,AtdlPanelDto,AtdlControlDto,StateRuleAstNodeDto, ...); AtdlDtoMapper, which maps a parsedStrategies_tto those records, including each control's state rules as an AST;StateRuleEvaluator, which evaluates the same AST server-side, so a host can apply the rules the form applied;AtdlContractJson.Options, the serializer settings the React package expects (camelCase, null members omitted).
Usage
dotnet add package FixPortal.FixAtdl.Contracts
using System.Text.Json;
using FixPortal.FixAtdl.Contracts;
using FixPortal.FixAtdl.Xml;
using var stream = File.OpenRead("strategies.xml");
var strategies = new StrategiesReader().Load(stream);
AtdlStrategiesDto contract = new AtdlDtoMapper().Map(strategies);
string json = JsonSerializer.Serialize(contract, AtdlContractJson.Options);
Serve json to the browser and pass a strategy from it to the React form.
Map takes an optional IReadOnlyDictionary<string, string> of source XML per
strategy name, which populates each strategy's sourceXml. Without it,
sourceXml is an empty string; the form does not need it.
Mapping throws AtdlParseException for a document whose state rules cannot be
built (an unresolved EditRef, an unknown operator, an invalid literal, a
strategy edit with neither Edit nor EditRef, or nesting deeper than the
supported limit). Code carries a machine-readable reason from
AtdlParseExceptionCode.
A compare against a non-numeric FIX_ field carries comparisonType String_t,
so a zero-padded identifier is not compared as a number. A numeric FIX_ field
omits comparisonType and still compares as a number. A compare between a
Boolean_t parameter and another field carries trueWireValue and
falseWireValue (default Y and N); StateRuleEvaluator matches those tokens
with an ordinal comparison. AND and OR return as soon as the result is known.
The corpus cases and_short_circuit_skips_invalid_data_operand and
or_short_circuit_skips_invalid_data_operand pin that result for C#. The React
evaluator does not yet.
State-rule corpus
The evaluator is held to the shared corpus
contracts/state-rule-cases.json,
the same cases the React package's TypeScript evaluator runs against.
Licence
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FixPortal.FixAtdl (>= 1.4.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- NodaTime (>= 3.3.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.