Schemas
How entries are validated and what qino adds or reserves.
Every primitive takes a schema. qino accepts any Standard Schema validator and treats it as a black box: it calls the standard validate function and never touches validator-specific APIs. Zod, Valibot, and ArkType all work.
The schema must be synchronous. A validator that returns a Promise is rejected.
With cloud set, the schema must also implement Standard JSON Schema, so it can be converted to JSON Schema. Not every Standard Schema validator does.
What the schema receives
For Markdown, MDX, and .markdown files, the input is the parsed frontmatter only:
{
title: "Hello",
draft: false,
}
For .json files, the input is the parsed object as-is.
A file without frontmatter validates {}, so an empty schema like z.object({}) is enough. Schemas are required even then.
To reshape data, such as splitting a string or renaming keys, use your validator's transform. See Transforming data.
markdown
After validation, qino adds the body to every Markdown entry as markdown, a string without the frontmatter, like it adds _meta. An empty body is an empty string.
{
title: "Hello",
draft: false,
markdown: "The body, without frontmatter.",
_meta: { slug: "hello-world", fileName: "hello-world.md", filePath: "/abs/path/posts/hello-world.md" },
}
Don't declare it in the schema: the schema never sees it, so strict objects work as-is. It is added before views run, so augment, filter, and sort can read it. To derive something from the body, use augment. For word and character counts, set markdown: { stats: true } and qino adds a _stats field too. See MarkdownStats. For a table of contents, set markdown.toc and qino adds a _toc field. See MarkdownToc. For a page's Markdown to copy or serve, with a title heading and absolute links, use getPageMarkdown.
In Markdown files, markdown, _stats, and _toc are reserved at the top level of frontmatter, schema input, and schema output. Declaring them in a schema is a type error, and frontmatter or a transform that introduces them fails at runtime. Augment callbacks cannot add or replace markdown, nor _stats when markdown.stats is on, nor _toc when markdown.toc is on. In JSON files, they are ordinary fields.
Reserved: _meta
_meta is reserved at the top level of content, schema input, and schema output, for every format. Declaring it in a schema is a type error. A transform that introduces it fails at runtime. Nested keys named _meta are ordinary fields.
After validation, qino adds _meta:
Dates
YAML never produces Date objects on its own. Validate date strings with z.iso.date() or coerce with z.coerce.date(). See Frontmatter.
Validation errors
A failing entry throws with the file path and every issue:
Validation failed for /abs/path/posts/hello.md:
title: Invalid input: expected string, received undefined
qino check runs the same validation for every file. See CLI.