Skip to content

Releases: btwld/ack

Release v1.0.0-beta.7

24 Feb 20:34
09b67bf

Choose a tag to compare

Release v1.0.0-beta.7 Pre-release
Pre-release

Release v1.0.0-beta.7

This release adds top-level enum/literal schema constructors, deprecates chained string schema methods, and improves the code generator's nested schema resolution.

Key Features

  • Top-level enum and literal schemas: New Ack.enumString(), Ack.literal(), and Ack.enumValues() constructors for creating enum and literal schemas directly (#73)
  • Schema result mapping: New SchemaResult.map() for transforming validated values
  • Cross-file schema resolution: Generator now resolves nested schemas across files with strict typing (#77)

Deprecations

  • StringSchema.literal() and StringSchema.enumString() are deprecated — use Ack.literal() and Ack.enumString() instead (#74)

Improvements

  • Refactored AckType conversion helpers for cleaner generated code (#72)
  • Major improvements to schema AST analyzer for correctness in complex nested scenarios

Packages

Package Version
ack 1.0.0-beta.7
ack_annotations 1.0.0-beta.7
ack_generator 1.0.0-beta.7
ack_firebase_ai 1.0.0-beta.7
ack_json_schema_builder 1.0.0-beta.7

v1.0.0-beta.6

09 Feb 19:46

Choose a tag to compare

v1.0.0-beta.6 Pre-release
Pre-release

What's Changed

  • refactor: simplify validation workflow by eliminating duplicate nullable handling by @leoafarias in #17
  • Release 1.0.0-beta.1 by @leoafarias in #19
  • feat: add custom name parameter to @AckType annotation by @leoafarias in #22
  • docs: improve passthrough and additional properties documentation by @leoafarias in #23
  • feat: add args getter for extension types with additionalProperties by @leoafarias in #24
  • chore: exclude example package from versioning and releases by @leoafarias in #25
  • docs: enhance documentation with detailed examples and error handling by @leoafarias in #20
  • feat: add date/datetime validation with min/max constraints by @leoafarias in #26
  • refactor: modernize constraint switch statements to expressions by @leoafarias in #27
  • refactor: flatten constraints folder structure and add type prefixes by @leoafarias in #28
  • fix: critical error handling, documentation, and immutability improvements for 1.0.0 by @leoafarias in #29
  • feat: enhance setup script with robust environment configuration by @leoafarias in #31
  • feat: Firebase AI schema converter package and ACK improvements by @leoafarias in #32
  • chore: Add schema converter package development guides by @leoafarias in #33
  • Update ci.yml by @tilucasoli in #35
  • fix: preserve nullable metadata in firebase ai converter by @leoafarias in #36
  • chore: Update melos.yaml by @tilucasoli in #38
  • feat: add ack_json_schema_builder converter package by @leoafarias in #37
  • refactor: consolidate JSON schema utilities and reduce duplication by @leoafarias in #40
  • fix(ack_json_schema_builder): complete JSON schema conversion coverage by @leoafarias in #45
  • refactor: Update for analyzer >=7.x <9 API changes by @tilucasoli in #41
  • fix: Add field descriptions to generated schema output by @tilucasoli in #44
  • refactor: deprecate withDescription in favor of describe by @leoafarias in #46
  • fix(generator): support Ack.list(schemaRef) for typed list getters by @leoafarias in #47
  • refactor: apply DRY improvements to schema classes by @leoafarias in #53
  • Update release workflow and ack package versions to 1.0.0-beta.4 by @tilucasoli in #54
  • chore: Migrate to Dart 3.8 workspace and update Melos config by @tilucasoli in #55
  • chore: Update meta and test dependencies in pubspecs by @tilucasoli in #56
  • docs: Fix broken links and add missing API documentation by @leoafarias in #57
  • docs: Add llms.txt for AI agent documentation by @leoafarias in #58
  • Fix @AckType schema ref casts and tests by @leoafarias in #59
  • fix(generator): resolve list element types with method chain modifiers by @leoafarias in #60
  • feat(generator): support doc comments for schema descriptions by @leoafarias in #61
  • feat(schemas): implement value-based equality for schemas and constraints by @leoafarias in #63
  • Release: v1.0.0-beta.5 for all ack packages by @tilucasoli in #64
  • feat(schemas): enforce Map-returning child schemas in discriminated unions by @leoafarias in #67
  • refactor(schemas): centralize null/default handling and extract ObjectSchema helpers by @leoafarias in #65
  • fix(generator): comprehensive fixes for primitives and correctness by @leoafarias in #50
  • chore(release): finalize v1.0.0-beta.6 release metadata and workflow by @leoafarias in #69

New Contributors

Full Changelog: 0.3.0-beta.1...v1.0.0-beta.6

v1.0.0-beta.5

16 Jan 17:07

Choose a tag to compare

v1.0.0-beta.5 Pre-release
Pre-release

What's Changed

  • refactor: simplify validation workflow by eliminating duplicate nullable handling by @leoafarias in #17
  • Release 1.0.0-beta.1 by @leoafarias in #19
  • feat: add custom name parameter to @AckType annotation by @leoafarias in #22
  • docs: improve passthrough and additional properties documentation by @leoafarias in #23
  • feat: add args getter for extension types with additionalProperties by @leoafarias in #24
  • chore: exclude example package from versioning and releases by @leoafarias in #25
  • docs: enhance documentation with detailed examples and error handling by @leoafarias in #20
  • feat: add date/datetime validation with min/max constraints by @leoafarias in #26
  • refactor: modernize constraint switch statements to expressions by @leoafarias in #27
  • refactor: flatten constraints folder structure and add type prefixes by @leoafarias in #28
  • fix: critical error handling, documentation, and immutability improvements for 1.0.0 by @leoafarias in #29
  • feat: enhance setup script with robust environment configuration by @leoafarias in #31
  • feat: Firebase AI schema converter package and ACK improvements by @leoafarias in #32
  • chore: Add schema converter package development guides by @leoafarias in #33
  • Update ci.yml by @tilucasoli in #35
  • fix: preserve nullable metadata in firebase ai converter by @leoafarias in #36
  • chore: Update melos.yaml by @tilucasoli in #38
  • feat: add ack_json_schema_builder converter package by @leoafarias in #37
  • refactor: consolidate JSON schema utilities and reduce duplication by @leoafarias in #40
  • fix(ack_json_schema_builder): complete JSON schema conversion coverage by @leoafarias in #45
  • refactor: Update for analyzer >=7.x <9 API changes by @tilucasoli in #41
  • fix: Add field descriptions to generated schema output by @tilucasoli in #44
  • refactor: deprecate withDescription in favor of describe by @leoafarias in #46
  • fix(generator): support Ack.list(schemaRef) for typed list getters by @leoafarias in #47
  • refactor: apply DRY improvements to schema classes by @leoafarias in #53
  • Update release workflow and ack package versions to 1.0.0-beta.4 by @tilucasoli in #54
  • chore: Migrate to Dart 3.8 workspace and update Melos config by @tilucasoli in #55
  • chore: Update meta and test dependencies in pubspecs by @tilucasoli in #56
  • docs: Fix broken links and add missing API documentation by @leoafarias in #57
  • docs: Add llms.txt for AI agent documentation by @leoafarias in #58
  • Fix @AckType schema ref casts and tests by @leoafarias in #59
  • fix(generator): resolve list element types with method chain modifiers by @leoafarias in #60
  • feat(generator): support doc comments for schema descriptions by @leoafarias in #61
  • feat(schemas): implement value-based equality for schemas and constraints by @leoafarias in #63

Full Changelog: 0.3.0-beta.1...v1.0.0-beta.5

v0.3.0-beta.1

19 Jun 18:02

Choose a tag to compare

v0.3.0-beta.1 Pre-release
Pre-release

What's Changed

✨ New Features

  • Discriminated Union Schemas: New schema type for polymorphic validation based on discriminator fields
  • Dart Mappable Integration: Seamless field name synchronization for model generation
  • Unified API Compatibility Checking: Single melos api-check command replaces 19 complex shell commands

🔄 API Modernization & Deprecations

Multiple constraint classes have been deprecated in favor of unified ComparisonConstraint and PatternConstraint implementations:

String Constraints (use PatternConstraint instead):

  • StringDateTimeConstraintPatternConstraint.dateTime()
  • StringDateConstraintPatternConstraint.date()
  • StringEnumConstraintPatternConstraint.enumValues()
  • StringEmailConstraintPatternConstraint.email()
  • StringRegexConstraintPatternConstraint.regex()
  • StringJsonValidatorPatternConstraint.json()

Numeric Constraints (use ComparisonConstraint instead):

  • NumberMinConstraintComparisonConstraint.numberMin()
  • NumberMaxConstraintComparisonConstraint.numberMax()
  • NumberRangeConstraintComparisonConstraint.numberRange()
  • NumberExclusiveMinConstraintComparisonConstraint.numberExclusiveMin()
  • NumberExclusiveMaxConstraintComparisonConstraint.numberExclusiveMax()
  • NumberMultipleOfConstraintComparisonConstraint.numberMultipleOf()

Collection Constraints (use ComparisonConstraint instead):

  • StringMinLengthConstraintComparisonConstraint.stringMinLength()
  • StringMaxLengthConstraintComparisonConstraint.stringMaxLength()
  • ListMinItemsConstraintComparisonConstraint.listMinItems()
  • ListMaxItemsConstraintComparisonConstraint.listMaxItems()
  • ObjectMinPropertiesConstraintComparisonConstraint.objectMinProperties()
  • ObjectMaxPropertiesConstraintComparisonConstraint.objectMaxProperties()

🛠️ Schema API Changes

  • SchemaRegistry: Simplified type signatures - removed model type parameter
  • SchemaModel: Method signature updates for parse() and tryParse()
  • Extension Methods: Deprecated legacy method names on schema extensions

📚 Documentation & Tooling

  • Consolidated API documentation and tooling
  • Enhanced constraint migration guidance
  • Simplified development workflow with unified commands

All deprecated APIs remain functional with migration guidance. See the deprecations for detailed migration paths.

Full Changelog: v0.2.0-beta.1...0.3.0-beta.1

v0.2.0-beta.1

03 May 20:28

Choose a tag to compare

v0.2.0-beta.1 Pre-release
Pre-release

Release v0.2.0-beta.1

This release introduces significant improvements to the SchemaModel API, enhanced string validation, and better OpenAPI integration.

Key Features

  • Code Generation: Generate schema classes from your models
  • Type-safe Schema Access: Direct property getters with proper types
  • Automatic Validation: Validation happens during construction
  • Multiple Validation Approaches: Choose what fits your workflow
  • Improved String Validation: New pattern matching options
  • JSON Schema Integration: Generate API specifications automatically

Code Generation

Define Your Models

Annotate your models with validation rules:

@Schema()
class Product {
  @IsNotEmpty()
  final String id;

  @MinLength(3)
  final String name;

  final double price;

  final Category category;

  Product({
    required this.id,
    required this.name,
    required this.price,
    required this.category,
  });
}

Run the Generator

Use the build_runner to generate schema classes:

dart run build_runner build --delete-conflicting-outputs

This creates a .schema.dart file with your generated schemas.

SchemaModel API

Creating Schemas

The constructor now validates data automatically:

// Create schema with automatic validation
final schema = ProductSchema({
  'id': '123',
  'name': 'Test Product',
  'price': 19.99
});

// Check if valid
bool valid = schema.isValid;

Accessing Schema Values

Access validated data with type-safe getters:

// Type-safe access to properties
String id = schema.id;
String name = schema.name;
double price = schema.price;

// Access nested schema objects
CategorySchema category = schema.category;
String categoryName = category.name;

Handling Validation Errors

Get detailed error information when validation fails:

if (!schema.isValid) {
  SchemaError? error = schema.getErrors();
  
  // Error details
  String errorType = error?.name;       // e.g., "required_field"
  String message = error?.message;      // e.g., "Required field is missing"
  String? path = error?.path;           // e.g., "category.id"
}

Converting to Models

Transform schema data to strongly-typed models:

// Convert schema to model instance
Product product = schema.toModel();

// Access model properties
String id = product.id;
Category category = product.category;

Alternative Validation Approaches

Choose your preferred validation style:

// Approach 1: Constructor + isValid check
final schema = ProductSchema(data);
if (schema.isValid) {
  final product = schema.toModel();
}

// Approach 2: Direct parse (throws on failure)
try {
  Product product = ProductSchema.parse(data);
} catch (e) {
  // Handle validation error
}

// Approach 3: Try-parse (returns null on failure)
Product? product = ProductSchema.tryParse(data);
if (product != null) {
  // Use valid product
}

Creating Schema from Model

Convert model instances to schemas for serialization:

// Create schema from model instance
final schema = ProductSchema.fromModel(product);

// Serialize to various formats
Map<String, Object?> map = schema.toMap();
String json = schema.toJson();

Enhanced String Validation

Full Pattern Matching

The matches() method now validates entire strings:

// Full string pattern matching (with anchors)
final schema = Ack.string.matches('^[a-z0-9_]{3,16}$');
schema.validate('user_123').isOk;  // true
schema.validate('user@123').isOk;  // false - contains @

Partial String Matching

New contains() method for substring matching:

// Partial string matching
final schema = Ack.string.contains('important');
schema.validate('This is important text').isOk;  // true
schema.validate('Nothing here').isOk;  // false

JSON Schema Integration

Generate API specifications from your schemas:

// Get JSON Schema
Map<String, Object?> jsonSchema = ProductSchema.toJsonSchema();

// Convert to JSON string
String jsonString = jsonEncode(jsonSchema);

Migration Guide

If you're upgrading from 0.1.x, note these changes:

  1. Update string pattern validation:

    // Old (0.1.x): Matches substrings
    Ack.string.matches('abc');  // Would match 'abcdef'
    
    // New (0.2.0): Matches whole string
    Ack.string.matches('^abc$'); // Only matches 'abc' exactly
    Ack.string.contains('abc');  // Matches substrings, like old matches()
  2. Use the new validation workflow:

    // Create and validate in one step
    final schema = ProductSchema(data);
    
    // Check isValid before using
    if (schema.isValid) {
      schema.id;              // Access schema properties
      schema.category.name;   // Access nested properties
      
      // Or convert to model
      final product = schema.toModel();
    }

Documentation

Full documentation is available at https://docs.page/btwld/ack

0.1.1

10 Mar 04:01

Choose a tag to compare

Full Changelog: 0.1.0...0.1.1

0.1.0

10 Mar 03:46

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 0.0.2...0.1.0

0.0.2

26 Feb 17:42

Choose a tag to compare

  • Better json response parsing for OpenApiSchemaConverter

Full Changelog: 0.0.1...0.0.2

0.0.1

26 Feb 17:40

Choose a tag to compare

Initial release

Full Changelog: https://github.com/leoafarias/ack/commits/0.0.2