Skip to main content

Module schema

Module schema 

Source
Expand description

Canonical schema types (single source of truth for semantic enums) Canonical schema types for sqry.

This module provides the single source of truth for all semantic types used across sqry interfaces (CLI, LSP, MCP). Interface-specific wire types should derive from or reference these canonical definitions.

§Design Goals

  1. Centralized definitions - All semantic enums defined once
  2. Cross-interface consistency - LSP and MCP use same underlying types
  3. Documentation - Each type is fully documented for API consumers
  4. Serialization - All types support JSON and postcard serialization

§Type Categories

§Graph Types (re-exported from graph::unified)

  • NodeKind - Categories of code symbols (function, class, method, etc.)
  • EdgeKind - Relationship types between symbols (calls, imports, etc.)

§Query Types

  • RelationKind - Relation query types (callers, callees, imports, exports, returns)
  • Visibility - Node visibility filter (public, private)

§Output Types

  • OutputFormat - Graph/result output formats (json, dot, d2, mermaid)

§Analysis Types

  • ChangeKind - Semantic diff change types (added, removed, modified, etc.)
  • CycleKind - Cycle detection types (calls, imports, modules)
  • DuplicateKind - Duplicate detection types (body, signature, struct)
  • UnusedScope - Unused symbol scope (public, private, function, etc.)

§Usage

Interface packages should import these types and optionally create thin wrappers for JSON Schema generation (MCP) or protocol-specific serialization (LSP):

use sqry_core::schema::{RelationKind, Visibility, OutputFormat};

// MCP can derive schemars::JsonSchema on a wrapper if needed
#[derive(schemars::JsonSchema)]
#[serde(transparent)]
pub struct RelationTypeParam(RelationKind);

Re-exports§

pub use crate::graph::unified::edge::EdgeKind;
pub use crate::graph::unified::node::NodeKind;

Enums§

ChangeKind
Types of changes detected by semantic diff.
CycleKind
Types of cycles to detect in code graphs.
DuplicateKind
Types of duplicates to detect in code.
OutputFormat
Output formats for graph exports and visualizations.
RelationKind
Types of symbol relationships for relation queries.
UnusedScope
Scopes for unused symbol detection.
Visibility
Node visibility levels for filtering.