YAMLResume

Zod Schema

YAMLResume adopts zod to validate resume data in runtime.

This document outlines all zod schema used in YAMLResume. If you are interested in the implementation details, you can find the source code here.

Resume Schema

Defines the overall resume structure validation, including content and layout validation.

PropTypeRequired
contentContentSchema✅
layouts?LayoutsSchema⬜
locale?LocaleSchema⬜

ContentSchema

Defines the validation structure for the entire resume content.

PropTypeRequired
basicsBasicsItemSchema✅
educationEducationItemSchema[]✅
awards?AwardItemSchema[]⬜
certificates?CertificateItemSchema[]⬜
interests?InterestItemSchema[]⬜
languages?LanguageItemSchema[]⬜
location?LocationItemSchema⬜
projects?ProjectItemSchema[]⬜
profiles?ProfileItemSchema[]⬜
publications?PublicationItemSchema[]⬜
references?ReferenceItemSchema[]⬜
skills?SkillItemSchema[]⬜
volunteer?VolunteerItemSchema[]⬜
work?WorkItemSchema[]⬜

AwardItemSchema

Validates a single award, honor, or recognition received.

PropTypeRequiredValidation Rules
awarderstring✅2-128 characters
titlestring✅2-128 characters
date?string⬜see date schema
summary?string⬜see summary schema

BasicsItemSchema

Validates the core personal and contact information.

PropTypeRequiredValidation Rules
namestring✅2-128 characters
email?string⬜see email schema
headline?string⬜2-128 characters
phone?string⬜see phone schema
summary?string⬜see summary schema
url?string⬜see url schema

CertificateItemSchema

Validates a single certification, credential, or professional qualification.

PropTypeRequiredValidation Rules
issuerstring✅2-128 characters
namestring✅2-128 characters
date?string⬜see date schema
url?string⬜see url schema

EducationItemSchema

Validates a single educational experience or degree program.

PropTypeRequiredValidation Rules
areastring✅2-64 characters
degreeDegree✅Must be from predefined degree options
institutionstring✅2-128 characters
startDatestring✅see date schema
courses?string[]⬜Each item 2-128 characters
endDate?string⬜see date schema
summary?string⬜see summary schema
score?string⬜2-32 characters
url?string⬜see url schema

InterestItemSchema

Validates a single interest, hobby, or personal activity.

PropTypeRequiredValidation Rules
namestring✅2-128 characters
keywords?string[]⬜see keywords schema

LanguageItemSchema

Validates a single language proficiency item.

PropTypeRequiredValidation Rules
fluencyFluency✅Must be from predefined fluency options
languageLanguage✅Must be from predefined language options
keywords?string[]⬜Each item 1-32 characters

LocationItemSchema

Validates location and address information.

PropTypeRequiredValidation Rules
citystring✅2-128 characters
address?string⬜2-128 characters
country?Country⬜Must be from predefined country options
postalCode?string⬜2-128 characters
region?string⬜2-128 characters

ProfileItemSchema

Validates a single online profile or social media presence.

PropTypeRequiredValidation Rules
networkNetwork✅Must be from predefined network options
usernamestring✅2-128 characters
url?string⬜Valid URL, max 256 chars

ProjectItemSchema

Validates a single project, portfolio piece, or technical work.

PropTypeRequiredValidation Rules
namestring✅2-128 characters
startDatestring✅see date schema
summarystring✅see summary schema
description?string⬜4-128 characters
endDate?string⬜see date schema
keywords?string[]⬜Each item 1-32 characters
url?string⬜Valid URL, max 256 chars

PublicationItemSchema

Validates a single publication, research work, or academic paper.

PropTypeRequiredValidation Rules
namestring✅2-128 characters
publisherstring✅2-128 characters
releaseDate?string⬜see date schema
summary?string⬜see summary schema
url?string⬜Valid URL, max 256 chars

ReferenceItemSchema

Validates a single professional reference or recommendation.

PropTypeRequiredValidation Rules
namestring✅2-128 characters
summarystring✅see summary schema
email?string⬜see email schema
phone?string⬜Valid phone format
relationship?string⬜2-128 characters

SkillItemSchema

Validates a single skill, competency, or technical ability.

PropTypeRequiredValidation Rules
levelLevel✅Must be from predefined level options
namestring✅2-128 characters
keywords?string[]⬜Each item 1-32 characters

VolunteerItemSchema

Validates a single volunteer experience or community service.

PropTypeRequiredValidation Rules
organizationstring✅2-128 characters
positionstring✅2-128 characters
startDatestring✅see date schema
summarystring✅see summary schema
endDate?string⬜see date schema
url?string⬜Valid URL, max 256 chars

WorkItemSchema

Validates a single work experience or employment position.

PropTypeRequiredValidation Rules
namestring✅2-128 characters
positionstring✅2-128 characters
startDatestring✅see date schema
summarystring✅see summary schema
endDate?string⬜see date schema
keywords?string[]⬜Each item 1-32 characters
url?string⬜Valid URL, max 256 chars

LocaleSchema

Validates locale settings for internationalization and localization.

PropTypeRequiredValidation Rules
language?LocaleLanguage⬜Must be from predefined locale language options

LayoutsSchema

Defines the overall layout validation configuration.

PropTypeRequiredValidation Rules
layouts[]DocxLayoutSchema | HtmlLayoutSchema | LatexLayoutSchema | MarkdownLayoutSchema⬜Array of layout configurations.

Common Layout Schemas

MarginsSchema

Validates page margin settings for document layout.

PropTypeRequiredValidation Rules
top?string⬜see margin size schema
bottom?string⬜see margin size schema
left?string⬜see margin size schema
right?string⬜see margin size schema
SectionsSchema

Validates section customization settings.

PropTypeRequiredValidation Rules
aliases?Record<SectionID, string>⬜Keys must be valid section IDs, values must be strings (2-128 chars)
order?OrderableSectionID[]⬜Array of valid orderable section IDs

HtmlLayoutSchema

Validates HTML layout configuration.

PropTypeRequired
engine'html'✅
advanced?HtmlAdvancedSchema⬜
sections?SectionsSchema⬜
template?HtmlTemplateSchema⬜
typography?HtmlTypographySchema⬜
HtmlAdvancedSchema

Validates advanced HTML configuration options.

PropTypeRequiredValidation Rules
showIcons?boolean⬜true/false
title?string⬜-
footer?string⬜-
description?string⬜-
keywords?string⬜-
HtmlTemplateSchema

Validates HTML template configuration.

PropTypeRequiredValidation Rules
templateHtmlTemplate⬜Must be from predefined template options
HtmlTypographySchema

Validates HTML typography settings.

PropTypeRequiredValidation Rules
fontSize?HtmlFontSize⬜Must be from predefined font size options
fontFamily?string⬜A comma-separated list of font families.
lineSpacing?LineSpacing⬜Must be from predefined line spacing options

LatexLayoutSchema

Validates LaTeX layout configuration.

PropTypeRequiredValidation Rules
advanced?LatexAdvancedSchema⬜See advanced schema
engine'latex'✅Must be "latex"
page?LatexPageSchema⬜See page schema
sections?SectionsSchema⬜See sections schema
template?LatexTemplate⬜Must be from predefined template options
typography?LatexTypographySchema⬜See typography schema
LatexAdvancedSchema

Validates advanced LaTeX configuration options.

PropTypeRequiredValidation Rules
fontspec?{ numbers?: LatexFontspecNumbers }⬜Must be from predefined fontspec numbers options
showIcons?boolean⬜true/false
showUrls?boolean⬜true/false
LatexPageSchema

Validates page-level settings for document presentation.

PropTypeRequiredValidation Rules
margins?MarginsSchema⬜See margins schema
paperSize?PaperSize⬜Must be from predefined paper size options
showPageNumbers?boolean⬜true/false
LatexTypographySchema

Validates typography settings for document formatting.

PropTypeRequiredValidation Rules
fontSize?string⬜Must be from predefined font size options
fontFamily?string⬜A comma-separated list of font families.
lineSpacing?LineSpacing⬜Must be from predefined line spacing options
links?{ underline?: boolean }⬜true/false

MarkdownLayoutSchema

Validates Markdown layout configuration.

PropTypeRequiredValidation Rules
engine'markdown'✅Must be "markdown"
sections?SectionsSchema⬜See sections schema

DocxLayoutSchema

Validates DOCX layout configuration.

PropTypeRequiredValidation Rules
engine'docx'✅Must be "docx"
advanced?DocxAdvancedSchema⬜See advanced schema
page?DocxPageSchema⬜See page schema
sections?SectionsSchema⬜See sections schema
template?DocxTemplate⬜Must be from predefined template options
typography?DocxTypographySchema⬜See typography schema
DocxAdvancedSchema

Validates advanced DOCX configuration options.

PropTypeRequiredValidation Rules
showIcons?boolean⬜true/false
showUrls?boolean⬜true/false
DocxPageSchema

Validates page-level settings for document presentation.

PropTypeRequiredValidation Rules
margins?MarginsSchema⬜See margins schema
paperSize?DocxPaperSize⬜Must be from predefined paper size options
showPageNumbers?boolean⬜true/false
DocxTypographySchema

Validates typography settings for document formatting.

PropTypeRequiredValidation Rules
fontSize?DocxFontSize⬜Must be from predefined font size options
fontFamily?string⬜A comma-separated list of font families.
lineSpacing?LineSpacing⬜Must be from predefined line spacing options

Primitive Validation Schemas

Email Schema

Validates email addresses with strict format requirements.

Validation Rules:

  • Must be a valid email format
  • Pattern: ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$
  • Examples: hi@ppresume.com, first.last@company.org, test+tag@domain.co.uk

Phone Schema

Validates phone numbers with flexible format support.

Validation Rules:

  • Pattern: ^[+]?[(]?[0-9\\s-]{1,15}[)]?[0-9\\s-]{1,15}$
  • May include country code, parentheses, spaces, and hyphens
  • Examples: 555-123-4567, +44 20 7946 0958, (555) 123-4567

Summary Schema

Validates summary text with length constraints.

Validation Rules:

  • Must be between 16 and 1024 characters
  • Examples:
    • "Experienced software engineer with 5+ years in full-stack development."
    • "Creative designer passionate about user experience and modern design principles."
    • "Dedicated project manager with proven track record of delivering complex projects on time and budget."

URL Schema

Validates URLs with length constraints.

Validation Rules:

  • Must be a valid URL format
  • Maximum length of 256 characters
  • Examples: https://yamlresume.dev, https://ppresume.com, https://github.com/yamlresume/yamlresume

Keywords Schema

Validates keyword arrays with individual item constraints.

Validation Rules:

  • Array of strings
  • Each keyword must be between 1 and 32 characters
  • Examples: ["Javascript", "React", "Typescript"], ["Design", "UI", "UX"]

Date Schema

Validates date strings with format requirements.

Validation Rules:

  • Must be between 4 and 32 characters
  • Must be parseable by Date.parse()
  • Examples: 2025-01-01, Jul 2025, July 3, 2025, 2025-02-02T00:00:03.123Z

Margin Size Schema

Validates margin size strings with unit requirements.

Validation Rules:

  • Must be between 2 and 32 characters
  • Pattern: ^\\d+(\\.\\d+)?(cm|pt|in)$
  • Must be a positive number followed by valid units: cm, pt, or in
  • Examples: 2.5cm, 1in, 72pt, 0.5cm, 12pt

DOCX Font Family Schema

Validates font family names for DOCX output.

Validation Rules:

  • Must be a valid font family name available on the target system
  • Examples: Arial, Times New Roman, Calibri

Enum Validation Schemas

Country

A union type for all possible countries and regions in the world.

Validation Rules:

  • Must be one of the predefined country options
  • Examples: United States, China, United Kingdom, Germany

Degree

A union type for all possible degrees.

Validation Rules:

  • Must be one of: Associate, Bachelor, Diploma, Doctor, High School, Master, Middle School

Fluency

A union type for all possible language fluency levels.

Validation Rules:

  • Must be one of:
    • Elementary Proficiency
    • Full Professional Proficiency
    • Limited Working Proficiency
    • Minimum Professional Proficiency
    • Native or Bilingual Proficiency

Language

A union type for all supported languages.

Validation Rules:

  • Must be one of the predefined language options
  • Examples: English, Chinese, Spanish, French, German

Level

A union type for all possible skill proficiency levels.

Validation Rules:

  • Must be one of: Advanced, Beginner, Expert, Intermediate, Master, Novice

Network

A union type for all possible social network options.

Validation Rules:

  • Must be one of the predefined network options
  • Examples: GitHub, LinkedIn, Twitter, Facebook, Instagram

DocxFontSize

A union type for all possible DOCX font size options.

Validation Rules:

  • Must be one of: 10pt, 10.5pt, 11pt, 11.5pt, 12pt
  • 10pt is the default font size

DocxPaperSize

A union type for all possible DOCX paper size options.

Validation Rules:

  • Must be one of: a4, letter
  • a4 is the default paper size

DocxTemplate

A union type for all possible DOCX template options.

Validation Rules:

HtmlFontSize

A union type for all possible HTML font size options.

Validation Rules:

  • Must be one of: 10px, 11px, 12px, 13px, 14px, 15px, 16px, 17px, 18px, 19px, 20px, 21px, 22px, 23px, 24px
  • HTML engine supports font sizes from 10px to 24px
  • 16px is the default font size

HtmlTemplate

A union type for all possible HTML template options.

Validation Rules:

LatexTemplate

A union type for all possible LaTeX template options.

Validation Rules:

  • Must be one of: moderncv-banking, moderncv-casual, moderncv-classic
  • See also: templates

PaperSize

A union type for all possible LaTeX paper size options.

Validation Rules:

  • Must be one of: a4, letter

LatexFontSize

A union type for all possible LaTeX font size options.

Validation Rules:

  • Must be one of: 10pt, 11pt, 12pt
  • 10pt is the default font size

LatexFontspecNumbers

A union type for all possible latex fontspec numbers options.

Validation Rules:

  • Must be one of:
    • Auto - allowing the style to be automatically determined based on the selected LocaleLanguage (default)
    • Lining - standard lining figures (default for CJK languages)
    • OldStyle - old style figures with varying heights (default for Latin languages)

LineSpacing

A union type for all possible line spacing options.

Validation Rules:

  • Must be one of:
    • tight - Compact spacing for fitting more content
    • snug - Slightly more space than tight
    • normal - Balanced readability (default)
    • relaxed - More breathing room between lines
    • loose - Very spacious layout

LocaleLanguage

A union type for all possible locale languages.

Validation Rules:

  • Must be one of: en, es, zh-hans, zh-hant-hk, zh-hant-tw
  • See also: multi-languages
Edit on GitHub

Last updated on

On this page