VacationRental builder
Le builder VacationRental crée une entité VacationRental, injecte son @type,
valide les données de manière synchrone et rejette les propriétés inconnues.
// Astro — shown first when Astro is selectedimport { VacationRental } from '@unschema-graph/astro';
// Svelte 5import { VacationRental } from '@unschema-graph/svelte';
// Core / Node.jsimport { VacationRental } from '@unschema-graph/core';import { LodgingBusinessSchema } from '@unschema-graph/core';Le schéma Zod LodgingBusinessSchema est également exporté pour la composition et la validation avancées.
Types TypeScript
Section intitulée « Types TypeScript »import { LodgingBusinessSchema, type SchemaInput, type SchemaOutput,} from '@unschema-graph/core';
type VacationRentalInput = SchemaInput<typeof LodgingBusinessSchema>;type VacationRentalOutput = SchemaOutput<typeof LodgingBusinessSchema, 'VacationRental'>;Propriétés d’entrée
Section intitulée « Propriétés d’entrée »| Propriété | Type d’entrée | Obligatoire | Valeur par défaut / contraintes |
|---|---|---|---|
@id |
string | Non | non-empty |
name |
string | Oui | non-empty |
address |
string | PostalAddress | EntityReference | Oui | — |
image |
string | ImageObject | Non | non-empty |
telephone |
string | Non | — |
priceRange |
string | Non | — |
url |
string | Non | — |
geo |
GeoCoordinates | Non | — |
openingHoursSpecification |
object | Array | Non | — |
currenciesAccepted |
string | Non | — |
paymentAccepted |
string | Non | — |
sameAs |
string | Array |
Non | — |
servesCuisine |
string | Array |
Non | — |
menu |
string | Non | — |
checkinTime |
string | Non | — |
checkoutTime |
string | Non | — |
numberOfRooms |
number | Non | integer; greater than 0; maximum: 9007199254740991 |
petsAllowed |
boolean | string | Non | — |
amenityFeature |
string | Array |
Non | — |
starRating |
object | Non | — |
Les alias ci-dessus restent la référence exacte, notamment pour les objets imbriqués. Le builder
accepte aussi une configuration de validation en second argument et possède une sortie dont le
@type vaut toujours VacationRental.
Exemple minimal
Section intitulée « Exemple minimal »import { VacationRental } from '@unschema-graph/core';
const entity = VacationRental({ "name": "Acme Paris", "address": { "streetAddress": "1 Rue de Rivoli", "addressLocality": "Paris", "postalCode": "75001", "addressCountry": "FR" }});{ "@type": "VacationRental", "name": "Acme Paris", "address": { "streetAddress": "1 Rue de Rivoli", "addressLocality": "Paris", "postalCode": "75001", "addressCountry": "FR" }}Relations et recettes
Section intitulée « Relations et recettes »- Builders liés :
Organization,Person,LocalBusiness,Restaurant - Utilisé par : aucune recette dédiée
- Sources externes : Schema.org VacationRental
Erreurs fréquentes
Section intitulée « Erreurs fréquentes »- Passer une propriété inconnue au builder strict.
- Utiliser une donnée source privée d’une propriété obligatoire.
- Supposer qu’un Schema.org valide garantit un affichage dans la recherche.
Validation
Section intitulée « Validation »Utilisez VacationRental.safeParse(input) pour les données externes. Pour une extension
Schema.org non encore modélisée, validez d’abord l’entité puis utilisez
withAdditionalProperties(). N’ajoutez jamais une propriété inventée au builder.