Validation
Which rules the components enforce at build time, and what the build reports afterwards.
Invalid structured data is never rendered. Every component validates its props against its Zod schema at render time. Any violation throws and fails the build (or the request, in SSR) with a message naming the component, the page and the offending fields.
Rules
- Unknown props are rejected, so typos cannot silently drop data. Attributes that belong
to Astro itself,
slot(e.g.<ArticleSchema slot="head" />) anddata-astro-*, are ignored. - Formats: dates are ISO 8601 (
2026-06-01,2026-06-01T18:00:00+02:00) orDateobjects; durations are ISO 8601 (PT1H30M); currencies are ISO 4217 (EUR); URLs are absolutehttp(s)URLs or root-relative paths (/img.jpg); text fields must not be empty. - Cross-field rules, e.g.
priceandpriceCurrencyonly together,ratingValueandreviewCountonly together, image dimensions only with an image, an end date not before its start date, at most one ofoffers,priceRangeandprice. - schema.org objects passed to
ProductSchema(offers,brand,shippingDetails,returnPolicy) and the optionsdefaultBrand,defaultShippingDetailsanddefaultReturnPolicyare checked for their known properties: prices, ISO 4217 currencies, ISO 3166 country codes (DE), schema.org enumeration values (InStockorhttps://schema.org/InStock), delivery day ranges, andmerchantReturnDaysfor aMerchantReturnFiniteReturnWindow. AnOfferneedspriceandpriceCurrencyor apriceSpecificationwith both; a shipping rate needsvalueormaxValue. Nested schema.org types such asMonetaryAmountorDefinedRegionare added to the output when you leave them out. Shipping details or a return policy set on an individual offer win over the component props and configured defaults. Further schema.org properties on these objects are allowed and passed through unchecked. - Location follows attendance mode for events:
Offlineneeds a venue name and address,OnlineneedsonlineUrland allows no venue (output asVirtualLocation),Mixedneeds both. - Job locations follow Google’s rules: on-site jobs need
jobLocation, fully remote jobs setjobLocationType="TELECOMMUTE"plusapplicantLocationRequirements. - Page-level checks: all schemas on a page must agree on their sitemap hints, and in graph
mode a page with schemas must render
<SchemaGraph />exactly once.
No invented values
Components never fill in placeholder data. Where schema.org needs a value, such as the name of
an organisation, it comes from a prop or a configured default (defaultLocalBusiness,
defaultArticlePublisher), otherwise the build fails. Fields like employmentType,
operatingSystem or applicationCategory are omitted when not set.
Output escaping
JSON-LD output is escaped so that content cannot break out of the <script> block.
After the build
The integration reads every JSON-LD block in the generated HTML. A block that is not valid
JSON fails the build. Arrays and @graph blocks are checked item by item. With warnOnMissingRecommended (on by default) it also logs one warning
per missing recommended field and type, nested properties as dot paths:
[structured-data] Organization is missing recommended field "sameAs" — add it for richer search results.
Recommended fields are optional props that Google’s rich result guidelines list as beneficial;
leaving them out does not break validation. Turn the warnings off with
structuredData({ warnOnMissingRecommended: false }).