Skip to main content

validate

validate a profile file against its schema.


usage​

npx declared-md validate [file]

if no file is given, the command looks for whoami.md, whois.md, or whatis.md in the current directory (in that order).


examples​

validate a file in the current directory:

npx declared-md validate

validate a specific file:

npx declared-md validate ./whoami.md
npx declared-md validate ./path/to/whois.md

output​

valid file​

valid whoami.md

invalid file​

invalid whoami.md

x handle: must be 2-39 characters, lowercase letters, numbers, and hyphens only
x links.site: must be a valid HTTPS URL (must start with https://)
x status: must be one of: open-to-work, working, building, learning, unavailable

3 errors found.

each error shows the field path and the rule that failed.


exit codes​

codemeaning
0file is valid
1file is invalid (schema errors)
2CLI error (file not found, parse error, etc.)

use exit codes in scripts:

npx declared-md validate ./whoami.md && echo "ready to publish"

what is validated​

the validator checks:

  • the file is valid UTF-8
  • the frontmatter parses as valid YAML
  • all required fields are present: declared, kind, name, handle
  • the declared value matches a known spec version
  • the kind value matches the filename
  • the handle matches ^[a-z0-9-]{2,39}$
  • the total file size is at most 50 KB
  • all URLs in links use https:// (or mailto: for the email key)
  • per-standard rules (e.g. status enum values, links.repo required for whatis)

see the spec for the full list of rules per standard.