api_error_parser_plus 0.1.0
api_error_parser_plus: ^0.1.0 copied to clipboard
A robust and type-safe library for parsing API responses and converting error codes into user-friendly messages with comprehensive error handling and validation.
Changelog #
0.1.0 - 2025-10-14 #
🗑️ Breaking Changes #
- REMOVED: Complete pagination logic and related classes
- Removed
ApiResponsePaginationandApiResponsePaginationEntity - Removed
PaginationandPaginationEntityclasses - Removed
ParserResponseWithPaginationEntity - Simplified
ApiParserSuccessResponse(removedpaginationfield)
- Removed
- Simplified: API response handling focuses only on data and errors
📚 Migration Guide from v0.0.4 #
- Remove any usage of pagination-related classes
ApiParserSuccessResponseno longer haspaginationfield- All pagination handling should be implemented in application layer
⚠️ Why Removed? #
Pagination logic was removed to keep the library focused on its core responsibility: error parsing and message handling. Pagination is better handled at the application level or in dedicated data layer components.
0.0.4 - 2025-10-14 #
🚀 Major Enhancements #
Added
- ErrorTarget enum: Strong type safety for error targets (
ErrorTarget.field,ErrorTarget.common) - ParseResult: Comprehensive result handling for safer parsing operations
- ApiParserConfig: Flexible configuration system with predefined environments
ApiParserConfig.production: Minimal logging, graceful error handlingApiParserConfig.debug: Detailed logging for developmentApiParserConfig.testing: Strict validation for tests
- Safe parsing methods:
fromJsonSafe()variants with detailed error reporting - Enhanced validation: Automatic validation of error structure and required fields
- Error analysis tools:
getUnknownErrorCodes(): Identify unmapped error codesisValidErrorMessage(): Validate error message structure
Enhanced
- Robust error handling: Better exception handling and error reporting
- Type safety: Eliminated magic strings and improved type checking
- Backward compatibility: All existing APIs continue to work
- Documentation: Comprehensive README with migration guide and examples
- Test coverage: Enhanced test suite with new configuration options
Fixed
- JSON parsing errors: Proper validation and error reporting for malformed data
- Null safety: Better handling of null and empty values
- Field validation: Strict validation for field target requirements
- Memory efficiency: Optimized error processing for large error lists
🔧 Breaking Changes #
ParserMessageEntity.targettype changed fromStringtoErrorTarget- Direct string comparisons with error targets should be replaced with enum usage
📚 Migration Guide #
- Replace string comparisons:
error.target == "field"→error.target == ErrorTarget.field - Add configuration parameter to
ApiParserconstructor (optional) - Consider migrating to
fromJsonSafemethods for better error handling
0.0.3 Previous Version #
- Added ability to parse lists at the root of JSON responses. Added fromJsonList method to ApiResponseEntity class.
0.0.2 Previous Version #
- Added hashCode and operator for ParseMessageEntity and ErrorSourceEntity to compare object when testing bloc(integration tests).
0.0.1 Initial Version #
- Initial version with basic API error parsing functionality