Skip to main content

@backstage/catalog-model

Home > @backstage/catalog-model

Types and validators that help describe the model of a Backstage Catalog

Classes

Class

Description

CommonValidatorFunctions

Contains various helper validation and normalization functions that can be composed to form a Validator.

DefaultNamespaceEntityPolicy

Sets a default namespace if none was set.

FieldFormatEntityPolicy

Ensures that the format of individual fields of the entity envelope is valid.

GroupDefaultParentEntityPolicy

DefaultParentPolicy is an EntityPolicy that updates group entities with a parent of last resort. This ensures that, while we preserve any existing group hierarchies, we can guarantee that there is a single global root of the group hierarchy.

KubernetesValidatorFunctions

Contains validation functions that match the Kubernetes spec, usable to build a catalog that is compatible with those rule sets.

NoForeignRootFieldsEntityPolicy

Ensures that there are no foreign root fields in the entity.

SchemaValidEntityPolicy

Ensures that the entity spec is valid according to a schema.

Functions

Function

Description

entityEnvelopeSchemaValidator(schema)

Creates a validation function that takes some arbitrary data, and either returns that data cast to an EntityEnvelope (or the given subtype) if it matches that schema, or throws a describing the errors.

entityKindSchemaValidator(schema)

Creates a validation function that takes some arbitrary data, and either returns that data cast to a T if it matches that schema, or false if the schema apiVersion/kind didn't apply to that data, or throws a describing actual errors.

entitySchemaValidator(schema)

Creates a validation function that takes some arbitrary data, and either returns that data cast to an Entity (or the given subtype) if it matches that schema, or throws a describing the errors.

getCompoundEntityRef(entity)

Extracts the kind, namespace and name that form the compound entity ref triplet of the given entity.

getEntitySourceLocation(entity)

Returns the source code location of the Entity, to the extent that one exists.

isApiEntity(entity)

isComponentEntity(entity)

isDomainEntity(entity)

isGroupEntity(entity)

isLocationEntity(entity)

isResourceEntity(entity)

isSystemEntity(entity)

isUserEntity(entity)

makeValidator(overrides)

Creates a Validators object from overrides, with default values taken from KubernetesValidatorFunctions

parseEntityRef(ref, context)

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

parseLocationRef(ref)

Parses a string form location reference.

stringifyEntityRef(ref)

Takes an entity or entity name/reference, and returns the string form of an entity ref.

stringifyLocationRef(ref)

Turns a location ref into its string form.

Interfaces

Interface

Description

ApiEntityV1alpha1

Backstage API kind Entity. APIs describe the interfaces for Components to communicate.

ComponentEntityV1alpha1

Backstage catalog Component kind Entity. Represents a single, individual piece of software.

DomainEntityV1alpha1

Backstage Domain kind Entity. Domains group Systems together.

GroupEntityV1alpha1

Backstage catalog Group kind Entity.

LocationEntityV1alpha1

Backstage catalog Location kind Entity.

ResourceEntityV1alpha1

Backstage catalog Resource kind Entity. Represents infrastructure required to operate Components.

SystemEntityV1alpha1

Backstage catalog System kind Entity. Systems group Components, Resources and APIs together.

UserEntityV1alpha1

Backstage catalog User kind Entity.

Variables

Variable

Description

ANNOTATION_EDIT_URL

Annotation for linking to entity edit page from catalog pages.

ANNOTATION_KUBERNETES_API_SERVER_CA

Annotation for specifying the Certificate Authority of an API server for a Kubernetes cluster

ANNOTATION_KUBERNETES_API_SERVER

Annotation for specifying the API server of a Kubernetes cluster

ANNOTATION_KUBERNETES_AUTH_PROVIDER

Annotation for specifying the auth provider for a Kubernetes cluster

ANNOTATION_LOCATION

Entity annotation containing the location from which the entity is sourced.

ANNOTATION_ORIGIN_LOCATION

Entity annotation containing the originally sourced location which ultimately led to this entity being ingested.

ANNOTATION_SOURCE_LOCATION

Entity annotation pointing to the source (e.g. source code repository root or similar) for this entity.

ANNOTATION_VIEW_URL

Annotation for linking to entity page from catalog pages.

apiEntityV1alpha1Validator

KindValidator for ApiEntityV1alpha1.

componentEntityV1alpha1Validator

KindValidator for ComponentEntityV1alpha1.

DEFAULT_NAMESPACE

The namespace that entities without an explicit namespace fall into.

domainEntityV1alpha1Validator

KindValidator for DomainEntityV1alpha1.

EntityPolicies

Provides helpers for enforcing a set of EntityPolicy in an and/or expression.

groupEntityV1alpha1Validator

KindValidator for GroupEntityV1alpha1.

locationEntityV1alpha1Validator

KindValidator for LocationEntityV1alpha1.

RELATION_API_CONSUMED_BY

A relation of an API being consumed, typically by a component. Reversed direction of RELATION_CONSUMES_API.

RELATION_API_PROVIDED_BY

A relation from an API to its provider entity (typically a component). Reversed direction of RELATION_PROVIDES_API.

RELATION_CHILD_OF

A relation from a child to a parent entity, used for example to describe the organizational structure between groups. Reversed direction of RELATION_PARENT_OF.

RELATION_CONSUMES_API

A relation with an API entity, typically from a component. Reversed direction of RELATION_API_CONSUMED_BY.

RELATION_DEPENDENCY_OF

A relation denoting a reverse dependency by another entity. Reversed direction of RELATION_DEPENDS_ON.

RELATION_DEPENDS_ON

A relation denoting a dependency on another entity. Reversed direction of RELATION_DEPENDENCY_OF.

RELATION_HAS_MEMBER

A relation from a group to its member, typically a user in a group. Reversed direction of RELATION_MEMBER_OF.

RELATION_HAS_PART

A relation from a containing entity to a contained entity. Reversed direction of RELATION_PART_OF.

RELATION_MEMBER_OF

A membership relation, typically for users in a group. Reversed direction of RELATION_HAS_MEMBER.

RELATION_OWNED_BY

An ownership relation where the owner is usually an organizational entity (user or group), and the other entity can be anything. Reversed direction of RELATION_OWNER_OF.

RELATION_OWNER_OF

A relationship from an owner to the owned entity. Reversed direction of RELATION_OWNED_BY.

RELATION_PARENT_OF

A parent/child relation to build up a tree, used for example to describe the organizational structure between groups. Reversed direction of RELATION_CHILD_OF.

RELATION_PART_OF

A part/whole relation, typically for components in a system and systems in a domain. Reversed direction of RELATION_HAS_PART.

RELATION_PROVIDES_API

A relation from an API provider entity (typically a component) to the API. Reversed direction of RELATION_API_PROVIDED_BY.

resourceEntityV1alpha1Validator

KindValidator for ResourceEntityV1alpha1.

systemEntityV1alpha1Validator

KindValidator for SystemEntityV1alpha1.

userEntityV1alpha1Validator

KindValidator for UserEntityV1alpha1.

Type Aliases

Type Alias

Description

CompoundEntityRef

All parts of a complete entity ref, forming a full kind-namespace-name triplet.

Entity

The parts of the format that's common to all versions/kinds of entity.

EntityEnvelope

The envelope skeleton parts of an entity - whatever is necessary to be able to give it a ref and pass to further validation / policy checking.

EntityLink

A link to external information that is related to the entity.

EntityMeta

Metadata fields common to all versions/kinds of entity.

EntityPolicy

A policy for validation or mutation to be applied to entities as they are entering the system.

EntityRelation

A relation of a specific type to another entity in the catalog.

KindValidator

Validates entities of a certain kind.

Validators

Type alias for implementing validators of various entity objects.