@tryloop/oats
Version:
🌾 OATS - OpenAPI TypeScript Sync. The missing link between your OpenAPI specs and TypeScript applications. Automatically watch, generate, and sync TypeScript clients from your API definitions.
83 lines • 1.98 kB
TypeScript
/**
* OATS Swagger/OpenAPI Change Detection
*
* Intelligent detection of meaningful changes in API specifications
*
* @module @oatsjs/core/swagger-diff
*/
export interface ApiChange {
type: 'added' | 'removed' | 'modified';
path: string;
description: string;
severity: 'major' | 'minor' | 'patch';
}
export interface ChangeDetectionResult {
hasChanges: boolean;
changes: ApiChange[];
summary: {
major: number;
minor: number;
patch: number;
};
}
/**
* Detects meaningful changes in OpenAPI/Swagger specifications
*/
export declare class SwaggerChangeDetector {
private lastState;
private lastSpec;
private currentState;
/**
* Check if API specification has significant changes
*/
hasSignificantChanges(currentSpec: any): boolean;
/**
* Get the current spec hash
*/
getCurrentHash(): string | null;
/**
* Get detailed change analysis
*/
analyzeChanges(previousSpec: any, currentSpec: any): ChangeDetectionResult;
/**
* Calculate hash of API specification
*/
private calculateSpecHash;
/**
* Extract parts of spec that matter for API contract
*/
private extractRelevantParts;
/**
* Normalize paths for comparison
*/
private normalizePaths;
/**
* Detect specific changes between specs
*/
private detectChanges;
/**
* Compare two objects and detect changes
*/
private compareObjects;
/**
* Classify path changes
*/
private classifyPathChange;
/**
* Classify schema changes
*/
private classifySchemaChange;
/**
* Determine if changes are significant enough to trigger regeneration
*/
private areChangesSignificant;
/**
* Reset the detector state
*/
reset(): void;
/**
* Get current state hash
*/
getCurrentState(): string | null;
}
//# sourceMappingURL=swagger-diff.d.ts.map