@kubb/adapter-oas 5.0.0-beta.71 → 5.0.0-beta.73
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 +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1926,11 +1926,22 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1926
1926
|
return objectNode;
|
|
1927
1927
|
}
|
|
1928
1928
|
/**
|
|
1929
|
+
* Resolves a tuple's rest-element schema from the `items` keyword that sits alongside `prefixItems`.
|
|
1930
|
+
*
|
|
1931
|
+
* `items: false` closes the tuple, so no rest element is emitted. An absent `items` widens the tail
|
|
1932
|
+
* to `any`, and a schema object (or `items: true`) becomes the homogeneous rest type.
|
|
1933
|
+
*/
|
|
1934
|
+
function resolveTupleRest(items, rawOptions) {
|
|
1935
|
+
if (items === false) return void 0;
|
|
1936
|
+
if (!items || items === true) return _kubb_core.ast.factory.createSchema({ type: "any" });
|
|
1937
|
+
return parseSchema({ schema: items }, rawOptions);
|
|
1938
|
+
}
|
|
1939
|
+
/**
|
|
1929
1940
|
* Converts an OAS 3.1 `prefixItems` tuple into a `TupleSchemaNode`.
|
|
1930
1941
|
*/
|
|
1931
1942
|
function convertTuple({ schema, name, nullable, defaultValue, rawOptions }) {
|
|
1932
1943
|
const tupleItems = (schema.prefixItems ?? []).map((item) => parseSchema({ schema: item }, rawOptions));
|
|
1933
|
-
const rest =
|
|
1944
|
+
const rest = resolveTupleRest(schema.items, rawOptions);
|
|
1934
1945
|
return _kubb_core.ast.factory.createSchema({
|
|
1935
1946
|
type: "tuple",
|
|
1936
1947
|
primitive: "array",
|