Skip to content

Person builder

Creates a Person for authors, performers, and other identities. The Person builder injects @type, validates synchronously, and rejects unknown properties.

// Astro — shown first when Astro is selected
import { Person } from '@unschema-graph/astro';
// Svelte 5
import { Person } from '@unschema-graph/svelte';
// Core / Node.js
import { Person } from '@unschema-graph/core';
import { PersonSchema } from '@unschema-graph/core';

The PersonSchema Zod schema is also exported for composition and advanced validation.

import {
PersonSchema,
type SchemaInput,
type SchemaOutput,
} from '@unschema-graph/core';
type PersonInput = SchemaInput<typeof PersonSchema>;
type PersonOutput = SchemaOutput<typeof PersonSchema, 'Person'>;
Property Input type Required Default / constraints
@id string No —
name string Yes non-empty
givenName string No —
familyName string No —
additionalName string No —
url string No —
image string | ImageObject No non-empty
jobTitle string No —
worksFor string | object No —
sameAs string | Array No —
email string No format: email
telephone string No —
description string No —
address string | PostalAddress | EntityReference No —

The aliases above remain the exact authority for nested object types. The builder also accepts a validation configuration as its second argument and always returns @type: 'Person'.

import { Person } from '@unschema-graph/core';
const entity = Person({
"name": "Ada Lovelace",
"jobTitle": "Engineer"
});
{
"@type": "Person",
"name": "Ada Lovelace",
"jobTitle": "Engineer"
}
  • Passing an unknown property to the strict builder.
  • Using source data that is missing a required property.
  • Assuming valid Schema.org guarantees a search appearance.

Use Person.safeParse(input) for external data. If Schema.org supports a property that is not modeled yet, validate the entity first and then use withAdditionalProperties(). Never pass invented properties to the strict builder.