json_extension_type 1.2.0
json_extension_type: ^1.2.0 copied to clipboard
JSON Extension Type Generator - Automatically generates extension types for JSON to Dart typedef records and classes conversion.
Changelog #
All notable changes to this project will be documented in this file.
1.2.0 - 2025-10-25 #
Added #
- Complete Examples: Added 4 runnable Dart examples in
/exampledirectorybasic_example.dart- Simple typedef records and basic conversionsnested_types_example.dart- Complex nested structurescustom_annotations_example.dart- Using #key and #default annotationsapi_simulation_example.dart- Real-world API integration patterns
- Package Logo: Added professional SVG logo for branding
- Full size logo (
assets/logo.svg) - Small logo variant (
assets/logo_small.svg)
- Full size logo (
- Enhanced README:
- Added logo and badges
- Improved visual presentation
- Added examples section with direct links
- Better documentation structure
- Example Documentation: Added comprehensive
example/README.mdwith learning path
Changed #
- Class Support Note: Marked class support as experimental (๐งช) in documentation
- pubspec.yaml: Added documentation link and screenshots configuration
1.1.1 - 2025-10-25 #
Fixed #
- Duplicate extension generation: Fixed issue where running
jet generatemultiple times would create duplicate extension types for classes - Improved
_removeOldExtensionsfunction to properly detect and remove previously generated code using the "Generated by JET" marker - Added fallback detection for both typedefs and classes to ensure clean regeneration
1.1.0 - 2025-10-25 #
Added #
- Class support: Generate extensions for Dart classes with constructors
- Automatic detection of class fields
- Smart constructor parsing (ignores constructors and methods, only parses fields)
- Works with both typedef records and classes in the same file
- Generated code comments: Each extension now includes a header comment indicating it's auto-generated
Improved #
- Better parsing algorithm using brace counting for classes
- More robust field detection
- Clear warnings not to modify generated code manually
1.0.0 - 2025-10-25 #
Added #
- Initial release of JSON Extension Type Generator
- CLI tool with
jetcommand - Automatic generation of extension types for typedef records
- Support for primitive types (String, int, double, bool)
- Support for nullable types
- Support for List
- Support for Enums with automatic string conversion
- Support for custom/nested record types
- Custom annotations support:
#key:name- Customize JSON key mapping#default:value- Set custom default values
- Automatic detection of enums and their first values
- Regeneration support (removes old extensions before generating new ones)
- Pretty output with emojis for better UX
- Comprehensive documentation and examples
Features #
- Primitive Types: Full support for Dart primitive types with appropriate defaults
- Type Safety: Generated code is fully type-safe
- Null Safety: Proper handling of nullable types
- Lists: Support for both primitive and custom type lists
- Enums: Automatic conversion from string to enum values
- Nested Types: Support for deeply nested record types
- Annotations: Flexible annotation system for customization
- CLI: User-friendly command-line interface
- Automatic Updates: Re-running generator updates existing extensions
Commands #
jet generate [path]- Generate extensions for models in specified directoryjet help- Show help informationjet --version- Show version information
Project Structure #
bin/jet.dart- CLI entry pointlib/generator.dart- Main generator logiclib/parser.dart- Model parsing utilitieslib/code_generator.dart- Code generation logiclib/models.dart- Internal data models
Dependencies #
args: ^2.7.0- Command-line argument parsingpath: ^1.9.0- Path manipulation utilities
Documentation #
- Comprehensive README with examples
- Usage guide with all features explained
- Type support documentation
- Custom annotations guide
- CLI options reference
[Unreleased] #
Planned Features #
- Watch mode for automatic regeneration on file changes
- Configuration file support (jet.yaml)
- Custom templates for generated code
- Support for Map<String, dynamic>
- Validation rules support
- JSON serialization (toJson methods)
- More annotation options (#ignore, #required, etc.)
- Better error messages and debugging
- Test generation
- Integration with build_runner