Skip to content

Conversation

@j-d-ha
Copy link
Collaborator

@j-d-ha j-d-ha commented Jan 16, 2026

🚀 Pull Request

📋 Summary

This PR adds support for the Format property on the DynamoFieldAttribute, enabling per-field format string customization for formattable types (DateTime, DateTimeOffset, TimeSpan, Guid, and Enum). This allows individual properties to override the mapper-level format settings.

Key Changes

  • Added Format property to DynamoFieldAttribute with comprehensive XML documentation
  • Updated TypeMappingStrategyResolver to use field-level format when specified
  • Added DynamoFieldFormatVerifyTests with comprehensive test coverage for:
    • DateTime with custom format (yyyy-MM-dd)
    • DateTimeOffset with custom format
    • TimeSpan with general long format (G)
    • Guid with N format (32 digits)
    • Enum with decimal format (D)
    • Multiple properties with different formats
    • Nullable types with format
    • Format override with mapper defaults
    • Non-formattable types (format is ignored)

✅ Checklist

  • My changes build cleanly
  • I've added/updated relevant tests
  • I've added/updated documentation or README
  • I've followed the coding style for this project
  • I've tested the changes locally (if applicable)

🧪 Related Issues or PRs

Closes #51

💬 Notes for Reviewers

  • The Format property only applies to formattable types (DateTime, DateTimeOffset, TimeSpan, Guid, Enum)
  • For non-formattable types (string, bool, numeric types), the format is silently ignored
  • Field-level format overrides mapper-level format (DateTimeFormat, TimeSpanFormat, GuidFormat, EnumFormat)
  • All tests verify the generated code produces correct format strings in both ToItem and FromItem methods

j-d-ha and others added 2 commits January 16, 2026 18:47
…mats

- Introduced tests to validate mapping with custom formats including DateTime, Guid, and Enum.
- Covered multiple formats like "N", "D", and "yyyy-MM-ddTHH:mm:ssK".
- Verified behavior for nullable types and conflicting format settings.
- Ensured non-formattable types gracefully ignore invalid formatting.
Copy link
Contributor

@ncipollina ncipollina left a comment

Choose a reason for hiding this comment

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

✅ LGTM.

@ncipollina ncipollina merged commit ba2910c into main Jan 17, 2026
1 check passed
@ncipollina ncipollina deleted the feature/add-dynamo-field-format-string branch January 17, 2026 00:11
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.

Add DynamoField Format String Support + Validation

3 participants