entitySchemaValidator()
Home > @backstage/catalog-model
> entitySchemaValidator
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.
Signature:
function entitySchemaValidator<T extends Entity = Entity>(schema?: unknown): (data: unknown) => T;
Parameters
Parameter |
Type |
Description |
---|---|---|
schema |
unknown |
(Optional) |
(data: unknown) => T
Remarks
Note that this validator is only meant for applying the base schema checks; it does not take custom policies or additional processor based validation into account.
By default, the plain Entity schema is used. If you pass in your own, it may contain $ref
references to the following, which are resolved automatically for you:
- Entity - EntityEnvelope - EntityMeta -
common#<id>