Schema Validation

NovaType uses JSON Schema to validate the metadata of your documents, ensuring consistency and compliance.

YAML Frontmatter

Metadata is defined in YAML at the beginning of the document, between ---:

---
title: "My Scientific Article"
authors:
  - name: "John Smith"
    affiliation: "University of Paris"
    email: "john.smith@univ-paris.fr"
abstract: |
  This article presents a new approach to...
keywords:
  - machine learning
  - data science
date: 2024-01-15
template: ieee-article
bibliography: "references.bib"
citation_style: "ieee"
---

// Document content...
= Introduction

...

Validation Command

# Validate a document
$ nova validate main.typ
 Document valid

# Strict validation (frontmatter required)
$ nova validate main.typ --strict

# Validate multiple files
$ nova validate *.typ

# Use a custom schema
$ nova validate main.typ --schema custom-schema.json

Default Schema

The default schema for articles:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "required": ["title"],
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1,
      "description": "Document title"
    },
    "authors": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": { "type": "string" },
          "affiliation": { "type": "string" },
          "email": { "type": "string", "format": "email" }
        }
      }
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "abstract": { "type": "string" },
    "keywords": {
      "type": "array",
      "items": { "type": "string" }
    },
    "template": { "type": "string" },
    "bibliography": { "type": "string" },
    "citation_style": {
      "type": "string",
      "enum": ["apa", "ieee", "chicago", "harvard", "nature", "vancouver"]
    },
    "language": { "type": "string" }
  }
}

Available Fields

Field Type Required Description
titlestringYesDocument title
authorsarrayNoList of authors
datedateNoPublication date
abstractstringNoDocument abstract
keywordsarrayNoKeywords
templatestringNoTemplate to use
bibliographystringNoPath to .bib file
citation_stylestringNoCitation style
languagestringNoDocument language

Custom Schema

Create your own schema for specific needs:

// schemas/report.json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "required": ["title", "author", "organization", "version"],
  "properties": {
    "title": { "type": "string" },
    "author": { "type": "string" },
    "organization": { "type": "string" },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+(\\.\\d+)?$"
    },
    "status": {
      "type": "string",
      "enum": ["draft", "review", "final"]
    },
    "confidentiality": {
      "type": "string",
      "enum": ["public", "internal", "confidential"]
    }
  }
}

Validation Errors

$ nova validate main.typ
✗ Validation failed:
  - Missing required field: title
  - Invalid email format in authors[0].email
  - Unknown citation_style: "mla" (expected: apa, ieee, chicago...)

CI/CD Integration

# .github/workflows/validate.yml
name: Validate Documents

on: [push, pull_request]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install NovaType
        run: cargo install nova-cli

      - name: Validate documents
        run: nova validate **/*.typ --strict
Best Practice

Integrate validation into your CI/CD pipeline to ensure that all documents comply with the schema before publication.