MCPcopy Index your code
hub / github.com/ReAPI-com/mcp-openapi / saveSpec

Method saveSpec

src/core/SpecService.ts:246–263  ·  view source on GitHub ↗
(spec: OpenAPIV3.Document, specId: string)

Source from the content-addressed store, hash-verified

244 }
245
246 async saveSpec(spec: OpenAPIV3.Document, specId: string): Promise<void> {
247 this.logger.debug({ specId }, "Persisting specification");
248 try {
249 await this.ensureDirectory(this.dereferencedPath);
250 const specPath = path.join(this.dereferencedPath, `${specId}.json`);
251 await fs.writeFile(specPath, JSON.stringify(spec, null, 2));
252 this.specs[specId] = spec;
253 this.specCache.set(specId, spec);
254 this.logger.info({ specId }, "Successfully persisted specification");
255 } catch (error) {
256 this.logger.error({ specId, error }, "Failed to persist specification");
257 throw new SpecServiceError(
258 `Failed to persist specification ${specId}`,
259 "PERSIST_ERROR",
260 error instanceof Error ? error : new Error(String(error))
261 );
262 }
263 }
264
265 async saveSpecCatalog(catalog: SpecCatalogEntry[]): Promise<void> {
266 if (!this.catalogPath) {

Callers 1

scanAndSaveMethod · 0.95

Calls 5

ensureDirectoryMethod · 0.95
setMethod · 0.80
debugMethod · 0.65
infoMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected