Skip to content

[Task] docs: Document serialization, schema, and policy framework #368

Description

@kcenon

Summary

Document the serialization backends, schema validation system, and policy-based container configuration in container_system.

Parent Issue

Part of: [EPIC] docs: Address documentation gaps across all ecosystem systems (kcenon/common_system#325)

Background (Why)

container_system includes three undocumented subsystems:

  1. Serializers — Including msgpack_serializer.h beyond the documented JSON/binary formats
  2. Schema — Runtime schema validation for container structure at core/container/schema.h
  3. Policy containers — Policy-based container configuration at core/policy_container.h + core/storage_policy.h

Users are unaware of MessagePack serialization support, schema validation capabilities, or policy-based container customization.

Source files:

  • core/serializers/msgpack_serializer.h — MessagePack serialization
  • core/container/schema.h — Schema definition and validation
  • core/policy_container.h — Policy-based container configuration
  • core/storage_policy.h — Storage strategy policies

Scope (What)

1. Serialization Framework

Available Serializers

Serializer Format Size Speed Use Case
JSON Text Large Moderate Human-readable, debugging
Binary Binary Small Fast Network transfer, storage
MessagePack Binary Smallest Fastest High-performance scenarios

MessagePack Serializer (msgpack_serializer.h)

  • API: serialize/deserialize interface
  • Type mapping (container types ↔ msgpack types)
  • Nested container handling
  • Binary data handling
  • Performance comparison with JSON and binary serializers

2. Schema System (schema.h)

Schema Definition

  • How to define expected container structure
  • Supported type constraints
  • Nested schema support
  • Optional vs required fields

Schema Validation

  • Runtime validation API
  • Error reporting (which field, what violation)
  • Validation performance impact
auto schema = container_schema::create()
    .field("name", type::string, required)
    .field("age", type::integer, optional)
    .field("address", nested_schema, required)
    .build();

auto result = schema.validate(my_container);

3. Policy Container Framework

policy_container (policy_container.h)

  • How policies compose container behavior
  • Available policy dimensions
  • Compile-time vs runtime policy application

Storage Policies (storage_policy.h)

  • Available storage strategies (in-memory, mapped, etc.)
  • Policy selection criteria
  • Custom storage policy interface

4. Integration Examples

  • MessagePack serialization with schema validation
  • Policy container with custom storage
  • Full pipeline: create → validate → serialize → store

Acceptance Criteria

  • MessagePack serializer fully documented with API and examples
  • Schema system documented with definition and validation examples
  • Policy container framework documented
  • Storage policies listed with characteristics
  • Performance comparison table for serializers
  • Integration examples showing combined usage

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationpriority:mediumMedium priority issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions