メインコンテンツまでスキップ
バージョン: 🚧 Canary

📐 Avatar schemas

Avatar provides one reusable schema for the persisted file reference consumed by owner schemas and Avatar blocks. It is not the normalized response shape, which exposes {type, url}.

Inventory

ExportRequest locationContract
avatarSchemaN/A — reusable stored objectRequires a UUID-formatted string objectId and string type; rejects additional properties. Used by Profile creation and update request schemas.

Details

avatarSchema

Definition

Persist a value shaped as {objectId, type}. objectId must use the validator’s uuid format and type is any string; this schema does not constrain it to a MIME-type allowlist. Because additionalProperties is false, the stored reference cannot include an extra field. Owners that have no avatar must allow null in their enclosing schema; Profile schemas are one consumer. Before responding, use normalizeAvatarOfOwner or normalizeAvatarsOfOwners to replace objectId with a signed url.

LocationFieldTypeRequiredConstraints
N/A — stored objectobjectIdstringYesuuid format
N/A — stored objecttypestringYesNo MIME-type enum or pattern is enforced

additionalProperties is false. The schema is composed as oneOf: [avatarSchema, {type: 'null'}] by Profile’s profileSchema and updateProfileSchema, so avatar itself is optional in those enclosing request bodies and may be null.

Used by feature: Profile’s createProfileFeature and updateProfileFeature.

Used by route: POST /profiles and PATCH /profiles/:profileId.

View complete source
export const avatarSchema: SchemaDefinition = {
additionalProperties: false,
properties: {
objectId: { format: 'uuid', type: 'string' },
type: { type: 'string' },
},
required: ['objectId', 'type'],
type: 'object',
};