Skip to main content

SlugValidator

SlugValidator

Used to validate slugs to ensure they are URL-safe and unique. Designed to be used with translatable entities such as Product and Collection.

Signature
class SlugValidator {
constructor(connection: TransactionalConnection)
validateSlugs(ctx: RequestContext, input: T, translationEntity: Type<E>) => Promise<T>;
}

constructor

method
(connection: TransactionalConnection) => SlugValidator

validateSlugs

method
(ctx: RequestContext, input: T, translationEntity: Type<E>) => Promise<T>

InputWithSlug

Signature
type InputWithSlug = {
id?: ID | null;
translations?: Array<{
id?: ID | null;
languageCode: LanguageCode;
slug?: string | null;
}> | null;
}

id

property
ID | null

translations

property
Array<{ id?: ID | null; languageCode: LanguageCode; slug?: string | null; }> | null

TranslationEntity

Signature
type TranslationEntity = VendureEntity & {
id: ID;
languageCode: LanguageCode;
slug: string;
base: any;
}