Open
Description
Working with Learning Core's authoring api is mostly a joy, except for the inconsistent usage of the terms "id", "key", and "slug". This applies to the LC-related objects and models in opaque-keys and edx-platform, as well.
I would propose standardizing on these meanings of each term for all new content-related code, and for any existing code which is not too burdensome to change:
*_id
is an integer primary key.*_uuid
is a UUID.*_slug
is a URL-friendly string which identifies something within a local scope. On the Component model, we currently call this is a "local key".*_key
is a string (or an opaque-keys object) which uniquely identifies something across a whole Open edX instance. Can be composed of slugs, or of other slug-like things like a block/component type.
For example, one change I'd like to make is:
- On the model,
Collection.key
should be renamedCollection.slug
- The corresponding field on the opaque-keys object,
LibraryCollectionLoctator.collection_id
should be renamedLibraryCollectionLocator.slug
. - Function arguments and dataclass members should be renamed accordingly.
Metadata
Metadata
Assignees
Labels
No labels