pub-dev icon indicating copy to clipboard operation
pub-dev copied to clipboard

Document entity name/id + parentKey

Open jonasfj opened this issue 6 years ago • 2 comments

In our entities we are not good at documenting what the Model.id and Model.parentKey is.

We should go through all entities and make sure this is documented for each Kind. (This is important, as this is how an entity is looked up).

Sometimes we also duplicate properties from the id and parentKey because we can query them without an ancestor key, we should also document all cases where data is duplicated and an invariant must be manually maintained.

jonasfj avatar Oct 28 '19 08:10 jonasfj

Asked around, it seems we can do:

  /// Id is...
  @override
  String get id => super.id as String;

  /// Parent key is...
  @override
  db.Key get parentKey;

In short we should add this to all subclasses of db.Model (and db.ExpandoModel).

jonasfj avatar Oct 28 '19 09:10 jonasfj

This might still be valuable

Maybe we should document the entire data-model somewhere in a single place, and not spread out over all the model files.

sigurdm avatar Sep 26 '24 08:09 sigurdm