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
{{ message }}
Repository navigation
Generator: add a Model.schema shorthand for Model.$ack.modelSchema #173
Models generated by @AckInfer() expose their model-valued schema as Model.$ack.modelSchema. When you pass a model schema to another API, or nest it in a list, you write this a lot, and it reads awkwardly. From a downstream app:
It would be emitted as static final schema = $ack.modelSchema;. It has the same type as $ack.modelSchema (for an object model, AckSchema<Map<String, Object?>, Task>), it is created once, and it equals Task.$ack.modelSchema.
Collision rule
In Dart, a class can't declare a static and an instance member with the same name, so the generator skips the shorthand when:
the model has a field whose Dart name is schema;
the union's discriminator key is schema, because the base declares it as a getter and every branch inherits it;
the annotated schema variable is itself named schema, because a static schema would shadow the variable the adapter reads.
In those cases Model.$ack.modelSchema still works. The generator neither fails nor renames the member, so no existing model stops generating.
Compatibility
The change is additive and non-breaking. $ack, $ack.schema, and $ack.modelSchema stay as they are. @AckModel() already has XSchema.schema, and the deprecated @AckType() is frozen, so neither changes. The validated value models that the JSON Schema builder generates already declare User.schema as the source validator, and they're unchanged too.
Activity
leoafarias commentedon Oct 8, 2026
Closed by #174 (shipped in 1.7.0-beta.2).