You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: prefer enumValues over enumString when Dart enum exists
- Reorder enum schema listings to show enumValues first across all docs
- Update examples to use Ack.enumValues with Dart enums instead of enumString
- Clarify that enumString is for ad-hoc string lists without backing enums
- Update @AckModel examples to use Dart enum fields (which auto-generate enumValues)
- Consolidate preference guidance to api-reference and llms.txt to avoid repetition
- Apply Diataxis principles: reference describes, how-to guides show by example
Copy file name to clipboardExpand all lines: docs/api-reference/index.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ Entry point for creating schemas. See [Schema Types](../core-concepts/schemas.md
14
14
-`Ack.boolean()`: Creates a `BooleanSchema` for validating booleans.
15
15
-`Ack.list(AckSchema itemSchema)`: Creates a `ListSchema` for validating arrays.
16
16
-`Ack.object(Map<String, AckSchema> properties)`: Creates an `ObjectSchema` for validating objects.
17
-
-`Ack.enumValues(List<T> values)`: Creates an `EnumSchema` for validating enum values.
18
-
-`Ack.enumString(List<String> values)`: Creates a string schema that only accepts specific values.
17
+
-`Ack.enumValues(List<T> values)`: Creates an `EnumSchema<T>` for Dart enum types. Accepts enum instances, string names, or indices. **Preferred over `enumString` when a Dart enum exists.**
18
+
-`Ack.enumString(List<String> values)`: Creates a `StringSchema` constrained to the given values. For ad-hoc string lists without a backing Dart enum.
19
19
-`Ack.anyOf(List<AckSchema> schemas)`: Creates an `AnyOfSchema` for union types.
20
20
-`Ack.any()`: Creates an `AnySchema` that accepts any value.
21
21
-`Ack.discriminated({required String discriminatorKey, required Map<String, AckSchema<Map<String, Object?>>> schemas})`: Creates a discriminated union schema.
Copy file name to clipboardExpand all lines: docs/core-concepts/validation.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,7 +128,7 @@ Ack.string().ipv6()
128
128
129
129
130
130
### `enumString(List<String> allowedValues)`
131
-
Requires the value to be one of `allowedValues`.
131
+
Requires the value to be one of `allowedValues`. Use this only for ad-hoc string lists. When a Dart enum exists, prefer `Ack.enumValues(MyEnum.values)` for type-safe validation.
0 commit comments