Skip to content

Document enum property support and serialization options #128

Description

@dguisinger

Once enum support is implemented #125 , documentation needs to be updated to explain enum usage and the Format option for controlling storage representation.

Sections to Update

docs/core-features/EntityDefinition.md — Add enum property examples to the supported types section
.kiro/steering/fluentdynamodb.md — Add enum examples to the Entity Definition section
docs/CodeExamples.md — Add practical enum usage examples
README.md — Mention enum support in the features list if not already present

Content to Document

public enum OrderStatus { Pending, Processing, Shipped, Delivered, Cancelled }

[DynamoDbTable("Orders")]
public partial class Order
{
    [PartitionKey]
    [DynamoDbAttribute("pk")]
    public string Pk { get; set; } = string.Empty;

    // Default: stores as string name → { "S": "Shipped" }
    [DynamoDbAttribute("status")]
    public OrderStatus Status { get; set; }

    // With Format = "D": stores as integer → { "N": "2" }
    [DynamoDbAttribute("statusCode", Format = "D")]
    public OrderStatus StatusCode { get; set; }

    // Nullable enum
    [DynamoDbAttribute("previousStatus")]
    public OrderStatus? PreviousStatus { get; set; }
}

Key Points to Cover

  • Default behavior: stored as string name in S attribute
  • Format = "D": stored as numeric value in N attribute
  • Nullable enum support
  • Enums in collections (List, HashSet)
  • Interop note: AWS SDK's Object Persistence Model stores as int by default — users migrating existing tables should use Format = "D"
  • Best practice guidance on when to use string vs integer (string is safer for refactoring, integer is more compact)

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions