Create your docmeta.config.yaml
A docmeta.config.yaml stores what “valid” means for your repo: which files to check, which to skip, and which schema set they must satisfy. With it committed at your repo root, both you and CI can run a bare docmeta validate and get a consistent, repeatable result.
Every key is optional. This page covers where docmeta looks for the file, then each key in turn, a complete worked example, and how command-line flags combine with what you configure.
Where docmeta looks for the config
Section titled “Where docmeta looks for the config”docmeta finds your config in one of two ways:
- Discovery. With no
--configflag, docmeta looks in the current working directory fordocmeta.config.yaml, thendocmeta.config.yml. The first one it finds wins. - Explicit path. Pass
-c <path>(or--config <path>) to point at a specific file. If that file does not exist, docmeta exits with an error rather than falling back to discovery.
The keys
Section titled “The keys”A list of files, directories, or globs to validate. This is the fallback docmeta uses when you do not pass any positional paths on the command line.
paths: - "docs/**/*.md" - "articles/**/*.md"With this in place, a bare docmeta validate checks everything under docs/ and articles/. Pass paths explicitly and they take priority — docmeta validate README.md validates only README.md, ignoring paths.
exclude
Section titled “exclude”A list of globs to skip. Your excludes are merged with docmeta’s built-in defaults and any --exclude flags passed on the command line — they add to the exclusion set rather than replacing it.
exclude: - "**/drafts/**"docmeta always ignores **/node_modules/** and **/.git/**, so you never need to list those. The example above additionally skips any drafts folder.
schemas
Section titled “schemas”The default schema set applied to every matched file. Each file must satisfy all schemas in the list — they are validated against the set, not against the first match.
schemas: - google:okf:0.1A schema reference can be one of three kinds:
- A built-in id in
vendor:name:versionform, such asgoogle:okf:0.1. - A local file path to a
.jsonschema, such as./schemas/article.json. - An
http(s)URL to a remotely hosted schema.
If you omit schemas entirely, docmeta falls back to the built-in google:okf:0.1 schema, which requires a type field.
overrides
Section titled “overrides”A list of per-glob rules that assign a different schema set to a subset of files. Each entry has a files glob and a schemas list. The first override whose glob matches a file wins, and its schema set replaces the default schemas for that file.
overrides: - files: "api/**/*.md" schemas: - google:okf:0.1 - ./schemas/api-reference.jsonOverrides are how you require stricter metadata for one area of the repo without affecting the rest. They are not the last word, though: a file’s own $schema field and the CLI --schema flag both take precedence over them. The dedicated overrides guide walks through the full resolution order.
A complete example
Section titled “A complete example”This config validates Markdown under docs/ and articles/, skips drafts, applies the OKF schema everywhere by default, and layers an extra schema onto articles/.
# Default targets when no paths are passed on the command line.paths: - "docs/**/*.md" - "articles/**/*.md"
# Paths to skip (node_modules and .git are always excluded).exclude: - "**/drafts/**"
# The schema set every matched file must satisfy by default.schemas: - google:okf:0.1
# Per-glob overrides (first match wins).overrides: - files: "articles/**/*.md" schemas: - google:okf:0.1 - ./schemas/article.jsonRun it from your repo root:
npx docmeta validateHow CLI flags combine with the config
Section titled “How CLI flags combine with the config”Some command-line flags layer onto the config; others replace it. Keep the distinction in mind when you run docmeta locally with extra flags:
| Flag | Effect relative to config |
|---|---|
positional [paths...] |
Replaces paths for this run. |
--exclude <glob> |
Merges with config exclude and the built-in defaults. |
-s, --schema <ref> |
Overrides all schema resolution — config schemas, overrides, and file $schema are ignored. |