Skip to content

Added support for custom serialization formats for date/time. DateTim…#38

Merged
temonk merged 6 commits into
mainfrom
feature/IParsableAndNugetUpdated
Feb 10, 2026
Merged

Added support for custom serialization formats for date/time. DateTim…#38
temonk merged 6 commits into
mainfrom
feature/IParsableAndNugetUpdated

Conversation

@temonk

@temonk temonk commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

…eOffset, TimeSpan.

Generated code now respects [SerializationFormat] for JSON, XML, and type converters.

Updated tests and runtime helpers to cover all supported types.

Updated package versions and improved string escaping in generated code.

…eOffset, TimeSpan.

Generated code now respects [SerializationFormat] for JSON, XML, and type converters.

Updated tests and runtime helpers to cover all supported types.

Updated package versions and improved string escaping in generated code.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds/extends generator + runtime support so domain primitives based on date/time types (DateOnly, DateTime, DateTimeOffset, TimeOnly, TimeSpan) can honor [SerializationFormat] consistently across JSON, XML, and type converters, with updated tests/snapshots and some dependency/version housekeeping.

Changes:

  • Added new unit tests and generator snapshot tests covering [SerializationFormat] for supported date/time primitives.
  • Updated generator to escape format strings correctly in generated code and to use format-aware XML reader helpers.
  • Added runtime XML reader helpers for parsing date/time primitives with an explicit serialization format; bumped package/app versions and formatting.

Reviewed changes

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

Show a summary per file
File Description
tests/AltaSoft.DomainPrimitives.UnitTests/SerializationFormatTests/SerializationFormatTests.cs New end-to-end tests for JSON/XML/type-converter behavior with custom formats.
tests/AltaSoft.DomainPrimitives.UnitTests/SerializationFormatTests/CustomTimeSpan.cs Test primitive using [SerializationFormat] for TimeSpan.
tests/AltaSoft.DomainPrimitives.UnitTests/SerializationFormatTests/CustomTimeOnly.cs Test primitive using [SerializationFormat] for TimeOnly.
tests/AltaSoft.DomainPrimitives.UnitTests/SerializationFormatTests/CustomDateTimeOffset.cs Test primitive using [SerializationFormat] for DateTimeOffset.
tests/AltaSoft.DomainPrimitives.UnitTests/SerializationFormatTests/CustomDateTime.cs Test primitive using [SerializationFormat] for DateTime.
tests/AltaSoft.DomainPrimitives.UnitTests/SerializationFormatTests/CustomDateOnly.cs Test primitive using [SerializationFormat] for DateOnly.
tests/AltaSoft.DomainPrimitives.UnitTests/AltaSoft.DomainPrimitives.UnitTests.csproj Enables generator features for unit test project.
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomTimeSpan_GeneratesAllInterfacesAndConvertersWithSerializationFormat#OpenApiHelper.g.verified.cs Snapshot for OpenAPI helper generation (TimeSpan).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomTimeSpan_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomTimeSpanTypeConverter.g.verified.cs Snapshot for TypeConverter generation (TimeSpan).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomTimeSpan_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomTimeSpanJsonConverter.g.verified.cs Snapshot for JSON converter generation (TimeSpan).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomTimeSpan_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomTimeSpan.g.verified.cs Snapshot for generated domain primitive (TimeSpan).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomTimeOnly_GeneratesAllInterfacesAndConvertersWithSerializationFormat#OpenApiHelper.g.verified.cs Snapshot for OpenAPI helper generation (TimeOnly).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomTimeOnly_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomTimeOnlyTypeConverter.g.verified.cs Snapshot for TypeConverter generation (TimeOnly).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomTimeOnly_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomTimeOnlyJsonConverter.g.verified.cs Snapshot for JSON converter generation (TimeOnly).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomTimeOnly_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomTimeOnly.g.verified.cs Snapshot for generated domain primitive (TimeOnly).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateTime_GeneratesAllInterfacesAndConvertersWithSerializationFormat#OpenApiHelper.g.verified.cs Snapshot for OpenAPI helper generation (DateTime).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateTime_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateTimeTypeConverter.g.verified.cs Snapshot for TypeConverter generation (DateTime).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateTime_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateTimeJsonConverter.g.verified.cs Snapshot for JSON converter generation (DateTime).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateTime_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateTime.g.verified.cs Snapshot for generated domain primitive (DateTime).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateTimeOffset_GeneratesAllInterfacesAndConvertersWithSerializationFormat#OpenApiHelper.g.verified.cs Snapshot for OpenAPI helper generation (DateTimeOffset).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateTimeOffset_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateTimeOffsetTypeConverter.g.verified.cs Snapshot for TypeConverter generation (DateTimeOffset).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateTimeOffset_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateTimeOffsetJsonConverter.g.verified.cs Snapshot for JSON converter generation (DateTimeOffset).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateTimeOffset_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateTimeOffset.g.verified.cs Snapshot for generated domain primitive (DateTimeOffset).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateOnly_GeneratesAllInterfacesAndConvertersWithSerializationFormat#OpenApiHelper.g.verified.cs Snapshot for OpenAPI helper generation (DateOnly).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateOnly_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateOnlyTypeConverter.g.verified.cs Snapshot for TypeConverter generation (DateOnly).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateOnly_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateOnlyJsonConverter.g.verified.cs Snapshot for JSON converter generation (DateOnly).
tests/AltaSoft.DomainPrimitives.Generator.Tests/Snapshots/DomainPrimitiveGeneratorTest.CustomDateOnly_GeneratesAllInterfacesAndConvertersWithSerializationFormat#CustomDateOnly.g.verified.cs Snapshot for generated domain primitive (DateOnly).
tests/AltaSoft.DomainPrimitives.Generator.Tests/DomainPrimitiveGeneratorTest.cs Adds new snapshot-based generator tests for serialization formats.
src/AltaSoft.DomainPrimitives/XmlReaderExt.cs Adds XML parsing helpers that accept an explicit serialization format.
src/AltaSoft.DomainPrimitives.Generator/Helpers/MethodGeneratorHelper.cs Generator updates for format escaping and XML serialization codegen paths.
src/AltaSoft.DomainPrimitives.Generator/Executor.cs Adds conditional System.Globalization using when serialization format is present.
Examples/AltaSoft.DomainPrimitives.Demo/Program.cs Swagger configuration formatting change.
Examples/AltaSoft.DomainPrimitives.Demo/AltaSoft.DomainPrimitives.Demo.csproj Package version bumps for OpenAPI packages.
Directory.Packages.props Switches several packages to floating versions + enables floating versions.
Directory.Build.props Package/version bump from 7.0.2 to 7.1.0.

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

Comment thread src/AltaSoft.DomainPrimitives/XmlReaderExt.cs
Comment thread src/AltaSoft.DomainPrimitives/XmlReaderExt.cs
Comment thread src/AltaSoft.DomainPrimitives/XmlReaderExt.cs
Comment thread src/AltaSoft.DomainPrimitives/XmlReaderExt.cs

Copilot AI commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

@temonk I've opened a new pull request, #39, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 4 commits February 10, 2026 18:06
Co-authored-by: temonk <47372530+temonk@users.noreply.github.com>
Fix culture-dependent parsing and incorrect XML doc tags in XmlReaderExt
@temonk temonk merged commit 229c874 into main Feb 10, 2026
1 check passed
@temonk temonk deleted the feature/IParsableAndNugetUpdated branch February 10, 2026 18:22
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