finsteps

Finsteps JSON Schemas

This directory contains JSON Schema definitions for Finsteps API contracts.

Schemas

mpd.json

Schema for the ParseResult returned by parseMPD().

Use this schema to:

api.json

Schema for the PresentationAst used by presentMermaid().

Use this schema to:

Usage

Validating in JavaScript/TypeScript

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);
}

Package.json Contract

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.