Skip to content

net11.0: Option/Result refusal and value-object JSON under System.Text.Json's union support #213

Open

Description

@CaffeinatedCoder

Goal

Show that the System.Text.Json guarantees hold under .NET 11's union support. These checks are owed by the net11.0 target (#208).

.NET 11's System.Text.Json serializes unions: it writes the active case with no wrapper, picks a case by JSON token type by default, takes [JsonUnion] with a structural classifier, and adds InferClosedTypePolymorphism for closed hierarchies (union types).

Checks

  1. Option and Result still refuse. A union with an Option<T> or a Result<T, TError> case, written and read, must throw through NotWireTypeJsonConverterFactory and never write {}. Check this under reflection and under a source-generated context, and under InferClosedTypePolymorphism for a closed base with an Option property. If the refusal doesn't hold, that's a silent bug filed on its own.
  2. A value object as a union case moved to net11.0: a union over value objects, in a woven project, keeps its JSON and OpenAPI schema (Metalama 2027) #272 on 2026-10-31. Declaring a union over value objects needs a woven project at C# 15, which Metalama 2026.1 doesn't give (decision 120); it waits for Move the Generators package to Metalama 2027.0 in 2.4.0 (decisions 120 and 129) #173, which decision 129 moved into 2.4.0.
  3. No refusal quotes the input when a union case is a value object whose read fails (UnreadableInputTests), with the union declared in a test assembly without the Generators package, the shape a consumer without the Generators package reaches.

Done when

The checks are tests in the net11.0 test run, each shown caught by a seeded defect (verify-the-guard). Each disagreement is an issue of its own, or a candidate in test/oracles/candidates.json with its issue.

Activity

  1. added this to the 2.4.0 milestone on Oct 30, 2026
  2. added
    tests
    package/core
    area/value-objects
    area/json
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/jsonarea/value-objectspackage/coretests

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions