mcp-swagger-parser
Version:
Enterprise-grade OpenAPI/Swagger specification parser for Model Context Protocol (MCP) projects
58 lines • 1.53 kB
TypeScript
/**
* Schema extractor for OpenAPI specifications
*/
import type { OpenAPISpec, SchemaObject } from '../types/index';
export interface ExtractedSchema {
name: string;
schema: SchemaObject;
referencedBy: string[];
dependencies: string[];
}
export declare class SchemaExtractor {
/**
* Extract all schemas from OpenAPI specification
*/
static extractSchemas(spec: OpenAPISpec): ExtractedSchema[];
/**
* Find where a schema is referenced
*/
private static findReferences;
/**
* Find dependencies of a schema
*/
private static findDependencies;
/**
* Traverse schema object recursively
*/
private static traverseSchema;
/**
* Check if object contains a specific reference
*/
private static containsReference;
/**
* Check if object is a reference
*/
private static isReferenceObject;
/**
* Get schema statistics
*/
static getSchemaStats(schemas: ExtractedSchema[]): {
total: number;
withDependencies: number;
orphaned: number;
mostReferenced: {
name: string;
count: number;
};
byType: Record<string, number>;
};
/**
* Build dependency graph
*/
static buildDependencyGraph(schemas: ExtractedSchema[]): Record<string, string[]>;
/**
* Find circular dependencies
*/
static findCircularDependencies(schemas: ExtractedSchema[]): string[][];
}
//# sourceMappingURL=schema-extractor.d.ts.map