@vibe-validate/extractors 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI Error Extractor
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats OpenAPI specification validation errors for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
import type { ErrorExtractorResult } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Format OpenAPI validation errors
|
|
11
|
+
*
|
|
12
|
+
* Extracts error lines from OpenAPI validator output (like Redocly CLI).
|
|
13
|
+
*
|
|
14
|
+
* @param output - Raw OpenAPI validator output
|
|
15
|
+
* @returns Structured error information with OpenAPI-specific guidance
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const result = extractOpenAPIErrors(validatorOutput);
|
|
20
|
+
* console.log(result.summary); // "5 OpenAPI validation error(s)"
|
|
21
|
+
* console.log(result.guidance); // "Check openapi.yaml against OpenAPI 3.1 specification"
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractOpenAPIErrors(output: string): ErrorExtractorResult;
|
|
25
|
+
//# sourceMappingURL=openapi-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-extractor.d.ts","sourceRoot":"","sources":["../src/openapi-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAezE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI Error Extractor
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats OpenAPI specification validation errors for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Format OpenAPI validation errors
|
|
10
|
+
*
|
|
11
|
+
* Extracts error lines from OpenAPI validator output (like Redocly CLI).
|
|
12
|
+
*
|
|
13
|
+
* @param output - Raw OpenAPI validator output
|
|
14
|
+
* @returns Structured error information with OpenAPI-specific guidance
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const result = extractOpenAPIErrors(validatorOutput);
|
|
19
|
+
* console.log(result.summary); // "5 OpenAPI validation error(s)"
|
|
20
|
+
* console.log(result.guidance); // "Check openapi.yaml against OpenAPI 3.1 specification"
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function extractOpenAPIErrors(output) {
|
|
24
|
+
// OpenAPI errors typically include location in schema
|
|
25
|
+
const lines = output.split('\n')
|
|
26
|
+
.filter(line => line.includes('error') || line.includes('Error'))
|
|
27
|
+
.slice(0, 10);
|
|
28
|
+
const cleanOutput = lines.join('\n');
|
|
29
|
+
return {
|
|
30
|
+
errors: [],
|
|
31
|
+
summary: `${lines.length} OpenAPI validation error(s)`,
|
|
32
|
+
totalCount: lines.length,
|
|
33
|
+
guidance: 'Check openapi.yaml against OpenAPI 3.1 specification',
|
|
34
|
+
cleanOutput
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=openapi-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-extractor.js","sourceRoot":"","sources":["../src/openapi-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,sDAAsD;IACtD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;SAC7B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAChE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEhB,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO;QACL,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,8BAA8B;QACtD,UAAU,EAAE,KAAK,CAAC,MAAM;QACxB,QAAQ,EAAE,sDAAsD;QAChE,WAAW;KACZ,CAAC;AACJ,CAAC"}
|