Skip to main content

parseEntityRef()

Home > @backstage/catalog-model > parseEntityRef

Parses an entity reference, either on string or compound form, and returns a structure with a name, and optional kind and namespace.

Signature:

function parseEntityRef(ref: string | {
kind?: string;
namespace?: string;
name: string;
}, context?: {
defaultKind?: string;
defaultNamespace?: string;
}): CompoundEntityRef;

Parameters

ParameterTypeDescription
refstring | { kind?: string; namespace?: string; name: string; }The reference to parse
context{ defaultKind?: string; defaultNamespace?: string; }(Optional) The context of defaults that the parsing happens within

Returns:

CompoundEntityRef

The compound form of the reference

Remarks

The context object can contain default values for the kind and namespace, that will be used if the input reference did not specify any.