mcp-swagger-parser
Version:
Enterprise-grade OpenAPI/Swagger specification parser for Model Context Protocol (MCP) projects
64 lines • 2.4 kB
TypeScript
/**
* Custom error classes for OpenAPI parsing
*/
export declare class OpenAPIParseError extends Error {
readonly code: string;
readonly path?: string;
readonly cause?: Error;
constructor(message: string, code: string, path?: string, cause?: Error);
}
export declare class OpenAPIValidationError extends Error {
readonly errors: ValidationErrorDetail[];
readonly warnings: ValidationWarningDetail[];
constructor(message: string, errors: ValidationErrorDetail[], warnings?: ValidationWarningDetail[]);
}
export declare class OpenAPINetworkError extends Error {
readonly url: string;
readonly statusCode?: number;
readonly cause?: Error;
constructor(message: string, url: string, statusCode?: number, cause?: Error);
}
export declare class OpenAPIFileError extends Error {
readonly filePath: string;
readonly cause?: Error;
constructor(message: string, filePath: string, cause?: Error);
}
export declare class Swagger2OpenAPIConversionError extends OpenAPIParseError {
readonly originalError?: Error;
readonly conversionOptions?: any;
constructor(message: string, originalError?: Error, conversionOptions?: any);
}
export declare class UnsupportedVersionError extends OpenAPIParseError {
readonly detectedVersion: string;
constructor(detectedVersion: string);
}
export declare class VersionDetectionError extends OpenAPIParseError {
constructor(message: string, cause?: Error);
}
export interface ValidationErrorDetail {
path: string;
message: string;
code: string;
severity: 'error';
}
export interface ValidationWarningDetail {
path: string;
message: string;
code: string;
severity: 'warning';
}
export declare const ERROR_CODES: {
readonly PARSE_ERROR: "PARSE_ERROR";
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
readonly NETWORK_ERROR: "NETWORK_ERROR";
readonly FILE_NOT_FOUND: "FILE_NOT_FOUND";
readonly INVALID_FORMAT: "INVALID_FORMAT";
readonly REFERENCE_ERROR: "REFERENCE_ERROR";
readonly SCHEMA_ERROR: "SCHEMA_ERROR";
readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
readonly CONVERSION_ERROR: "CONVERSION_ERROR";
readonly UNSUPPORTED_VERSION: "UNSUPPORTED_VERSION";
readonly VERSION_DETECTION_FAILED: "VERSION_DETECTION_FAILED";
};
export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
//# sourceMappingURL=index.d.ts.map