Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copilot instructions for `btwld/ack`
# Copilot instructions for `conceptadev/ack`

## Start here first
- Read `/llms.txt` before making code changes. It is the canonical API reference and should be updated in the same PR when public API changes.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
echo "llms.txt is missing or empty."
exit 1
}
grep -q '^redirect: https://raw.githubusercontent.com/btwld/ack/main/llms.txt$' docs/llms.txt.mdx || {
grep -q '^redirect: https://raw.githubusercontent.com/conceptadev/ack/main/llms.txt$' docs/llms.txt.mdx || {
echo "docs/llms.txt.mdx must redirect to the canonical raw llms.txt URL."
exit 1
}
Expand All @@ -49,7 +49,7 @@ jobs:
steps:
- name: Notify docs.page update
run: |
echo "Documentation has been updated and is now available at https://docs.page/btwld/ack"
echo "Documentation has been updated and is now available at https://concepta.dev/ack"
# You could add additional notification steps here, such as:
# - Sending a Slack message
# - Creating a GitHub issue
Expand Down
2 changes: 1 addition & 1 deletion PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Before creating a release:

### 2. Create a GitHub Release

1. Go to the [Releases page](https://github.com/btwld/ack/releases) in the repository
1. Go to the [Releases page](https://github.com/conceptadev/ack/releases) in the repository
2. Click "Draft a new release"
3. Create a new tag in the format `v0.2.0` (must start with "v")
4. Add a title, e.g., "Release v0.2.0"
Expand Down
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Ack

[![CI/CD](https://github.com/btwld/ack/actions/workflows/ci.yml/badge.svg)](https://github.com/btwld/ack/actions/workflows/ci.yml)
[![docs.page](https://img.shields.io/badge/docs.page-documentation-blue)](https://docs.page/btwld/ack)
[![CI/CD](https://github.com/conceptadev/ack/actions/workflows/ci.yml/badge.svg)](https://github.com/conceptadev/ack/actions/workflows/ci.yml)
[![Documentation](https://img.shields.io/badge/docs-documentation-blue)](https://concepta.dev/ack)
[![pub package](https://img.shields.io/pub/v/ack.svg)](https://pub.dev/packages/ack)
[![llms.txt](https://img.shields.io/badge/llms.txt-available-8A2BE2)](https://docs.page/btwld/ack/llms.txt)
[![llms.txt](https://img.shields.io/badge/llms.txt-available-8A2BE2)](https://concepta.dev/documentation/ack/reference/llms-txt)

Ack is a schema validation library for Dart and Flutter. It validates data with a fluent API. Ack is short for "acknowledge".

For AI agents: start at [`/llms.txt`](https://docs.page/btwld/ack/llms.txt).
For AI agents: start at [`/llms.txt`](https://concepta.dev/documentation/ack/reference/llms-txt).

## Why use Ack?

- **Validate external payloads**: Guard API and user inputs by validating required fields, types, and constraints at boundaries
- **Single source of truth**: Define data structures and rules in one place
- **Less boilerplate**: Minimize repetitive validation and JSON conversion code
- **Type safety**: Generate typed wrappers for hand-written Ack schemas with `@AckType()`
- **Type safety**: Generate immutable models for hand-written Ack schemas with `@AckType()`

## Packages

This repository is a monorepo containing:

- **[ack](./packages/ack)**: Core validation library with a fluent schema-building API, codecs, and JSON Schema export
- **[ack_annotations](./packages/ack_annotations)**: The `@AckType()` annotation that marks schemas for code generation
- **[ack_generator](./packages/ack_generator)**: Code generator that turns `@AckType()` schemas into type-safe extension types
- **[ack_generator](./packages/ack_generator)**: Code generator that turns `@AckType()` schemas into immutable model classes
- **[ack_firebase_ai](./packages/ack_firebase_ai)**: Firebase AI (Gemini) schema converter for structured-output generation
- **[ack_json_schema_builder](./packages/ack_json_schema_builder)**: Converter to `json_schema_builder` schemas
- **[example](./example)**: Example projects demonstrating usage of all packages
Expand Down Expand Up @@ -120,14 +120,15 @@ if (result.isOk) {

## Code generation

Generate type-safe wrappers for hand-written schemas with `@AckType()`. Add
Generate immutable models for hand-written schemas with `@AckType()`. Add
`ack_annotations` to `dependencies` and `ack_generator` + `build_runner` to
`dev_dependencies`, then annotate a top-level schema:

```dart
import 'package:ack/ack.dart';
import 'package:ack_annotations/ack_annotations.dart';

part 'user.ack.dart';
part 'user.g.dart';

@AckType()
Expand All @@ -143,15 +144,18 @@ Run the generator:
dart run build_runner build
```

This emits a `UserType` extension type with `parse`/`safeParse` and typed
getters — no manual casting:
This emits a `User` class with stored typed fields, validation helpers, and a
JSON boundary:

```dart
final user = UserType.parse({'name': 'Alice', 'email': 'alice@example.com'});
print(user.name); // typed String getter
final user = User.parse({'name': 'Alice', 'email': 'alice@example.com'});
print(user.name); // String
print(user.toJson()); // {'name': 'Alice', 'email': 'alice@example.com'}
```

`@AckType()` supports objects, primitives, lists, enums, explicit transforms, and discriminated unions. See the [TypeSafe Schemas guide](https://docs.page/btwld/ack/core-concepts/typesafe-schemas).
`@AckType()` supports objects, primitives, lists, enums, bidirectional codecs,
named recursion, and discriminated unions. One-way transforms are rejected
because a generated model must be encodable. See the [TypeSafe Schemas guide](https://concepta.dev/documentation/ack/advanced/typesafe-schemas).

## Codecs

Expand All @@ -177,13 +181,13 @@ csv.encode(['a', 'b', 'c']); // 'a,b,c'
```

Use `.transform<R>(...)` for one-way (parse-only) conversions. See the
[Codecs guide](https://docs.page/btwld/ack/core-concepts/codecs).
[Codecs guide](https://concepta.dev/documentation/ack/advanced/codecs).

## Documentation

- Human docs: [docs.page/btwld/ack](https://docs.page/btwld/ack)
- AI agent index: [docs.page/btwld/ack/llms.txt](https://docs.page/btwld/ack/llms.txt)
- Canonical plaintext source: [raw.githubusercontent.com/btwld/ack/main/llms.txt](https://raw.githubusercontent.com/btwld/ack/main/llms.txt)
- Human docs: [concepta.dev/ack](https://concepta.dev/ack)
- AI agent index: [AI & llms.txt](https://concepta.dev/documentation/ack/reference/llms-txt)
- Canonical plaintext source: [raw.githubusercontent.com/conceptadev/ack/main/llms.txt](https://raw.githubusercontent.com/conceptadev/ack/main/llms.txt)

## Development

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ reporter unless they prefer to remain anonymous.

Security reports should describe a concrete confidentiality, integrity, or
availability impact. General bugs, unexpected validation results, and feature
requests belong in the public [issue tracker](https://github.com/btwld/ack/issues).
requests belong in the public [issue tracker](https://github.com/conceptadev/ack/issues).
12 changes: 6 additions & 6 deletions SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

## Start with the documentation

- [Ack documentation](https://docs.page/btwld/ack)
- [Quickstart tutorial](https://docs.page/btwld/ack/getting-started/quickstart-tutorial)
- [API quick reference](https://docs.page/btwld/ack/api-reference/)
- [Ack documentation](https://concepta.dev/ack)
- [Quickstart tutorial](https://concepta.dev/documentation/ack/getting-started/quickstart-tutorial)
- [API quick reference](https://concepta.dev/documentation/ack/reference/api-reference)
- [Generated API documentation](https://pub.dev/documentation/ack/latest/ack/)

Search existing [GitHub issues](https://github.com/btwld/ack/issues) before
Search existing [GitHub issues](https://github.com/conceptadev/ack/issues) before
opening a new one; your question or bug may already have an answer.

## Ask a question

Open a [GitHub issue](https://github.com/btwld/ack/issues/new) and apply the
Open a [GitHub issue](https://github.com/conceptadev/ack/issues/new) and apply the
`question` label. Include the Ack package and version, your Dart or Flutter
version, what you are trying to accomplish, and a small reproducible example.

## Report a bug or request a feature

Use the [issue tracker](https://github.com/btwld/ack/issues) with the `bug` or
Use the [issue tracker](https://github.com/conceptadev/ack/issues) with the `bug` or
`enhancement` label. A minimal reproduction and the full error output make an
issue much easier to investigate.

Expand Down
6 changes: 3 additions & 3 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"showGitHubCard": true
},
"social": {
"github": "btwld/ack"
"github": "conceptadev/ack"
},
"seo": {
"noindex": false
Expand Down Expand Up @@ -88,8 +88,8 @@
],
"variables": {
"versions": {
"default": "1.1.0",
"isPrerelease": false
"default": "2.0.0",
"isPrerelease": true
}
},
"search": {},
Expand Down
25 changes: 16 additions & 9 deletions docs/api-reference/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Schema reference for recursive object graphs.

## Code generation annotations

Use the [`ack_generator`](https://pub.dev/packages/ack_generator) builder to turn annotations into extension types. After adding the annotations below, run:
Use the [`ack_generator`](https://pub.dev/packages/ack_generator) builder to turn annotated top-level schemas into immutable model classes. After adding the annotation plus matching `.ack.dart` and `.g.dart` part directives, run:

```bash
dart run build_runner build
Expand All @@ -274,38 +274,45 @@ dart run build_runner build

**Target**: Schema variables and getters

**Generates**: An extension type wrapper around the existing schema
**Generates**: An immutable model class backed by the existing schema

Annotate a schema variable or getter to generate an extension type wrapper. The schema stays in your source file.
Annotate a top-level schema variable or getter. The schema stays in your source file and remains responsible for validation and codecs.

**Supported schema types:**
- `Ack.object({...})` → Object extension types
- `Ack.object({...})` → immutable object models
- Primitives: `Ack.string()`, `Ack.integer()`, `Ack.double()`, `Ack.boolean()`
- Collections: `Ack.list(...)`
- Collections: `Ack.list(...)`, typed sets and maps
- Enums: `Ack.literal()`, `Ack.enumString()`, `Ack.enumValues()`
- Discriminated unions: `Ack.discriminated(...)`

**Unsupported:** `Ack.any()`, `Ack.anyOf()`
**Unsupported:** nullable roots, one-way transforms, `Ack.any()`, `Ack.anyOf()`, bare `Ack.instance<T>()`, and anonymous inline objects

For `Ack.discriminated(...)` constraints with `@AckType`, see
[Type-safe Schemas](../core-concepts/typesafe-schemas.mdx#discriminated-schemas).
[Type-safe Schemas](../core-concepts/typesafe-schemas.mdx#discriminated-unions).

**Example:**
```dart
import 'package:ack/ack.dart';
import 'package:ack_annotations/ack_annotations.dart';

part 'user.ack.dart';
part 'user.g.dart';

@AckType()
final userSchema = Ack.object({
'name': Ack.string(),
'email': Ack.string().email(),
});

// Generated:
// - extension type UserType(Map<String, Object?> _data) { ... }
// - final class User { ... }
// - The schema variable remains unchanged

// Usage:
final user = UserType.parse({'name': 'Alice', 'email': 'alice@example.com'});
final user = User.parse({'name': 'Alice', 'email': 'alice@example.com'});
print(user.name); // Type-safe String access
print(user.email); // Type-safe String access
print(user.toJson());
```

### `EnumSchema<T>`
Expand Down
Loading
Loading