@kubb/adapter-oas 5.9.5 → 5.9.6
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 +31 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -12,7 +12,7 @@ var compatibility = {
|
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region package.json
|
|
15
|
-
var version = "5.9.
|
|
15
|
+
var version = "5.9.6";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/constants.ts
|
|
18
18
|
/**
|
|
@@ -893,6 +893,7 @@ function parseParameter({ param, parentName, options, parseSchema }) {
|
|
|
893
893
|
}) : _kubb_kit.ast.factory.createSchema({ type: options.unknownType });
|
|
894
894
|
const style = param.style;
|
|
895
895
|
const explode = param.explode;
|
|
896
|
+
const allowReserved = param.allowReserved;
|
|
896
897
|
return _kubb_kit.ast.factory.createParameter({
|
|
897
898
|
name: param.name,
|
|
898
899
|
in: param.in,
|
|
@@ -902,7 +903,8 @@ function parseParameter({ param, parentName, options, parseSchema }) {
|
|
|
902
903
|
},
|
|
903
904
|
required: param.required ?? false,
|
|
904
905
|
...style !== void 0 ? { style } : {},
|
|
905
|
-
...explode !== void 0 ? { explode } : {}
|
|
906
|
+
...explode !== void 0 ? { explode } : {},
|
|
907
|
+
...allowReserved !== void 0 ? { allowReserved } : {}
|
|
906
908
|
});
|
|
907
909
|
}
|
|
908
910
|
/**
|
|
@@ -1377,6 +1379,27 @@ function convertRef({ schema, name, nullable, defaultValue, document, parse, ref
|
|
|
1377
1379
|
schema: resolvedSchema
|
|
1378
1380
|
});
|
|
1379
1381
|
}
|
|
1382
|
+
/** Converts `{ ...rest, not: X }` into `intersection[rest, not[X]]`; a bare `required` inside `not` borrows the outer `properties`. */
|
|
1383
|
+
function convertNot({ schema, name, nullable, defaultValue, parse }) {
|
|
1384
|
+
const { not, ...rest } = schema;
|
|
1385
|
+
const [subschema] = resolveUnionMembers([not], rest.properties ?? {});
|
|
1386
|
+
const notNode = _kubb_kit.ast.factory.createSchema({
|
|
1387
|
+
type: "not",
|
|
1388
|
+
members: [parse({ schema: subschema })]
|
|
1389
|
+
});
|
|
1390
|
+
return createNode({
|
|
1391
|
+
schema,
|
|
1392
|
+
name,
|
|
1393
|
+
nullable,
|
|
1394
|
+
defaultValue
|
|
1395
|
+
}, {
|
|
1396
|
+
type: "intersection",
|
|
1397
|
+
members: [parse({
|
|
1398
|
+
schema: rest,
|
|
1399
|
+
name
|
|
1400
|
+
}), notNode]
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1380
1403
|
/**
|
|
1381
1404
|
* Converts an `allOf` schema into a flattened node or an `IntersectionSchemaNode`.
|
|
1382
1405
|
*/
|
|
@@ -1853,7 +1876,7 @@ function convertArray({ schema, name, nullable, defaultValue, options, parse })
|
|
|
1853
1876
|
//#endregion
|
|
1854
1877
|
//#region src/emit/parseSchema.ts
|
|
1855
1878
|
/**
|
|
1856
|
-
* Ordered schema rule table. Order is significant: composition keywords (`$ref`, `allOf`,
|
|
1879
|
+
* Ordered schema rule table. Order is significant: composition keywords (`not`, `$ref`, `allOf`,
|
|
1857
1880
|
* `oneOf`/`anyOf`) take precedence over `const`, which takes precedence over a genuine OAS 3.1
|
|
1858
1881
|
* multi-type array (more than one non-`null` type), which takes precedence over `format`/`type`.
|
|
1859
1882
|
* A multi-type array must split into its per-type members before `format` runs, otherwise
|
|
@@ -1864,6 +1887,10 @@ function convertArray({ schema, name, nullable, defaultValue, options, parse })
|
|
|
1864
1887
|
* match/convert/fall-through contract.
|
|
1865
1888
|
*/
|
|
1866
1889
|
const schemaRules = [
|
|
1890
|
+
{
|
|
1891
|
+
match: ({ schema }) => typeof schema.not === "object" && schema.not !== null,
|
|
1892
|
+
convert: convertNot
|
|
1893
|
+
},
|
|
1867
1894
|
{
|
|
1868
1895
|
match: ({ schema }) => isReference(schema),
|
|
1869
1896
|
convert: convertRef
|
|
@@ -2194,7 +2221,7 @@ function visit(node, pointer) {
|
|
|
2194
2221
|
for (const [index, item] of (node.items ?? []).entries()) visit(item, `${pointer}/items/${index}`);
|
|
2195
2222
|
return;
|
|
2196
2223
|
}
|
|
2197
|
-
if (node.type === "union" || node.type === "intersection") for (const [index, member] of (node.members ?? []).entries()) visit(member, `${pointer}/members/${index}`);
|
|
2224
|
+
if (node.type === "union" || node.type === "intersection" || node.type === "not") for (const [index, member] of (node.members ?? []).entries()) visit(member, `${pointer}/members/${index}`);
|
|
2198
2225
|
}
|
|
2199
2226
|
//#endregion
|
|
2200
2227
|
//#region src/adapter.ts
|