Skip to content

Metadata API: Consider if Metadata class should contain role name #1425

@jku

Description

@jku

I'm not sure if this is worth the trouble, writing it out anyway...

Description of issue or feature request:

I've been looking at our data structures lately, trying to improve their usability... and one theme that comes up is that objects should include their identifier if they have one -- the json file format does not do this because it would be wasteful in a wire format but the same does not apply to python objects. There's a PR for Key already but I think the same logic applies to Metadata itself: Our Metadata objects always have a role name that is available when the Metadata is constructed, the name is immutable during lifetime of the object and often needed with the Metadata object (e.g. verify_delegate(), writing to file)

Quick estimates of what this means to API:

  • Metadata.__init__(): Add argument role_name: str
  • Metadata.from_bytes(): Add argument role_name: str
  • Metadata.from_dict(): Add argument role_name: str
  • Metadata.from_file(): No change -- the role name can be deciphered from file name. Alternatively the argument could be split to two (to match to_file() below): directory and role name
  • Metadata.to_dict(): No change
  • Metadata.to_file(): Hmm... not sure how to do this in a nice way: there's three components to the path: directory, basename and extension. Maybe the argument should be just the directory, the basename is then the role name and extension should be a class variable of Serializer?
  • verify_delegate(): (once it exists) remove argument role_name -- this is included in metadata already

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionDiscussions related to the design, implementation and operation of the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions