@kubb/adapter-oas 5.0.0-beta.72 → 5.0.0-beta.74

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.d.ts CHANGED
@@ -1127,8 +1127,11 @@ type SchemaObject$1 = {
1127
1127
  patternProperties?: Record<string, SchemaObject$1 | boolean>;
1128
1128
  /**
1129
1129
  * Single-schema form of `items`. Narrowed from the base type to take precedence over the tuple overload.
1130
+ *
1131
+ * Alongside `prefixItems`, the JSON Schema boolean form applies: `items: false` closes the tuple
1132
+ * (no extra elements allowed), while `items: true` is equivalent to an unconstrained rest.
1130
1133
  */
1131
- items?: SchemaObject$1 | ReferenceObject$1;
1134
+ items?: SchemaObject$1 | ReferenceObject$1 | boolean;
1132
1135
  /**
1133
1136
  * Allowed values for this schema.
1134
1137
  */
package/dist/index.js CHANGED
@@ -1903,11 +1903,22 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1903
1903
  return objectNode;
1904
1904
  }
1905
1905
  /**
1906
+ * Resolves a tuple's rest-element schema from the `items` keyword that sits alongside `prefixItems`.
1907
+ *
1908
+ * `items: false` closes the tuple, so no rest element is emitted. An absent `items` widens the tail
1909
+ * to `any`, and a schema object (or `items: true`) becomes the homogeneous rest type.
1910
+ */
1911
+ function resolveTupleRest(items, rawOptions) {
1912
+ if (items === false) return void 0;
1913
+ if (!items || items === true) return ast.factory.createSchema({ type: "any" });
1914
+ return parseSchema({ schema: items }, rawOptions);
1915
+ }
1916
+ /**
1906
1917
  * Converts an OAS 3.1 `prefixItems` tuple into a `TupleSchemaNode`.
1907
1918
  */
1908
1919
  function convertTuple({ schema, name, nullable, defaultValue, rawOptions }) {
1909
1920
  const tupleItems = (schema.prefixItems ?? []).map((item) => parseSchema({ schema: item }, rawOptions));
1910
- const rest = schema.items ? parseSchema({ schema: schema.items }, rawOptions) : ast.factory.createSchema({ type: "any" });
1921
+ const rest = resolveTupleRest(schema.items, rawOptions);
1911
1922
  return ast.factory.createSchema({
1912
1923
  type: "tuple",
1913
1924
  primitive: "array",