review(Driver.OpcUaClient.Browser): add JsonStringEnumConverter (systemic enum bug)

Cross-module fix from the review sweep. -003 (Medium): the browser's JsonOpts lacked
JsonStringEnumConverter (the factory+probe both carry it), so AdminUI string-enum configs
(AuthType/SecurityPolicy/SecurityMode/TargetNamespaceKind) threw on deserialize. Added the
converter (accepts string AND numeric) + TDD.
This commit is contained in:
Joseph Doherty
2026-06-19 12:29:39 -04:00
parent 7e1f34da7d
commit 298bd4bfe5
4 changed files with 86 additions and 5 deletions
@@ -19,10 +19,10 @@ public sealed class OpcUaClientBrowseSessionTests
private static string Endpoint =>
Environment.GetEnvironmentVariable("OPCUA_SIM_ENDPOINT") ?? "opc.tcp://10.100.0.35:50000";
// Enum values use their numeric ordinal because the browser uses default
// System.Text.Json with no JsonStringEnumConverter. SecurityPolicy.None,
// SecurityMode.None, OpcUaAuthType.Anonymous are all index 0, so omitting them
// also works — keeping them explicit for documentation value.
// SecurityPolicy.None, SecurityMode.None, OpcUaAuthType.Anonymous are all
// index 0 and can also be written as string names now that the browser carries
// JsonStringEnumConverter (Driver.OpcUaClient.Browser-003). Numeric ordinals are
// kept here as they were before the fix — both forms are accepted.
private static string ConfigJson => $$"""
{
"EndpointUrl":"{{Endpoint}}",