Skip to content

Latest commit

 

History

History
131 lines (96 loc) · 4.65 KB

File metadata and controls

131 lines (96 loc) · 4.65 KB

Future Improvements for Smithy C# Code Generator

High Priority

1. Error Recovery in Parser ✅ (Partially Complete)

  • ✅ Enhanced error reporting with line numbers and suggested fixes.
  • ✅ Implement partial model generation even with non-critical errors.
  • ⚠️ Remaining Issues:
    • Duplicate shape ID detection needs refinement
    • Trait validation warnings not properly triggered
    • Complex parsing scenarios require more robust handling

2. Parser Architecture Overhaul 🆕 (Critical for Complete Error Recovery)

Current string-based parsing approach has fundamental limitations that prevent complete error recovery implementation:

Current Limitations:

  • Simple string matching instead of proper tokenization
  • Limited state management for complex parsing scenarios
  • Difficulty in handling multi-line definitions and nested structures
  • Hard to debug parsing issues and intermediate states

Recommended Solutions:

  1. Token-based Parser Implementation

    • Replace line-by-line string matching with proper tokenization
    • Implement lexical analysis phase separate from parsing
    • Better handling of whitespace, comments, and complex syntax
  2. AST (Abstract Syntax Tree) Structure

    • Build proper tree representation of Smithy models
    • Enable better error recovery and partial parsing
    • Facilitate more sophisticated validation and analysis
  3. Dedicated Grammar Parser Library Integration

    • Consider ANTLR, Pidgin, or similar parsing libraries
    • Leverage proven parsing techniques and error recovery mechanisms
    • Benefit from grammar-first approach with automatic parser generation
  4. Staged Parsing Pipeline

    • Separate lexical analysis, syntax parsing, and semantic validation
    • Enable independent error recovery at each stage
    • Better error reporting with precise location and context

Implementation Priority: Should be addressed before completing other high-priority features, as it affects the foundation of all parsing-related improvements.

3. JSON AST Parser Completion

  • Complete the implementation of Smithy JSON AST format parsing.
  • Support all Smithy 2.0 features in JSON format

Core Type System

  1. Complete Type Constraint Implementation

    • Add support for all constraint traits in the Smithy 2.0 specification
    • Implement proper validation for complex type constraints
  2. Recursive Shape Validation

    • Add validation for recursive shape definitions
    • Prevent infinite recursion during code generation
  3. Collection Member Shape IDs

    • Generate proper member shape IDs for List, Map, and Set types

Medium Priority

Protocol Support

  1. HTTP Protocol Traits

    • Complete implementation of HTTP binding traits
    • Add support for REST APIs with proper routing
  2. Service Properties

    • Add support for all service properties defined in Smithy 2.0
    • Implement version, errors, and rename properties
  3. Streaming Operations

    • Enhance streaming support with proper C# implementations
    • Add support for bidirectional streaming operations

C# Generation Improvements

  1. Modern C# Features

    • Use latest C# language features (nullable reference types, records, pattern matching)
    • Generate code compatible with .NET Standard 2.0, .NET 6+
  2. ASP.NET Core Integration

    • Generate controllers and middleware for easy ASP.NET Core integration
    • Support minimal API style endpoints for operations
  3. Documentation Generation

    • Enhanced XML documentation from Smithy comments
    • Support for additional documentation traits

Low Priority

Advanced Features

  1. Mixin Support

    • Implement Smithy mixin trait handling
    • Generate proper inheritance for mixed-in shapes
  2. Selector Support

    • Add support for Smithy selector expressions
    • Generate selector-based conditional code
  3. Advanced API Patterns

    • Support for pagination
    • Support for waiters
    • Support for resource-based operations

Developer Experience

  1. Visual Studio Extension

    • Create a Visual Studio extension for Smithy IDL editing
    • Add code generation from within Visual Studio
  2. MSBuild Integration

    • Create MSBuild tasks for Smithy code generation
    • Add source generator support for compile-time generation
  3. CLI Enhancements

    • Add more command-line options for customization
    • Support for project configuration files

Contribution Opportunities

These areas are great starting points for new contributors:

  1. Adding support for specific constraint traits
  2. Implementing additional unit tests
  3. Documentation improvements
  4. Example projects showcasing the generator
  5. Performance optimizations for large models