Skip to content

Refactor native adapter interfaces and update service registrations f… - #142

Merged
AhmadRAbuhussein merged 1 commit into
releases/r8.0from
new-native-mapper
Apr 6, 2026
Merged

Refactor native adapter interfaces and update service registrations f…#142
AhmadRAbuhussein merged 1 commit into
releases/r8.0from
new-native-mapper

Conversation

@hamzahalq

@hamzahalq hamzahalq commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

…or mappers

Summary by CodeRabbit

  • Bug Fixes

    • Improved error messages for invalid schedule configurations, with more specific guidance for monthly schedule errors.
  • New Features

    • Enhanced native adapter discovery to support mapper implementations alongside existing handler and validator types.

@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1ca2f5b1-5991-497d-8a5d-cd00f39f0c00

📥 Commits

Reviewing files that changed from the base of the PR and between 8061af5 and 91b6252.

📒 Files selected for processing (7)
  • SW.Bitween.Api/Domain/Subscription/Schedule.cs
  • SW.Bitween.Api/Services/NativeAdapterDiscoveryService.cs
  • SW.Bitween.Api/Services/XchangeService.cs
  • SW.Bitween.NativeAdapters/Interfaces.cs
  • SW.Bitween.NativeAdapters/JsonMapper/NativeJSONMapper.cs
  • SW.Bitween.NativeAdapters/JsonMapper/ScribanJsonHelper.cs
  • SW.Bitween.NativeAdapters/ServiceCollectionExtensions.cs

📝 Walkthrough

Walkthrough

The pull request extends the native adapter discovery system to support mapper adapters alongside handler adapters. Changes include adding an INativeInfolinkMapper interface, updating NativeAdapterDiscoveryService with mapper discovery capabilities, modifying XchangeService to use the new mapper resolution, updating NativeJSONMapper to implement the mapper interface, and adjusting DI registrations. Additional changes improve Schedule validation error messages and address a documentation formatting issue.

Changes

Cohort / File(s) Summary
Schedule validation
SW.Bitween.Api/Domain/Subscription/Schedule.cs
Enhanced constructor exception handling to throw BitweenException with specific error messages for each invalid Recurrence case (Hourly/Daily/Weekly/Monthly) rather than parameterless exceptions.
Native adapter mapper discovery
SW.Bitween.Api/Services/NativeAdapterDiscoveryService.cs, SW.Bitween.Api/Services/XchangeService.cs
Extended NativeAdapterDiscoveryService constructor to accept IEnumerable<INativeInfolinkMapper> and added GetNativeMapper() method for mapper resolution. Updated XchangeService.RunMapper() to use GetNativeMapper() instead of GetNativeHandler() for native adapter-based mapping.
Mapper interface definitions
SW.Bitween.NativeAdapters/Interfaces.cs, SW.Bitween.NativeAdapters/JsonMapper/NativeJSONMapper.cs
Introduced new INativeInfolinkMapper interface combining INativeAdapter and IInfolinkHandler. Updated NativeJSONMapper to implement INativeInfolinkMapper instead of INativeInfolinkHandler.
Dependency injection updates
SW.Bitween.NativeAdapters/ServiceCollectionExtensions.cs
Replaced DI registration mapping INativeInfolinkHandler to NativeJSONMapper with INativeInfolinkMapper to NativeJSONMapper in the AddNativeAdapters() method.
Documentation fix
SW.Bitween.NativeAdapters/JsonMapper/ScribanJsonHelper.cs
Fixed XML documentation comment by removing stray backtick from closing /// </summary> tag in the Render() method documentation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • AhmadRAbuhussein
  • mmalkhatib

Poem

🐰 Mappers now dance with handlers so fine,
Discovery service extended its line,
Interfaces blend and registrations align,
With validation improved—a rabbity design!
✨🗺️

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch new-native-mapper

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AhmadRAbuhussein
AhmadRAbuhussein merged commit ca12bc7 into releases/r8.0 Apr 6, 2026
1 of 2 checks passed
@MusaMisto
MusaMisto deleted the new-native-mapper branch July 2, 2026 09:29
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.

2 participants