🚨 Announcement: A New Chapter for Vendure read more

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)
  async validateSlugs(ctx: RequestContext, input: T, translationEntity: Type<E>) => Promise<T>;
}

Members

constructor

method
type:
(connection: TransactionalConnection) => SlugValidator

validateSlugs

async method
type:
(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;
}

Members

id

property
type:
ID | null

translations

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

TranslationEntity

Signature

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