@kubb/adapter-oas 5.0.0-alpha.36 → 5.0.0-alpha.39
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.
- package/dist/index.cjs +21 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +147 -3
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/factory.ts +10 -2
- package/src/index.ts +17 -1
package/dist/index.cjs
CHANGED
|
@@ -609,13 +609,15 @@ function parseFromConfig(source) {
|
|
|
609
609
|
* await validateDocument(document)
|
|
610
610
|
* ```
|
|
611
611
|
*/
|
|
612
|
-
async function validateDocument(document) {
|
|
612
|
+
async function validateDocument(document, { throwOnError = false } = {}) {
|
|
613
613
|
try {
|
|
614
614
|
await new oas_normalize.default(document, {
|
|
615
615
|
enablePaths: true,
|
|
616
616
|
colorizeErrors: true
|
|
617
617
|
}).validate({ parser: { validate: { errors: { colorize: true } } } });
|
|
618
|
-
} catch (
|
|
618
|
+
} catch (error) {
|
|
619
|
+
if (throwOnError) throw error;
|
|
620
|
+
}
|
|
619
621
|
}
|
|
620
622
|
//#endregion
|
|
621
623
|
//#region src/refs.ts
|
|
@@ -1773,7 +1775,24 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
|
|
|
1773
1775
|
};
|
|
1774
1776
|
});
|
|
1775
1777
|
//#endregion
|
|
1778
|
+
//#region src/types.ts
|
|
1779
|
+
/**
|
|
1780
|
+
* Uppercase → lowercase HTTP method map, re-exported for backwards compatibility.
|
|
1781
|
+
*
|
|
1782
|
+
* @example
|
|
1783
|
+
* ```ts
|
|
1784
|
+
* HttpMethods['GET'] // 'get'
|
|
1785
|
+
* HttpMethods['POST'] // 'post'
|
|
1786
|
+
* ```
|
|
1787
|
+
*/
|
|
1788
|
+
const HttpMethods = Object.fromEntries(Object.entries(_kubb_core.ast.httpMethods).map(([lower, upper]) => [upper, lower]));
|
|
1789
|
+
//#endregion
|
|
1790
|
+
exports.HttpMethods = HttpMethods;
|
|
1776
1791
|
exports.adapterOas = adapterOas;
|
|
1777
1792
|
exports.adapterOasName = adapterOasName;
|
|
1793
|
+
exports.mergeDocuments = mergeDocuments;
|
|
1794
|
+
exports.parseDocument = parseDocument;
|
|
1795
|
+
exports.parseFromConfig = parseFromConfig;
|
|
1796
|
+
exports.validateDocument = validateDocument;
|
|
1778
1797
|
|
|
1779
1798
|
//# sourceMappingURL=index.cjs.map
|