Skip to content

String backed strongly typed IDs#809

Merged
Dragemil merged 20 commits intov10.0-previewfrom
feature/string-typed-ids
Dec 23, 2025
Merged

String backed strongly typed IDs#809
Dragemil merged 20 commits intov10.0-previewfrom
feature/string-typed-ids

Conversation

@Dragemil
Copy link
Copy Markdown
Contributor

@Dragemil Dragemil commented Dec 17, 2025

Closes CORELIB-196

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 17, 2025

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
847 846 0 1 0 0 1m 55s

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 💚

🔄 This comment has been updated

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 97.36070% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.36%. Comparing base (b67c025) to head (fa4074e).

Files with missing lines Patch % Lines
...omain/LeanCode.DomainModels.Generators/IdSource.cs 97.41% 6 Missing and 1 partial ⚠️
...main/LeanCode.DomainModels/Ids/TypedIdAttribute.cs 0.00% 1 Missing ⚠️
...main/LeanCode.DomainModels/Ids/TypedIdConverter.cs 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           v10.0-preview     #809      +/-   ##
=================================================
+ Coverage          80.07%   81.36%   +1.29%     
=================================================
  Files                231      231              
  Lines               4356     4648     +292     
  Branches             344      340       -4     
=================================================
+ Hits                3488     3782     +294     
+ Misses               784      783       -1     
+ Partials              84       83       -1     

☔ 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.

Copy link
Copy Markdown
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 introduces string-backed strongly typed IDs to the DomainModels library, adding two new TypedId formats: RawString and PrefixedString. These complement the existing numeric and GUID-based ID types, allowing developers to use arbitrary string values as typed identifiers with optional length constraints.

Key Changes:

  • Added RawString and PrefixedString formats to TypedIdFormat enum (renumbering existing values)
  • Introduced MaxValueLength property to TypedIdAttribute for validating string length constraints
  • Implemented new IRawStringTypedId<TSelf> interface and RawStringTypedIdConverter<TId> for JSON serialization

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/Domain/LeanCode.DomainModels/Ids/TypedIdAttribute.cs Added RawString and PrefixedString enum values; added MaxValueLength property with documentation
src/Domain/LeanCode.DomainModels/Ids/ITypedId.cs Introduced IRawStringTypedId<TSelf> interface for string-backed typed IDs
src/Domain/LeanCode.DomainModels/Ids/TypedIdConverter.cs Added RawStringTypedIdConverter<TId> for JSON serialization of string IDs
src/Domain/LeanCode.DomainModels.Generators/TypedIdFormat.cs Updated enum to match the attribute changes
src/Domain/LeanCode.DomainModels.Generators/TypedIdData.cs Added MaxValueLength property to generator data model
src/Domain/LeanCode.DomainModels.Generators/TypedIdGenerator.cs Updated generator to extract and pass MaxValueLength from attributes
src/Domain/LeanCode.DomainModels.Generators/IdSource.cs Implemented BuildRawString and BuildPrefixedString methods; refactored switch to expression
test/Domain/LeanCode.DomainModels.Tests/Ids/ValidConstructTests.cs Added test cases for new string formats; added MaxValueLength parameter to existing tests
test/Domain/LeanCode.DomainModels.Tests/Ids/RawStringTests.cs Comprehensive test coverage for RawString format including max length validation
test/Domain/LeanCode.DomainModels.Tests/Ids/PrefixedStringTests.cs Comprehensive test coverage for PrefixedString format including prefix validation and max length

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

Copy link
Copy Markdown
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

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.


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

@Dragemil Dragemil force-pushed the feature/string-typed-ids branch from f9b4726 to ff35af7 Compare December 19, 2025 11:30
@Dragemil
Copy link
Copy Markdown
Contributor Author

Another flaky test, added a bug

@Dragemil Dragemil merged commit 11b35ca into v10.0-preview Dec 23, 2025
9 checks passed
@Dragemil Dragemil deleted the feature/string-typed-ids branch December 23, 2025 07:47
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