Sinter vs Exdantic: Schema Validation Library Comparison for Pipeline_ex
Executive Summary
Both Sinter and Exdantic are modern Elixir validation libraries designed for AI/LLM applications, but they serve different use cases:
- Sinter: Minimalist, runtime-focused, “one true way” philosophy - ideal for simple, dynamic validation needs
- Exdantic: Feature-rich, Pydantic-inspired, enterprise-grade - ideal for complex schemas and production systems
Recommendation for Pipeline_ex: Use Exdantic for its comprehensive feature set, better alignment with pipeline complexity, and superior JSON Schema generation capabilities.
Detailed Comparison
1. Philosophy & Design
Aspect | Sinter | Exdantic |
---|---|---|
Philosophy | “Distillation” - single unified API | Pydantic-style comprehensive toolkit |
Complexity | Simple, focused | Feature-rich, comprehensive |
Learning Curve | Low | Medium |
API Style | Functional | DSL + Functional |
2. Schema Definition
Sinter
schema = Sinter.Schema.define([
{:name, :string, [required: true]},
{:steps, {:array, :map}, [required: true, min_items: 1]}
])
Exdantic
defmodule PipelineSchema do
use Exdantic, define_struct: true
schema "Pipeline Configuration" do
field :name, :string do
required()
description("Pipeline name")
end
field :steps, {:array, StepSchema} do
required()
min_items(1)
description("Pipeline steps")
end
model_validator :validate_step_dependencies
end
end
3. Feature Comparison
Feature | Sinter | Exdantic |
---|---|---|
Runtime Validation | ✅ Primary focus | ✅ Excellent support |
Compile-time Schemas | ❌ Not emphasized | ✅ First-class support |
JSON Schema Generation | ✅ Basic | ✅ Advanced with provider optimization |
Type Coercion | ✅ Built-in | ✅ Comprehensive |
Cross-field Validation | ✅ Post-validation hooks | ✅ Model validators |
Computed Fields | ❌ | ✅ |
Nested Schemas | ✅ | ✅ Advanced with references |
Error Messages | ✅ Good | ✅ Excellent with paths |
Performance | ✅ Fast | ✅ Optimized |
Documentation | ✅ Good | ✅ Extensive |
4. JSON Schema Capabilities
Sinter
- Basic JSON Schema generation
- Provider-specific optimizations (OpenAI, Anthropic)
- Schema validation
Exdantic
- Full JSON Schema draft support
- Advanced provider optimizations
- Reference resolution and flattening
- DSPy-style optimization
- Computed fields as
readOnly
- Comprehensive metadata support
5. Pipeline_ex Specific Considerations
Why Exdantic is Better for Pipeline_ex:
Complex Nested Structures
- Pipeline YAML has deeply nested structures (workflow → steps → prompts → parts)
- Exdantic’s reference resolution and nested schema support is superior
Compile-time + Runtime Needs
- Base pipeline schemas can be compile-time for performance
- Dynamic schemas for LLM-generated pipelines can use runtime features
Cross-field Validation Requirements
- Step dependencies validation
- Condition expression validation
- Function reference validation
- Exdantic’s model validators are perfect for this
JSON Schema Generation
- Need high-quality JSON Schemas for IDE support
- Provider-specific optimizations for Claude/Gemini integration
- Exdantic’s JSON Schema generation is production-ready
Future-proofing
- DSPy integration potential
- LLM output validation
- Schema evolution and migration
- Exdantic is built for these AI-first use cases
6. Integration Example with Exdantic
defmodule Pipeline.Validation.Schemas.WorkflowSchema do
use Exdantic, define_struct: true
schema "Pipeline Workflow Configuration" do
field :name, :string do
required()
min_length(1)
description("Unique workflow identifier")
end
field :description, :string do
optional()
description("Human-readable workflow description")
end
field :steps, {:array, Pipeline.Validation.Schemas.StepSchema} do
required()
min_items(1)
description("Ordered list of pipeline steps")
end
field :global_vars, {:map, :string, :any} do
optional()
description("Global variables available to all steps")
end
field :claude_auth, Pipeline.Validation.Schemas.ClaudeAuthSchema do
optional()
description("Claude authentication configuration")
end
model_validator :validate_step_references
model_validator :validate_function_references
end
def validate_step_references(data) do
# Validate all previous_response references exist
# ...implementation...
end
end
7. Migration Strategy
- Phase 1: Define Exdantic schemas for all pipeline components
- Phase 2: Generate JSON Schema and integrate with VS Code
- Phase 3: Replace current validation with Exdantic validators
- Phase 4: Add runtime schema generation for dynamic pipelines
8. Decision Matrix
Criteria | Weight | Sinter | Exdantic | Winner |
---|---|---|---|---|
Feature Completeness | 25% | 7/10 | 10/10 | Exdantic |
JSON Schema Quality | 20% | 6/10 | 10/10 | Exdantic |
Learning Curve | 10% | 10/10 | 7/10 | Sinter |
Production Readiness | 20% | 8/10 | 10/10 | Exdantic |
LLM Integration | 15% | 8/10 | 10/10 | Exdantic |
Performance | 10% | 9/10 | 9/10 | Tie |
Total Score | 7.65 | 9.55 | Exdantic |
Conclusion
While Sinter is an excellent library with a clean API and focused approach, Exdantic is the clear choice for Pipeline_ex due to:
- Comprehensive feature set matching pipeline complexity
- Superior JSON Schema generation for tooling integration
- Production-grade maturity with extensive documentation
- Better suited for complex, nested validation requirements
- Future-proof design for AI/LLM applications
The additional complexity of Exdantic is justified by the requirements of validating pipeline YAML structures and the need for high-quality JSON Schema generation for external tooling.