AggregateOffer builder
Creates an AggregateOffer describing a price range. The AggregateOffer builder injects @type, validates synchronously, and
rejects unknown properties.
Import
Section titled “Import”// Astro — shown first when Astro is selectedimport { AggregateOffer } from '@unschema-graph/astro';
// Svelte 5import { AggregateOffer } from '@unschema-graph/svelte';
// Core / Node.jsimport { AggregateOffer } from '@unschema-graph/core';import { AggregateOfferSchema } from '@unschema-graph/core';The AggregateOfferSchema Zod schema is also exported for composition and advanced validation.
TypeScript types
Section titled “TypeScript types”import { AggregateOfferSchema, type SchemaInput, type SchemaOutput,} from '@unschema-graph/core';
type AggregateOfferInput = SchemaInput<typeof AggregateOfferSchema>;type AggregateOfferOutput = SchemaOutput<typeof AggregateOfferSchema, 'AggregateOffer'>;Input properties
Section titled “Input properties”| Property | Input type | Required | Default / constraints |
|---|---|---|---|
@id |
string | No | — |
lowPrice |
number | string | Yes | — |
highPrice |
number | string | No | — |
priceCurrency |
string | Yes | minimum length: 3; maximum length: 3 |
offerCount |
number | string | No | — |
offers |
Offer | AggregateOffer | Array<Offer | AggregateOffer> | 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: 'AggregateOffer'.
Minimal example
Section titled “Minimal example”import { AggregateOffer } from '@unschema-graph/core';
const entity = AggregateOffer({ "lowPrice": 79, "highPrice": 129, "priceCurrency": "EUR", "offerCount": 3});Output
Section titled “Output”{ "@type": "AggregateOffer", "lowPrice": 79, "highPrice": 129, "priceCurrency": "EUR", "offerCount": 3}Relationships and recipes
Section titled “Relationships and recipes”- Related builders:
Product,Offer,Service,JobPosting - Used by: E-commerce
- External sources: Schema.org AggregateOffer
Common errors
Section titled “Common errors”- 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.
Validation
Section titled “Validation”Use AggregateOffer.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.