keyed_form_gen 0.2.2
keyed_form_gen: ^0.2.2 copied to clipboard
build_runner code generator for keyed_form_schema: turns a schema into immutable data models, keyed_form_core field references and type-safe validation functions.
0.2.2 #
- Allow analyzer 14.
0.2.1 #
- Allow analyzer 13.
0.2.0 #
-
refine(path: ...)is now checked against the schema's declared fields at generation time, including dotted paths into nested objects ('stop.city'). A path that doesn't resolve to a real field used to be a silent no-op — the refinement's error never attached to any field — so it now fails the build instead, naming the closest field if one looks like a typo. -
Generated list-row accessors (
<Root>Fields.<accessor>(...)) now take named<field>ClientIdparameters instead of an<Accessor>Refrecord —TourFields.stop(stopClientId: id)instead offinal ref = (stop: id); TourFields.stop(ref). The<Accessor>Reftypedef is gone. Re-runbuild_runner buildand update call sites accordingly. -
Generated doc comments no longer say "affine" — the form layer doesn't use
keyed_lensvocabulary, so a row accessor's doc now just says its read/write is a no-op when the row doesn't exist. -
Add pub.dev topics for package discoverability.
0.1.0 #
Initial release.
build_runnergenerator for@keyedSchema-annotated libraries: turns eachks.object({...})schema into an immutable data class (constconstructor,.create()factory with autoclientId,copyWith,==,hashCode,toMap).- A
<Root>Fieldsnamespace ofkeyed_form_corefield references —StrictFieldReffor scalars,<Field>FieldRefswrappers for nested objects and list rows,.asVariantnarrowers for discriminated unions. validate([scope])/validateAsync([scope])and thevalidateData/validateDataAsyncstatics, returningFieldErrors. They pass a_validationValueslist (the object's field values in schema order) toKSObject.validateValues, so noMapis built per validation;toMap()stays the serialization path. Passing aFieldKeyscope re-checks only that subtree.<Root>.validateDatais assignable straight toKeyedFormController.resolver, and<Root>.scopeOf(delegating torowScopeOf) is a ready defaultscopeOf.copyWithis a typed public interface backed by a private sentinel-based implementation so bare[]/{}literals infer correctly at call sites.