/** * API Contract Analyzer for Cross-Language Validation * Detects mismatches between frontend and backend APIs */ import { TypeSchema, ErrorSchema } from '../../types/crossLanguage.js'; import { Violation } from '../../types.js'; export interface APIEndpoint { id: string; method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; path: string; language: string; file: string; line: number; requestSchema?: TypeSchema; responseSchema?: TypeSchema; errorSchemas?: ErrorSchema[]; authentication?: string; deprecated?: boolean; } export interface APICall { id: string; method: string; url: string; language: string; file: string; line: number; expectedResponseType?: string; errorHandling?: string[]; timeout?: number; } export interface ContractViolation extends Violation { contractType: 'api-type-mismatch' | 'missing-endpoint' | 'api-extra-field' | 'api-missing-field' | 'method-mismatch' | 'auth-mismatch'; endpoint?: APIEndpoint; call?: APICall; expectedType?: string; actualType?: string; missingFields?: string[]; extraFields?: string[]; } export declare class APIContractAnalyzer { private endpoints; private calls; /** * Analyze API contracts and find violations */ analyzeContracts(endpoints: APIEndpoint[], calls: APICall[]): Promise; /** * Extract API endpoints from code entities */ static extractEndpoints(entities: any[]): APIEndpoint[]; /** * Extract API calls from code entities */ static extractAPICalls(entities: any[]): APICall[]; /** * Find API calls that don't have matching endpoints */ private findUnmatchedCalls; /** * Validate matched endpoint-call pairs for compatibility */ private validateMatchedPairs; /** * Check for usage of deprecated APIs */ private checkDeprecatedUsage; /** * Validate authentication requirements */ private validateAuthentication; /** * Find matching endpoint for an API call */ private findMatchingEndpoint; /** * Check if two API paths match (handling path parameters) */ private pathsMatch; /** * Validate type compatibility between endpoint and call */ private validateTypeCompatibility; /** * Check if an API call includes authentication */ private callHasAuthentication; private static extractGoEndpoint; private static extractTypeScriptEndpoint; private static extractPythonEndpoint; private static extractTypeScriptAPICall; private static extractGoAPICall; private static extractMethodFromGo; private static extractPathFromGo; private static extractMethodFromTypeScript; private static extractPathFromTypeScript; private static extractMethodFromPython; private static extractPathFromPython; private static extractCallMethodFromTypeScript; private static extractUrlFromTypeScript; private static extractCallMethodFromGo; private static extractUrlFromGo; } //# sourceMappingURL=APIContractAnalyzer.d.ts.map