Where Are Archify's JSON Schema Definitions Located?
All Archify JSON Schema definitions are stored in the archify/schemas/ directory, with dedicated schema files for each diagram type and a shared common.schema.json for reusable definitions.
The Archify open-source diagramming tool uses strict JSON Schema validation to ensure diagram payloads conform to expected structures. According to the tt-a1i/archify source code, these schema definitions are organized in a dedicated directory structure that separates concerns by diagram type while promoting reusability through shared components.
Archify JSON Schema Directory Structure
The archify/schemas/ folder contains six schema files that collectively define the complete data model:
workflow.schema.json— Validates workflow diagrams with lanes, nodes, and edgessequence.schema.json— Validates sequence diagrams with participants, messages, and activationsdataflow.schema.json— Validates data-flow diagrams with stages, nodes, and flowsarchitecture.schema.json— Validates architecture diagrams with components, links, and groupslifecycle.schema.json— Validates lifecycle diagrams with states, transitions, and actionscommon.schema.json— Provides shared definitions for identifiers, component types, legends, and visual settings
Each schema file can be accessed directly at https://github.com/tt-a1i/archify/blob/main/archify/schemas/<filename>.
Validating Diagrams Against Archify JSON Schemas
Node.js Validation with AJV
Use the AJV validator to check workflow diagrams against workflow.schema.json:
import Ajv from "ajv";
import workflowSchema from "./archify/schemas/workflow.schema.json" assert { type: "json" };
import diagram from "./my-workflow.json" assert { type: "json" };
const ajv = new Ajv({ allErrors: true });
const validate = ajv.compile(workflowSchema);
const valid = validate(diagram);
if (!valid) {
console.error("Diagram validation errors:", validate.errors);
} else {
console.log("Diagram is valid!");
}
The allErrors: true option ensures you receive complete validation feedback rather than failing on the first error.
Python Validation with jsonschema
Validate sequence diagrams using Python's jsonschema library:
import json
import jsonschema
with open("archify/schemas/sequence.schema.json") as f:
schema = json.load(f)
with open("my-sequence.json") as f:
diagram = json.load(f)
try:
jsonschema.validate(instance=diagram, schema=schema)
print("Sequence diagram is valid")
except jsonschema.exceptions.ValidationError as e:
print("Validation error:", e)
Referencing the Common Schema
The $ref mechanism in JSON Schema allows diagram schemas to reuse definitions from common.schema.json. Pre-load it with AJV:
import Ajv from "ajv";
import commonSchema from "./archify/schemas/common.schema.json" assert { type: "json" };
const ajv = new Ajv();
ajv.addSchema(commonSchema, "common");
// Schemas referencing `common.schema.json` will now resolve correctly
This approach ensures consistent validation of shared fields like id, componentType, brandMark, and legend configurations across all diagram types.
Summary
- Archify JSON Schema definitions reside exclusively in
archify/schemas/ - Five diagram-specific schemas (workflow, sequence, dataflow, architecture, lifecycle) enforce structure per diagram type
common.schema.jsoncentralizes reusable definitions to prevent duplication- Direct GitHub URLs enable schema retrieval without cloning the repository
- AJV and jsonschema both support validation against these schemas in JavaScript and Python environments
Frequently Asked Questions
What diagram types does Archify support?
Archify supports five diagram types: workflow, sequence, data-flow, architecture, and lifecycle diagrams. Each has a dedicated JSON Schema file in archify/schemas/ that defines its specific structure and validation rules.
How do I validate a custom diagram against Archify schemas?
Load the appropriate schema file from archify/schemas/ into your validator of choice. For Node.js, use AJV with ajv.compile(). For Python, use jsonschema.validate(). Ensure you also load common.schema.json if your validator doesn't automatically resolve external $ref pointers.
Can I extend Archify's JSON Schemas for custom use cases?
Yes. The schemas use standard JSON Schema Draft syntax, so you can create extension schemas that $ref the base Archify definitions. Import common.schema.json first to reuse Archify's core types, then add custom properties specific to your implementation.
Where can I find the raw schema files without cloning the repository?
Access any schema directly via GitHub raw URLs: https://raw.githubusercontent.com/tt-a1i/archify/main/archify/schemas/<schema-name>.schema.json. Replace <schema-name> with workflow, sequence, dataflow, architecture, lifecycle, or common.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →