altasoft/DomainPrimitives
60.8
Adequate · 21 September 2026
5.2k
lines of production code
C#
primary language
4
measurements over time
What this system is
AltaSoft.DomainPrimitives is a .NET toolkit that uses a Roslyn source generator to create strongly-typed domain primitives, enforcing validation rules at compile time. It provides a library of pre-built types for dates, amounts, and identifiers, along with extensions for automatic OpenAPI schema generation and XML serialization. The system is designed to reduce boilerplate and ensure data integrity in C\# applications by generating immutable value objects with built-in parsing and conversion logic.
How it got here
2024 — Initial release and feature expansion
16 changes.
This period marks the initial release of the AltaSoft.DomainPrimitives toolkit, introducing a Roslyn source generator for strongly-typed domain primitives alongside core libraries and XML data type support. The work focused on establishing the project's architecture, including Swagger/OpenAPI integration, comprehensive test coverage, and demo applications, while refining generator diagnostics and configuration options.
2025–2026 — OpenAPI integration and test coverage expansion
4 changes.
This period focused on enhancing API documentation support by introducing OpenAPI schema transformers for DomainPrimitive types. Concurrently, the team expanded unit test coverage to validate new XML parsing capabilities for DateOnly and TimeOnly, as well as custom serialization formats for various date and time primitives.
Features
Added AltaSoft.DomainPrimitives.Demo application
A new demo ASP.NET Core application has been added to showcase the DomainPrimitives library. It includes customer and transfer management endpoints, demonstrating the use of domain primitives such as CustomerId, BirthDate, PositiveAmount, and Iban within record-based models. The demo integrates Swagger and Scalar for API documentation and illustrates how domain-specific types are handled in OpenAPI schema generation.
Examples/AltaSoft.DomainPrimitives.Demo · high confidence
Added Domain Primitives demo solution
A new Visual Studio solution file (AltaSoft.DomainPrimitives.Demo.sln) has been added to the Examples directory. This solution serves as a demonstration project, referencing the core DomainPrimitives library, the code generator, and the Swagger/OpenAPI extension projects to showcase their integration.
Examples · high confidence
Added DomainPrimitivesDemo example project
A new demo project has been added to Examples/DomainPrimitivesDemo that showcases the implementation of various domain primitives using the AltaSoft.DomainPrimitives library. The project includes example types such as BirthDate, Currency, CustomerAddress, CustomerId, CustomerName, Fee, Iban, PositiveAmount, TotalAmount, and TransferId, each demonstrating how to define validation rules for specific data types like dates, strings, GUIDs, and decimals.
Examples/DomainPrimitivesDemo · high confidence
Enhanced date/time parsing and new validation attributes for domain primitives
The AltaSoft.DomainPrimitives library now includes flexible parsing helpers for DateOnly, DateTime, DateTimeOffset, TimeOnly, and TimeSpan, allowing values to be parsed from strings using exact formats with optional fallback to standard formats. Additionally, new attributes have been introduced to support domain validation: PatternAttribute enables regex-based validation for strings, StringLengthAttribute enforces minimum and maximum string lengths, and SerializationFormatAttribute allows specifying custom serialization formats. These changes improve the robustness of input handling and validation for domain-specific values.
src/AltaSoft.DomainPrimitives · high confidence
Initial release of AltaSoft.DomainPrimitives toolkit
This change introduces the initial version of the AltaSoft.DomainPrimitives C\# toolkit, which uses a Roslyn source generator to create strongly-typed domain primitives. The release includes the core library, the source generator, and supporting packages for XML data types, Swagger, and OpenAPI integration. It establishes the solution structure, build configuration targeting .NET 8, 9, and 10, and foundational documentation.
(repo-wide) · high confidence
Initial release of the Domain Primitives source generator
This change introduces the initial version of the AltaSoft.DomainPrimitives source generator, which automatically generates code for domain primitive types at compile time. The generator analyzes types implementing the IDomainValue interface to determine their underlying primitive types (such as String, Int32, DateTime, Guid, etc.) and generates corresponding boilerplate code. It supports various underlying types including numeric, date/time, and custom types, and provides extension methods to handle accessibility, modifiers, and OpenAPI/Swagger type mappings for the generated primitives.
src/AltaSoft.DomainPrimitives.Generator/Extensions · high confidence
New OpenAPI schema transformers for DomainPrimitive types
The library now includes two new OpenAPI schema transformers: \DomainPrimitiveOpenApiSchemaTransformer\ and \UnderlyingPrimitiveOpenApiSchemaTransformer\. The former maps DomainPrimitive types to OpenAPI schemas by scanning assemblies for \OpenApiHelper\ types and their static \Schemas\ mappings, while the latter uses reflection to determine the underlying primitive type of a DomainPrimitive and maps it to standard JSON Schema types (e.g., int, string, bool). These transformers can be registered via the \AddDomainPrimitivesOpenApiSchemaTransformer\ extension method on \OpenApiOptions\, enabling automatic generation of correct OpenAPI schemas for DomainPrimitive types in API documentation.
src/AltaSoft.DomainPrimitives.OpenApiExtensions · high confidence
New XML Schema and numeric domain primitive types
The \AltaSoft.DomainPrimitives.XmlDataTypes\ library now includes new domain primitive types for XML Schema date components (GDay, GMonth, GMonthDay, GYear, GYearMonth) and integer constraints (PositiveInteger, NegativeInteger, NonNegativeInteger, NonPositiveInteger), alongside ASCII and non-empty string variants. These types enforce specific validation rules—such as ensuring values are strictly positive or contain only ASCII characters—and provide serialization formats for XML handling, expanding the library's capability to model strict data constraints.
src/AltaSoft.DomainPrimitives.XmlDataTypes · high confidence
New generator model classes for configuration and data transfer
The \src/AltaSoft.DomainPrimitives.Generator/Models\ directory now contains the core data structures used by the source generator. \DomainPrimitiveGlobalOptions\ provides a configuration record allowing users to toggle the generation of JSON converters, type converters, OpenAPI helpers, XML serialization, Entity Framework Core value converters, and various operators (implicit, numeric, addition, subtraction, etc.). \GeneratorData\ acts as the primary data transfer object, carrying details about the primitive type (including support for new underlying types like DateOnly, TimeOnly, and DateTimeOffset), operator flags, serialization settings, and pattern validation rules. \DomainPrimitiveUnderlyingType\ enumerates all supported primitive types, and \SupportedOperationsAttributeData\ captures specific operator requirements.
src/AltaSoft.DomainPrimitives.Generator/Models · high confidence
Architecture
Extracted Swagger extension methods to a dedicated assembly
The Swagger configuration logic for DomainPrimitive types has been moved from the main domain library into a new, separate assembly named AltaSoft.DomainPrimitives.SwaggerExtensions. This change introduces the SwaggerGenOptionsExt class, which provides extension methods (AddDomainPrimitivesSwaggerMappings and AddAllDomainPrimitivesSwaggerMappings) to register OpenAPI schema mappings. This separation allows consumers to opt-in to Swagger support without pulling in the core domain primitives, and aligns with the broader project restructuring to support .NET 9 and updated OpenAPI package versions.
src/AltaSoft.DomainPrimitives.SwaggerExtensions · high confidence
Behavioural changes
Domain Primitive Generator: Initialization safety, numeric operator fix, and new generation options
The source generator now protects domain primitive structs from accessing uninitialized values by introducing an \\_isInitialized\ flag and a \\_valueOrThrow\ property that throws \InvalidDomainValueException\ if the value is accessed before initialization. A bug in the global options parsing has been fixed where the \DomainPrimitiveGenerator\_GenerateNumericOperations\ setting was incorrectly assigned to the implicit operator flag; it now correctly enables numeric operator generation. Additionally, the generator supports new configuration options to produce Entity Framework Core value converters, OpenAPI helper mappings, and XML serialization, alongside improved validation and error messaging for string lengths and date/time deserialization.
src/AltaSoft.DomainPrimitives.Generator · high confidence
Source generator helpers refactored for improved diagnostics and OpenAPI schema generation
The generator's helper layer has been restructured to provide more robust code generation and developer feedback. A new \DiagnosticHelper\ class centralizes error and warning messages, introducing specific diagnostics (e.g., AL1000-AL1016) to guide users on valid primitive types, constructor requirements, and attribute usage. \MethodGeneratorHelper\ now produces enhanced OpenAPI schema mappings that include XML documentation summaries, examples, and validation constraints like string length and patterns. Additionally, a \SourceCodeBuilder\ utility standardizes the formatting of generated source files, ensuring consistent indentation and proper suppression of compiler warnings in the output.
src/AltaSoft.DomainPrimitives.Generator/Helpers · high confidence
Test coverage
Added snapshot and configuration tests for the Domain Primitive source generator; Added tests for custom date/time serialization formats; Added unit tests for DateOnly and TimeOnly XML parsing; Added unit tests for XmlDataTypes domain primitives and utilities; Added unit tests for transformable and nested domain primitives; Snapshot tests updated for generated DomainPrimitive types.
Dependencies
Centralized dependency management and framework upgrades
The project now uses central package management via Directory.Packages.props to unify version control across all projects. This change upgrades the target framework to .NET 10.0 for the demo and test projects, updates Microsoft.CodeAnalysis.Analyzers to version 5.9.0, and bumps Microsoft.OpenApi to 2.12.2 and Swashbuckle.AspNetCore.SwaggerGen to 10.2.\*.
(dependencies) · high confidence
Placeholder file added for netstandard2.0 library target
A placeholder file (\.\) has been added to the lib/netstandard2.0 directory. This is a standard convention in .NET packaging to indicate that the library does not contain any direct references or assemblies for the netstandard2.0 target framework, ensuring proper resolution during build and dependency analysis.
src/AltaSoft.DomainPrimitives.Generator/lib · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 57 → 61 (+3.7)
- Rubric changed (rubric-2026.08.18 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 92 → 92 (+0.3)
- Architecture 100 → 100 (-0.0)
- Maturity 59 → 60 (+1.3)
- Readiness 43 → 45 (+2.0)
- Security 68 → 79 (+10.6)
- Domain Modelling 99 (new)
Resolved (15)
- BarePragmaDisable (tests/AltaSoft.DomainPrimitives.Generator.Tests/TestHelpers.cs)
- Duplicated block (12 lines × 2) (src/AltaSoft.DomainPrimitives.Generator/Executor.cs)
- Duplicated block (13 lines × 2) (src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs)
- Further orphaned files (smaller)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- LLM evaluation failed
- Monorepo: only 1 of 2 solutions was scored
- No exposed public API
- Off-boarding risk: anonymized user #1
- The Getting Started guide is thin; it only states installation, not how to create a domain type or run examples. (README.md)
New (39)
- CRAP 30: TypeExtensions.TryGetUnderlyingDomainPrimitiveType (src/AltaSoft.DomainPrimitives/TypeExtentions.cs)
- CRAP 44: DomainPrimitiveUnderlyingTypeExt.GetDefaultValue (src/AltaSoft.DomainPrimitives.Generator/Extensions/DomainPrimitiveUnderlyingTypeExt.cs)
- CRAP 44: DomainPrimitiveUnderlyingTypeExt.GetDomainPrimitiveUnderlyingType (src/AltaSoft.DomainPrimitives.Generator/Extensions/DomainPrimitiveUnderlyingTypeExt.cs)
- CRAP 49: .GetOpenApiTypeAndFormat (src/AltaSoft.DomainPrimitives.Generator/Extensions/CompilationExt.cs)
- CRAP 52: Executor.Process (src/AltaSoft.DomainPrimitives.Generator/Executor.cs)
- Documentation: no installation or build instructions (README.md)
- Duplicated block (16 lines × 2) (src/AltaSoft.DomainPrimitives.Generator/Executor.cs)
- Duplicated block (28–30 lines × 2) (src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs)
- FileScopedPragmaDisable (tests/AltaSoft.DomainPrimitives.Generator.Tests/TestHelpers.cs)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- Hotspot: src/AltaSoft.DomainPrimitives.Generator/Executor.cs (src/AltaSoft.DomainPrimitives.Generator/Executor.cs)
- Hotspot: src/AltaSoft.DomainPrimitives.Generator/Extensions/DomainPrimitiveUnderlyingTypeExt.cs (src/AltaSoft.DomainPrimitives.Generator/Extensions/DomainPrimitiveUnderlyingTypeExt.cs)
- Hotspot: src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs (src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs)
- Inconsistent naming of the test helper class: 'TestHelpers' (plural) vs 'TestHelper' (singular).
- …and 19 more
Changes since last survey
- 13 commits — 7 feature/other, 6 fixes
By area
- (repo) — 4 commits
- src/AltaSoft.DomainPrimitives — 3 commits
- tests/AltaSoft.DomainPrimitives.Generator.Tests — 3 commits
- src/AltaSoft.DomainPrimitives.Generator — 2 commits
- (root) — 1 commit
Notable commits
- fix: Fixed README/generator drift and suppress warnings in generated code
- fix: Fixed bugs introduced in previous release
- fix: Merge pull request #48 from altasoft/bugfix/DateOrTime
- fix: Merge pull request #49 from altasoft/bugfix/XmlCommentAndPragmas
- fix: Minor fixes
- fix: XMl summary fixed and snapshots fixed
- change: Added datetimeExtensions, DateTImeOffsetExtensions, TimeSpanExtensions parse methods without format
- change: Cleanup
- change: DateOnly, DateTime, TimeOnly, TimeSpan & DateTimeOffset deserialization improved.
- change: Merge pull request #47 from altasoft/feature/DateAndTime
- change: Merge pull request #50 from altasoft/feature/nugetupdate
- change: Nuget package updates
- change: Some test still failing
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
altasoft/DomainPrimitives was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 13784375c5302cccfc872ce3be2ec6e8b6da9355 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-28e75b8e3254.