WebApplication builder
Le builder WebApplication crée une entité WebApplication, 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 { WebApplication } from '@unschema-graph/astro';
// Svelte 5import { WebApplication } from '@unschema-graph/svelte';
// Core / Node.jsimport { WebApplication } from '@unschema-graph/core';import { SoftwareApplicationSchema } from '@unschema-graph/core';Le schéma Zod SoftwareApplicationSchema est également exporté pour la composition et la validation avancées.
Types TypeScript
Section intitulée « Types TypeScript »import { SoftwareApplicationSchema, type SchemaInput, type SchemaOutput,} from '@unschema-graph/core';
type WebApplicationInput = SchemaInput<typeof SoftwareApplicationSchema>;type WebApplicationOutput = SchemaOutput<typeof SoftwareApplicationSchema, 'WebApplication'>;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 |
operatingSystem |
string | Non | — |
applicationCategory |
string | Non | — |
offers |
Offer | AggregateOffer | Array<Offer | AggregateOffer> | Non | — |
aggregateRating |
AggregateRating | Non | — |
review |
Review | Array<Review> | Non | — |
screenshot |
string | ImageObject | Array<string | ImageObject> | Non | non-empty |
softwareVersion |
string | Non | — |
downloadUrl |
string | Non | — |
fileSize |
string | Non | — |
description |
string | 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 WebApplication.
Exemple minimal
Section intitulée « Exemple minimal »import { WebApplication } from '@unschema-graph/core';
const entity = WebApplication({ "name": "Acme Editor", "operatingSystem": "Web", "applicationCategory": "DeveloperApplication"});{ "@type": "WebApplication", "name": "Acme Editor", "operatingSystem": "Web", "applicationCategory": "DeveloperApplication"}Relations et recettes
Section intitulée « Relations et recettes »- Builders liés :
Product,Offer,AggregateOffer,Service - Utilisé par : aucune recette dédiée
- Sources externes : Schema.org WebApplication
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 WebApplication.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.