EntityOrderQuery
Home > @backstage/catalog-client
> EntityOrderQuery
Dot-separated field based ordering directives, controlling the sort order of the output entities.
Signature:
export type EntityOrderQuery = {
field: string;
order: 'asc' | 'desc';
} | Array<{
field: string;
order: 'asc' | 'desc';
}>;
Remarks
Each field is a dot-separated path into an entity's keys. The order is either ascending (asc
, lexicographical order) or descending (desc
, reverse lexicographical order). The ordering is case insensitive.
If more than one order directive is given, later directives have lower precedence (they are applied only when directives of higher precedence have equal values).
Example:
[
{ field: 'kind', order: 'asc' },
{ field: 'metadata.name', order: 'desc' },
]
This will order the output first by kind ascending, and then within each kind (if there's more than one of a given kind) by their name descending.
When given a field that does NOT exist on all entities in the result set, those entities that do not have the field will always be sorted last in that particular order step, no matter what the desired order was.