This directory contains JSON Schema definitions for Finsteps API contracts.
mpd.jsonSchema for the ParseResult returned by parseMPD().
https://cablepull.github.io/finsteps/schema/mpd.jsonParseResult from src/ast.tsUse this schema to:
api.jsonSchema for the PresentationAst used by presentMermaid().
https://cablepull.github.io/finsteps/schema/api.jsonPresentationAst from src/types.tspresentMermaid()Use this schema to:
presentMermaid()import Ajv from 'ajv';
import mpdSchema from 'https://cablepull.github.io/finsteps/schema/mpd.json';
import apiSchema from 'https://cablepull.github.io/finsteps/schema/api.json';
const ajv = new Ajv();
const validateMpd = ajv.compile(mpdSchema);
const validateApi = ajv.compile(apiSchema);
// Validate MPD parse result
const parseResult = parseMPD(mpdText);
if (!validateMpd(parseResult)) {
console.error('Invalid MPD:', validateMpd.errors);
}
// Validate presentation AST
if (!validateApi(presentationAst)) {
console.error('Invalid AST:', validateApi.errors);
}
The schemas are also referenced in package.json under finsteps.schema:
{
"finsteps": {
"schema": {
"mpd": "https://cablepull.github.io/finsteps/schema/mpd.json",
"api": "https://cablepull.github.io/finsteps/schema/api.json"
}
}
}
This allows tools and IDEs to discover and use the schemas automatically.