@kubb/adapter-oas 5.23.2 → 5.23.3
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 +5 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -34
- package/dist/index.js.map +1 -1
- package/dist/{validateSpec-Ospj1aaB.js → validateSpec-BTbUBxQB.js} +1 -1
- package/dist/{validateSpec-Ospj1aaB.js.map → validateSpec-BTbUBxQB.js.map} +1 -1
- package/dist/{validateSpec-DCiUXkMn.cjs → validateSpec-Bxf2WZ1Y.cjs} +1 -1
- package/dist/{validateSpec-DCiUXkMn.cjs.map → validateSpec-Bxf2WZ1Y.cjs.map} +1 -1
- package/dist/validateSpec-DL7ObLHI.js +1 -0
- package/dist/validateWorker.js +1 -1
- package/package.json +4 -4
- package/dist/validateSpec-9zbtcjcA.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var compatibility = {
|
|
|
16
16
|
"node": ">=22.22"
|
|
17
17
|
};
|
|
18
18
|
// package.json
|
|
19
|
-
var version = "5.23.
|
|
19
|
+
var version = "5.23.3";
|
|
20
20
|
// src/constants.ts
|
|
21
21
|
/**
|
|
22
22
|
* Default parser options applied when no explicit options are provided.
|
|
@@ -265,37 +265,6 @@ function createStore({ weak, max } = {}) {
|
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
267
|
memo.create = createStore;
|
|
268
|
-
// ../../internals/utils/src/casing.ts
|
|
269
|
-
/**
|
|
270
|
-
* Shared implementation for camelCase and PascalCase conversion.
|
|
271
|
-
* Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
|
|
272
|
-
* and capitalizes each word according to `pascal`.
|
|
273
|
-
*
|
|
274
|
-
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
275
|
-
*/
|
|
276
|
-
function convert(text, pascal) {
|
|
277
|
-
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)(?!xx(?![a-z]))([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
278
|
-
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
279
|
-
return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
|
|
280
|
-
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
281
|
-
}
|
|
282
|
-
const cache = memo.create({ max: 1e5 });
|
|
283
|
-
function toCamelOrPascal(text, pascal) {
|
|
284
|
-
const key = `${pascal ? "P" : "c"}${text}`;
|
|
285
|
-
return memo(cache, key, () => convert(text, pascal));
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Converts `text` to PascalCase.
|
|
289
|
-
*
|
|
290
|
-
* @example Word boundaries
|
|
291
|
-
* `pascalCase('hello-world') // 'HelloWorld'`
|
|
292
|
-
*
|
|
293
|
-
* @example With a suffix
|
|
294
|
-
* `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`
|
|
295
|
-
*/
|
|
296
|
-
function pascalCase(text, { prefix = "", suffix = "" } = {}) {
|
|
297
|
-
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
|
|
298
|
-
}
|
|
299
268
|
// ../../internals/utils/src/errors.ts
|
|
300
269
|
/**
|
|
301
270
|
* Coerces an unknown thrown value to an `Error` instance.
|
|
@@ -1308,7 +1277,7 @@ async function validateDocument(document, { throwOnError = false } = {}) {
|
|
|
1308
1277
|
return;
|
|
1309
1278
|
}
|
|
1310
1279
|
if (!throwOnError) {
|
|
1311
|
-
const { validateSpec } = await Promise.resolve().then(() => require("./validateSpec-
|
|
1280
|
+
const { validateSpec } = await Promise.resolve().then(() => require("./validateSpec-Bxf2WZ1Y.cjs"));
|
|
1312
1281
|
return reportResult(await validateSpec(structuredClone(document)));
|
|
1313
1282
|
}
|
|
1314
1283
|
const { compileErrors, validate } = await import("@readme/openapi-parser");
|
|
@@ -1549,7 +1518,7 @@ function getSchemas(document, { contentType }, refs) {
|
|
|
1549
1518
|
}];
|
|
1550
1519
|
}))];
|
|
1551
1520
|
const normalizedNames = memo.create();
|
|
1552
|
-
for (const item of candidates) memo(normalizedNames, pascalCase(item.originalName), () => []).push(item);
|
|
1521
|
+
for (const item of candidates) memo(normalizedNames, (0, _kubb_core.pascalCase)(item.originalName), () => []).push(item);
|
|
1553
1522
|
const schemas = {};
|
|
1554
1523
|
const renames = /* @__PURE__ */ new Map();
|
|
1555
1524
|
const pointers = /* @__PURE__ */ new Map();
|
|
@@ -2286,7 +2255,7 @@ function collectPropertyKeysByFlag(schema, flag) {
|
|
|
2286
2255
|
}
|
|
2287
2256
|
/** Converts one parameter into a `ParameterNode`, naming an inline schema after the operation and the parameter. */
|
|
2288
2257
|
function parseParameter({ param, pointer, parentName, options, parseSchema, refs }) {
|
|
2289
|
-
const schemaName = parentName && param.name ? pascalCase(`${parentName} ${param.name}`) : void 0;
|
|
2258
|
+
const schemaName = parentName && param.name ? (0, _kubb_core.pascalCase)(`${parentName} ${param.name}`) : void 0;
|
|
2290
2259
|
const contentType = param.schema ? void 0 : Object.keys(param.content ?? {})[0];
|
|
2291
2260
|
const mediaType = getMediaType({
|
|
2292
2261
|
content: param.content,
|
|
@@ -2341,7 +2310,7 @@ function spreadQuerystring(param) {
|
|
|
2341
2310
|
function parseOperation({ operation, ...ctx }) {
|
|
2342
2311
|
const { document, refs, contentType, options, parseSchema } = ctx;
|
|
2343
2312
|
const operationId = getOperationId(operation);
|
|
2344
|
-
const operationName = operationId ? pascalCase(operationId) : void 0;
|
|
2313
|
+
const operationName = operationId ? (0, _kubb_core.pascalCase)(operationId) : void 0;
|
|
2345
2314
|
const pointer = getOperationPointer(operation);
|
|
2346
2315
|
const parameters = getParameters({
|
|
2347
2316
|
operation,
|