Releases: ANcpLua/ErrorOrX
v3.5.0
What's Changed
Bug Fix: Endpoints Invisible to OpenAPI/Swagger (#25)
All ErrorOrX-generated endpoints were invisible to ASP.NET Core's OpenAPI document generator — "paths": {} was empty despite endpoints working at runtime.
Root cause: The wrapper method Invoke_EpN(HttpContext ctx) returned Task, which matches the RequestDelegate signature (Func<HttpContext, Task>). ASP.NET Core's MapGet silently picked the RequestDelegate overload, bypassing RequestDelegateFactory — making endpoints invisible to OpenAPI.
Three-part fix:
| Fix | What | Why |
|---|---|---|
| Typed return | Wrapper returns Task<Results<Ok<T>, ...>> instead of Task |
Breaks RequestDelegate match, forces Delegate overload |
(Delegate) cast |
Explicit cast on all MapGet/MapPost calls |
Safety net — forces Delegate overload regardless of signature |
| Explicit metadata | Always emit ProducesResponseTypeMetadata |
Full response schemas in OpenAPI even without Results<...> |
New: OpenAPI Parameter Definitions
When using AddErrorOrOpenApi(), the generated operation transformer now emits full OpenAPI parameter definitions for route, query, and header parameters — including types, formats, and required flags.
Two-tier support:
| Setup | What You Get |
|---|---|
AddOpenApi() (existing) |
Endpoint visibility + response schemas |
AddErrorOrOpenApi() |
Above + parameter definitions + XML doc summaries |
Other Changes
- Updated README examples from
int idtoGuid idwith route constraints
Upgrade
dotnet add package ErrorOrX.Generators --version 3.5.0For full OpenAPI parameter support, use AddErrorOrOpenApi() instead of AddOpenApi():
builder.Services
.AddErrorOrOpenApi() // instead of AddOpenApi()
.AddErrorOrEndpoints()
.UseJsonContext<AppJsonSerializerContext>();Full Changelog: v3.4.0...v3.5.0
v3.4.0
What's Changed
Fixed
-
Unreachable switch arm in
Extractor.cs:ReturnsError(ErrorType, string)was always falling into the custom error path instead of mapping standard ErrorType enum values. Fixed by checkingTypeKind.Enumonargs[0].Typeto distinguish enum from raw int. -
Integration tests missing from solution: Added
ErrorOrX.Integration.TeststoErrorOrX.slnx— 9 tests were not running in CI. -
Documentation accuracy: Removed phantom EOE055 from CHANGELOG (EOE032 covers it), fixed README analyzer count (38 → 41), corrected CLAUDE.md dependency versions.
Changed
-
Test suite cleanup: Removed redundant assertion-based tests (-7,823 lines), consolidated shared boilerplate into dedicated snapshot tests. 455 tests pass with identical coverage.
-
Updated dependencies:
- ANcpLua.Roslyn.Utilities 1.28.0 → 1.31.0
- ANcpLua.Roslyn.Utilities.Testing 1.28.0 → 1.31.0
- ANcpLua.NET.Sdk 2.0.4 → 2.0.5
- Verify.XunitV3 31.9.4 → 31.10.0
-
Generator code cleanup: Removed unused
ParameterSourceproperties, simplified constructor signatures, added documentation comments for suppressed warnings.
Verification
- Build: 0 warnings, 0 errors
- Tests: 455 passed (446 generator/runtime + 9 integration), 0 failed
- 12-agent parallel audit: architecture, security, API contracts all clean
v3.1.0 - API Versioning & Performance
What's New
Features
- API Versioning Support: Full support for
[ApiVersion],[ApiVersionNeutral], and[MapToApiVersion]attributes - New Diagnostics: EOE050-054 for versioning validation
Performance
- N+1 Fix: ErrorOrContext is now created once per compilation instead of N times, eliminating 90+ symbol lookups per endpoint
Test Coverage
- 149 comprehensive tests across:
- DiagnosticTests (39 tests) - EOE003-EOE040
- MiddlewareEmissionTests (23 tests) - Security-critical attribute handling
- ApiVersioningTests (17 tests) - Versioning emission and diagnostics
- ParameterBindingTests (36 tests) - Smart binding inference
- BugRegressionTests (5 tests) - Previously fixed issues
Documentation
- New
docs/api-versioning.mdwith complete usage guide - Updated
docs/diagnostics.mdwith new codes
v3.0.1 - PrivateAssets Hotfix
🐛 Hotfix
This release fixes the critical package installation issue discovered after v3.0.0 where users had to manually edit .csproj after installing ErrorOrX.Generators.
Fixed
- Package installation issue: Removed
developmentDependency=truefrom.nuspecto prevent NuGet from automatically addingPrivateAssets=all - Added MSBuild target in
.propsthat explicitly adds ErrorOrX reference withPrivateAssets=none - Users no longer need manual .csproj editing - ErrorOrX runtime flows automatically
Installation
dotnet add package ErrorOrX.Generators --version 3.0.1The ErrorOrX runtime will now automatically flow to your project without any manual configuration!
Packages
Full Changelog: v3.0.0...v3.0.1
v3.0.0 - Major Refactoring Release
What's Changed
🐛 Fixed
Critical: Package Installation Issue
- Removed
developmentDependency=truefrom.nuspecto prevent NuGet from addingPrivateAssets=allautomatically - Added MSBuild target that ensures ErrorOrX runtime flows to consuming projects
- Users no longer need to manually edit .csproj after installing ErrorOrX.Generators
🔧 Refactoring
- Consolidated type unwrapping logic: Unified duplicate
UnwrapNullableTypeimplementations - Consolidated route parameter lookup: Merged
BuildMethodParamsByRouteNameandBuildRouteMethodParameterLookup - Decomposed EmitInvoker method: Split 95-line method into focused single-responsibility methods
- Removed Match API dependency: Generated code now uses minimal
ErrorOr<T>interface (IsError/Errors/Value)
🧹 Maintenance
- Test analyzer cleanups: Sealed test helper records, added shared
Unreachablehelper - Fixed ModuleInitializer.cs: Added missing
using VerifyTests;directive - Removed unnecessary reflection: Simplified
EquatableArrayJsonConverter - Fixed README links: Documentation links now point to GitHub URLs
📦 Packages
Installation
dotnet add package ErrorOrX.Generators --version 3.0.0No manual .csproj editing required! The ErrorOrX runtime will now automatically flow to your project.
Full Changelog: v2.6.3...v3.0.0
v2.5.0
What's New
New Or* Extensions
OrUnexpected(description)- Returns Unexpected error (500) if nullOrError(Error error)- Returns custom error if nullOrError(Func<Error> factory)- Lazy custom error creation
Struct Overloads
Added missing struct overloads for nullable value types:
OrUnauthorized<T>where T : structOrForbidden<T>where T : structOrConflict<T>where T : structOrFailure<T>where T : struct
Documentation
- Updated README with comprehensive API documentation
- Improved NuGet package descriptions and tags
Usage
// New extensions
value.OrUnexpected("Something went wrong");
value.OrError(Error.Custom(422, "Custom.Code", "Custom message"));
value.OrError(() => BuildExpensiveError());
// Struct support
int? maybeId = GetId();
return maybeId.OrNotFound("ID not found");Full Changelog: v2.4.0...v2.5.0
v2.3.1
Documentation
- Streamlined README for NuGet package
- Added
docs/folder with detailed documentation:docs/api.md- Full API referencedocs/parameter-binding.md- Parameter binding detailsdocs/diagnostics.md- Analyzer warnings and errors
Full Changelog: v2.3.0...v2.3.1
v2.3.0 - Smart Parameter Binding & Caching Fixes
Breaking Changes
- Smart parameter binding inference: POST/PUT/PATCH with complex types now infer
[FromBody], GET/DELETE with complex types now emitEOE025error requiring explicit binding - Use
<ErrorOrLegacyParameterBinding>true</ErrorOrLegacyParameterBinding>MSBuild property to opt-out
Features
- EOE025: New diagnostic for ambiguous parameter binding on GET/DELETE with complex types
- EOE040: Warning when user's JsonSerializerContext lacks CamelCase policy
- JSON context auto-detection: When user has existing context, emits helper file with missing types
- PrivateAssets fix:
ErrorOrXruntime now correctly flows to consuming projects
Fixes
- Incremental caching: Removed
CompilationProviderusage that broke generator caching - ErrorOrContext: Now created lazily from
SemanticModelto avoid cachingINamedTypeSymbol - Results max arity: Hardcoded to 6 (ASP.NET Core 8+ supports
Results\6`)
Improvements
- Comprehensive XML documentation across all generator types
- Model consolidation: all record structs in
EndpointModels.cs - Dead code removal and naming consistency
- New
GeneratorCachingTeststo validate incremental caching