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: use the @AckModel class doc comment as the object schema description #175
@AckModel() turns each field's doc comment into that field's schema description, but it ignores the class doc comment. The generated object schema has no description:
/// A task the person can complete. // not carried today@AckModel()
finalclassTaskwith_$TaskAck {
constTask({requiredthis.id, requiredthis.title});
finalString id;
/// What to do. // carried todayfinalString title;
}
@AckModel() has no other way to set an object description, and @AckField has no description: parameter. We pass these schemas to a language model to describe app state, so today we have to repeat each class description by hand next to the model.
Proposal
When an @AckModel() class has a doc comment, use it as the description of the generated object schema:
Normalize it the same way as field docs: /// and /** */, with the comment markers removed and the lines joined by spaces.
Apply it to the generated object schema and to the model codec, so XSchema.toJsonSchema(), XSchema.schema.description, XSchema.wireSchema.description, and toSchemaModel() all carry it.
Unions: the sealed base's doc comment describes the discriminated schema, and each branch's doc comment describes that branch's object in anyOf. Implicit, unannotated branches work the same way.
With no doc comment, no description is emitted. The output for undocumented classes doesn't change.
When a model is used as a field of another model and the field has its own doc comment, the field doc wins at that property, the same way .describe() layers today. Without a field doc, the nested model's class description appears there.
@AckInfer() needs no change, because its schema is authored directly and .describe() already covers it.
Compatibility
This is additive: no annotation or API changes. After regeneration, classes that already have doc comments gain a description in their generated schema, just as documented fields already do.
Activity
leoafarias commentedon Oct 8, 2026
Closed by #176 (shipped in 1.7.0-beta.2).