DEV Community

Mattia Re
Mattia Re

Posted on

Looking for feedback on a library I built to auto-wire API validation errors to Blazor WASM form fields

​Hey everyone!

​I recently got tired of writing repetitive code to catch server-side API errors and display them in the UI.
​To solve this, I built an SDK that automatically walks client-side model paths (address.city, items[0].name) and maps RFC 9457 (Problem Details) errors straight into native Blazor FieldIdentifier instances via a custom HttpClient.

​What it does

  • Walks nested C# model graphs automatically using a lightweight path tokenizer.
  • Resolves standard lists, arrays and custom numeric indexers.
  • Handles parameter collisions across binding sources (e.g., query vs. body parameters) via an opt-in [Disambiguate] attribute you can apply on your controllers.
  • Easily integrates with Blazor’s EditContext and ValidationMessageStore.

It works with reflection and is extensible for your own needs. You can customize the way it binds errors by implementing your own factory or change the way it accesses objects by adding more accessors to the DI container.

I tried to keep the requirements fairly limited. The only things you have to accept are responding with problem details objects when an error occurs and using the specialized HttpClient.

The idea is that you can call your APIs and forget about wiring errors.

I'd love to get some feedback, edge-case bug reports or just constructive criticism from the community.

​It's open-source, published on NuGet, and has full docs setup:
GitHub: https://github.com/Mattia-Re/MRX-SDK
Docs: https://mrx.mattiare.com

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.