Skip to content

Conversation

@Dragemil
Copy link
Contributor

@Dragemil Dragemil commented Jan 2, 2026

LeanPipe will benefit from this, and some other future libraries could as well.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
918 917 0 1 0 0 1m 56s

Skipped

Tests Status
LeanCode.Azure.Tests.AzureStorageAuditLogIntegrationTests.Ensure_that_all_logs_are_correctly_uploaded_to_multiple_files skipped ⏭️

🎉 No failed tests in this run.

Github Test Reporter by CTRF 💚

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the CQRS JSON serialization configuration by extracting duplicated configuration logic into a reusable extension method ConfigureForCQRS(), making it available for use in other libraries like LeanPipe.

Key Changes:

  • Introduced a new CQRSJsonSerializerOptionsExtensions class with a ConfigureForCQRS() extension method that centralizes the JSON serializer configuration
  • Refactored ServiceCollectionCQRSExtensions to use the new extension method instead of inline configuration
  • Updated LeanCodeTestFactory to use the new extension method, replacing the previous inline configuration

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Infrastructure/LeanCode.Serialization/CQRSJsonSerializerOptionsExtensions.cs New extension method that configures JsonSerializerOptions with the three Lax converters and sets PropertyNamingPolicy to null
src/CQRS/LeanCode.CQRS.AspNetCore/ServiceCollectionCQRSExtensions.cs Refactored to use the new ConfigureForCQRS extension method instead of inline converter configuration
src/Testing/LeanCode.IntegrationTestHelpers/LeanCodeTestFactory.cs Updated to use the new ConfigureForCQRS extension method, simplifying the constructor initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +13
public static void ConfigureForCQRS(this JsonSerializerOptions options)
{
options.Converters.Add(new JsonLaxDateOnlyConverter());
options.Converters.Add(new JsonLaxTimeOnlyConverter());
options.Converters.Add(new JsonLaxDateTimeOffsetConverter());
options.PropertyNamingPolicy = null;
}
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new ConfigureForCQRS extension method lacks test coverage. Consider adding a test class to verify that:

  1. All three converters (JsonLaxDateOnlyConverter, JsonLaxTimeOnlyConverter, JsonLaxDateTimeOffsetConverter) are correctly added to the options
  2. PropertyNamingPolicy is set to null as expected

This would follow the existing testing pattern seen in other extension method tests in the codebase (e.g., OutputCachingServiceCollectionExtensionsTests, ServiceCollectionExtensionsTests).

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.57%. Comparing base (0b7eccb) to head (4663e37).
⚠️ Report is 3 commits behind head on v10.0-preview.

Additional details and impacted files
@@                Coverage Diff                @@
##           v10.0-preview     #816      +/-   ##
=================================================
- Coverage          84.60%   84.57%   -0.03%     
=================================================
  Files                236      237       +1     
  Lines               4819     4810       -9     
  Branches             341      347       +6     
=================================================
- Hits                4077     4068       -9     
  Misses               659      659              
  Partials              83       83              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dragemil Dragemil merged commit a4153b2 into v10.0-preview Jan 5, 2026
14 checks passed
@Dragemil Dragemil deleted the task/expose-cqrs-json-serialization-options-configuration branch January 5, 2026 08:44
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.

3 participants