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