Skip to content

Pin multi-outcome command responses against Arc for .NET - #91

Merged
woksin merged 9 commits into
mainfrom
feature/bounded-multi-outcome
Sep 26, 2026
Merged

woksin merged 9 commits into
mainfrom
feature/bounded-multi-outcome

Conversation

@woksin

@woksin woksin commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Arc for TypeScript 0.39.0 pins how commands with several possible outcomes behave on the wire against Arc for .NET, and lets the proxy generator accept outcome alternatives that share one client type. npm publication remains disabled.

Added

  • Paired conformance checks against Arc for .NET 22.23.0 for commands whose handlers return OneOf/Result alternatives: a DTO or primitive answers 200 with it as response, a validation branch answers 400, a denial 403, a tuple's validation result replaces its response, and no discriminator is added to the wire. An arbitrary Result error DTO in .NET is an ordinary 200 response; in TypeScript, return it with response(...) to get the same result, or use rejected(...)/denied(...) for failures. The suite now runs 279 checks.

Changed

  • The proxy generator analyzes every execution path of a command's return type, including Outcome helpers, promises, aliases and nested tuples, and accepts alternatives that resolve to the same client type. Literal unions such as boolean, enums and 'a' | 'b', with or without null/undefined, keep their full type, distinct concepts fall back to their shared primitive, and arrays that mix Chronicle event types are omitted from the client response as before.
  • Alternatives that need different client types, including two structurally identical but distinct DTO classes, now fail generation with guidance to return one response DTO with a status field. Arc for .NET's generator picks one of them instead, which the client can't decode reliably.
  • Generated metadata for queries returning boolean, enums or literal unions now names the element type, so OpenAPI describes their data.
  • The command outcomes guide describes how to model several business outcomes.

Refs #90

@woksin woksin added the minor New backward-compatible capabilities label Sep 26, 2026
@woksin woksin self-assigned this Sep 26, 2026
…-outcome

# Conflicts:
#	ContractTests/Client/package.json
#	Documentation/index.md
#	Documentation/reference/packages.md
#	README.md
#	Source/Chronicle/package.json
#	Source/CodeAnalysis/package.json
#	Source/Core/package.json
#	Source/Cratis/package.json
#	Source/Drizzle/package.json
#	Source/Express/package.json
#	Source/Fastify/package.json
#	Source/Hono/package.json
#	Source/MongoDB/package.json
#	Source/Testing/package.json
#	Source/Tools/ProxyGenerator/package.json
#	yarn.lock
@woksin
woksin merged commit c3f1956 into main Sep 26, 2026
3 checks passed
@cratis-direct
cratis-direct Bot deleted the feature/bounded-multi-outcome branch September 26, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New backward-compatible capabilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant