JobPosting builder
Le builder JobPosting crée une entité JobPosting, 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 { JobPosting } from '@unschema-graph/astro';
// Svelte 5import { JobPosting } from '@unschema-graph/svelte';
// Core / Node.jsimport { JobPosting } from '@unschema-graph/core';import { JobPostingSchema } from '@unschema-graph/core';Le schéma Zod JobPostingSchema est également exporté pour la composition et la validation avancées.
Types TypeScript
Section intitulée « Types TypeScript »import { JobPostingSchema, type SchemaInput, type SchemaOutput,} from '@unschema-graph/core';
type JobPostingInput = SchemaInput<typeof JobPostingSchema>;type JobPostingOutput = SchemaOutput<typeof JobPostingSchema, 'JobPosting'>;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 |
title |
string | Oui | non-empty |
description |
string | Oui | non-empty |
datePosted |
string | number | Date | Oui | non-empty |
hiringOrganization |
string | Organization | EntityReference | Oui | non-empty |
jobLocation |
Place | PostalAddress | EntityReference | string | Non | — |
validThrough |
string | number | Date | Non | non-empty |
employmentType |
string | Array |
Non | — |
jobLocationType |
string | Non | — |
applicantLocationRequirements |
string | object | Non | — |
baseSalary |
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 JobPosting.
Exemple minimal
Section intitulée « Exemple minimal »import { JobPosting } from '@unschema-graph/core';
const entity = JobPosting({ "title": "Astro developer", "description": "Build accessible content sites.", "datePosted": "2026-09-29", "hiringOrganization": "Acme"});{ "@type": "JobPosting", "title": "Astro developer", "description": "Build accessible content sites.", "datePosted": "2026-09-29", "hiringOrganization": { "@type": "Organization", "name": "Acme" }}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 JobPosting
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 JobPosting.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.