Skip to content

Why does abstract Descriptor not have an id? #552

@s-heppner

Description

@s-heppner

When implementing logic to locate Descriptor objects in our Registry Server implementation, I noticed that both AssetAdministrationShellDescriptor and SubmodelDescriptor define an id attribute, while the base class Descriptor does not.

Since these objects appear to be identified by their id, and all current subclasses share this attribute, it is unclear why the parent class does not define it.

This makes typing slightly more complicated. For example, instead of returning the common base type:

def get_descriptor_by_id(id: Identifier) -> Descriptor:
    pass

the function currently needs to return a union of the concrete subclasses:

def get_descriptor_by_id(id: Identifier) -> Union[AssetAdministrationShellDescriptor, SubmodelDescriptor]:
    pass

This is not necessarily a bug, but rather a design or modeling question. Is there a reason why id is not defined in the base Descriptor class?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions