Skip to content

Note Properties / Frontmatter Validation #288

@ElioNeto

Description

@ElioNeto

Note Properties / Frontmatter Validation

Add support for YAML frontmatter parsing, validation, and indexing for note metadata (properties).

YAML Frontmatter Support

Parse standard Obsidian-compatible frontmatter:

---
title: My Note
aliases: [MN, My-Note]
tags: [reference, documentation]
created: 2026-05-25T10:00:00
updated: 2026-05-25T11:30:00
category: technical
status: draft
custom_field: value
---

Schema Validation

Use the existing SchemaValidator from src/infra/schema_validation.rs with a JSON Schema for frontmatter validation:

{
  "type": "object",
  "properties": {
    "title": { "type": "string", "maxLength": 200 },
    "aliases": { "type": "array", "items": { "type": "string" } },
    "tags": { "type": "array", "items": { "type": "string" } },
    "created": { "type": "string", "format": "date-time" },
    "updated": { "type": "string", "format": "date-time" },
    "category": { "type": "string", "enum": ["technical", "personal", "project", "reference"] }
  }
}

Frontmatter Index

Store frontmatter fields in indexed column families for searchability:

cf "fm":
  fm:title:{title}         -> [note_path1, note_path2]
  fm:category:{category}   -> [note_path1, note_path2]
  fm:status:{status}       -> [note_path1, note_path2]
  fm:created:{timestamp}:{path} -> "" (sorted by creation date)
  fm:updated:{timestamp}:{path} -> "" (sorted by update date)

Queries Enabled by Frontmatter Index

  • GET /notes?category=technical — Filter by category
  • GET /notes?status=draft — Filter by status
  • GET /notes?sort=created&order=desc — Sort by creation date
  • GET /notes?sort=updated&order=desc — Sort by last update
  • GET /notes?since=2026-01-01 — Notes created after date

API Extensions

// PUT /notes/{path} — updated body
{
  "content": "# Note content...",
  "frontmatter": {
    "title": "My Note",
    "tags": ["reference"],
    "category": "technical",
    "status": "draft"
  }
}

// GET /notes/{path} — now includes parsed frontmatter
{
  "path": "my-note",
  "content": "# Note content...",
  "frontmatter": { ... },
  "properties": {
    "title": "My Note",
    "tags": ["reference"],
    "category": "technical",
    "status": "draft",
    "created": "2026-05-25T10:00:00Z",
    "updated": "2026-05-25T11:30:00Z"
  }
}

Acceptance Criteria

  • YAML frontmatter is parsed from note content
  • Validation errors return useful messages
  • Custom properties beyond the schema are preserved
  • Frontmatter index enables filtering and sorting
  • Property updates work correctly
  • Unit tests for YAML parsing
  • Integration tests for property-based queries

Parent Epic

#275

Metadata

Metadata

Assignees

No one assigned

    Labels

    featnotesNote storage and indexingobsidianObsidian-like note-taking features

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions