Skip to content

refactor(binder): rename complex AsOptional to AsOptionalReference - #180

Merged
Reefact merged 1 commit into
mainfrom
claude/issue-146-rename-asoptionalreference
Jul 18, 2026
Merged

refactor(binder): rename complex AsOptional to AsOptionalReference#180
Reefact merged 1 commit into
mainfrom
claude/issue-146-rename-asoptionalreference

Conversation

@Reefact

@Reefact Reefact commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

Rename the reference-constrained ComplexProperty.AsOptional to AsOptionalReference (issue #146, request binder review finding 10/19), matching the scalar side and keeping AsOptionalValue free for a future value-type nested object — a free rename now, while the library is 0.1.0-preview.1 with no published consumers.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Analyzer / diagnostic change
  • Tests
  • Documentation
  • Build / CI / tooling

Changes

  • Rename ComplexPropertyConverter.AsOptional — constrained where TProperty : class, returning OptionalReferenceField<T> — to AsOptionalReference, matching the scalar AsOptionalReference / AsOptionalValue split, and update its XML doc. Under the old name a future value-type variant could not reuse AsOptional (two methods differing only by a class vs struct constraint do not overload, CS0111).
  • Update the call sites — all in tests: ComplexPropertyBindingTests, BookingEndToEndTests, BindingContractTests.
  • Update the binder reference docs (RequestBinder.en.md + RequestBinder.fr.md).
  • The three list converters' AsOptional are intentionally left unchanged: they are notnull and mean "an absent list binds an empty list", with no reference/value split to disambiguate — so they carry no CS0111 dead end.

Testing

  • dotnet build FirstClassErrors.sln
  • dotnet test FirstClassErrors.sln
  • Analyzer tests pass (FirstClassErrors.Analyzers.UnitTests)

Full suite green: 980 tests, 0 failures, 0 warnings.

Documentation

  • Public API / error documentation updated (XML doc on the renamed method)
  • README / doc/ updated (RequestBinder.en.md)
  • French translation kept in sync (RequestBinder.fr.md)
  • No documentation change required

Architecture decisions

  • No architectural decision in this pull request
  • New decision recorded — ADR drafted as Proposed: ADR-____
  • Supersedes an existing ADR — successor proposed, status not flipped: ADR-____
  • ⚠️ Conflicts with an existing ADR — flagged for the maintainer: ADR-____

Per the maintainer's call: the library is 0.1.0-preview.1, so this pre-preview naming alignment needs no ADR.

Related issues

Closes #146


Generated by Claude Code

ComplexPropertyConverter.AsOptional was constrained `where TProperty : class`
and returned an OptionalReferenceField — the reference-optional semantics the
scalar side already exposes as AsOptionalReference. Under the name AsOptional it
was a dead end: a future value-type variant could not reuse the name (two
methods differing only by a class vs struct constraint do not overload, CS0111),
forcing an inconsistent third name or a breaking rename after the API freeze.

Rename it to AsOptionalReference, matching the scalar AsOptionalReference /
AsOptionalValue split and keeping AsOptionalValue free for a future value-type
nested object. The three list converters' AsOptional are intentionally left
alone: they are `notnull` and mean "absent list binds an empty list", with no
reference/value split to disambiguate.

The library is 0.1.0-preview.1 with no published consumers, so the rename is
free now and needs no ADR. Updated the call sites (all in tests) and the binder
reference docs (EN + FR).

Refs: #146

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HzQtszd156kmTp86rfsQR
@Reefact
Reefact force-pushed the claude/issue-146-rename-asoptionalreference branch from 173265b to 9ca2d94 Compare July 18, 2026 11:57
@Reefact
Reefact merged commit 12bf086 into main Jul 18, 2026
13 checks passed
@Reefact
Reefact deleted the claude/issue-146-rename-asoptionalreference branch July 18, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Binder: rename ComplexProperty.AsOptional to AsOptionalReference before the v1 API freeze

2 participants