openapi-typescript
Advanced tools
Comparing version 7.1.0 to 7.1.1
# openapi-typescript | ||
## 7.1.1 | ||
### Patch Changes | ||
- [#1784](https://github.com/openapi-ts/openapi-typescript/pull/1784) [`c2f8655`](https://github.com/openapi-ts/openapi-typescript/commit/c2f8655c0be5f8131d0ef115724fa4a443c44a8b) Thanks [@yoshi2no](https://github.com/yoshi2no)! - Fix: Correct handling of identical minItems and maxItems in array schemas when arrayLength option is true | ||
## 7.1.0 | ||
@@ -4,0 +10,0 @@ |
@@ -196,3 +196,10 @@ import { parseRef } from "@redocly/openapi-core/lib/ref-utils.js"; | ||
estimateCodeSize < 30) { | ||
if (schemaObject.maxItems > 0) { | ||
if (min === max) { | ||
const elements = []; | ||
for (let i = 0; i < min; i++) { | ||
elements.push(itemType); | ||
} | ||
return tsUnion([ts.factory.createTupleTypeNode(elements)]); | ||
} | ||
else if (schemaObject.maxItems > 0) { | ||
const members = []; | ||
@@ -199,0 +206,0 @@ for (let i = 0; i <= (max ?? 0) - min; i++) { |
{ | ||
"name": "openapi-typescript", | ||
"description": "Convert OpenAPI 3.0 & 3.1 schemas to TypeScript", | ||
"version": "7.1.0", | ||
"version": "7.1.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Drew Powers", |
@@ -333,4 +333,10 @@ import { parseRef } from "@redocly/openapi-core/lib/ref-utils.js"; | ||
) { | ||
// if maxItems is set, then return a union of all permutations of possible tuple types | ||
if ((schemaObject.maxItems as number) > 0) { | ||
if (min === max) { | ||
const elements: ts.TypeNode[] = []; | ||
for (let i = 0; i < min; i++) { | ||
elements.push(itemType); | ||
} | ||
return tsUnion([ts.factory.createTupleTypeNode(elements)]); | ||
} else if ((schemaObject.maxItems as number) > 0) { | ||
// if maxItems is set, then return a union of all permutations of possible tuple types | ||
const members: ts.TypeNode[] = []; | ||
@@ -337,0 +343,0 @@ // populate 1 short of min … |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
542614
10201