-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly generate array when items are a oneOf array with length 1
- Loading branch information
Showing
12 changed files
with
113 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@hey-api/openapi-ts': patch | ||
--- | ||
|
||
fix: correctly generate array when items are a oneOf array with length 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/openapi-ts/test/__snapshots__/3.0.x/array-items-one-of-length-1/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// This file is auto-generated by @hey-api/openapi-ts | ||
export * from './types.gen'; |
7 changes: 7 additions & 0 deletions
7
packages/openapi-ts/test/__snapshots__/3.0.x/array-items-one-of-length-1/types.gen.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This file is auto-generated by @hey-api/openapi-ts | ||
|
||
export type Foo = { | ||
foo?: Array<Bar>; | ||
}; | ||
|
||
export type Bar = string; |
2 changes: 2 additions & 0 deletions
2
packages/openapi-ts/test/__snapshots__/3.1.x/array-items-one-of-length-1/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// This file is auto-generated by @hey-api/openapi-ts | ||
export * from './types.gen'; |
7 changes: 7 additions & 0 deletions
7
packages/openapi-ts/test/__snapshots__/3.1.x/array-items-one-of-length-1/types.gen.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This file is auto-generated by @hey-api/openapi-ts | ||
|
||
export type Foo = { | ||
foo?: Array<Bar>; | ||
}; | ||
|
||
export type Bar = string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/openapi-ts/test/spec/3.0.x/array-items-one-of-length-1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"openapi": "3.0.2", | ||
"info": { | ||
"title": "OpenAPI 3.0.2 array items oneOf length 1 example", | ||
"version": "1" | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Foo": { | ||
"type": "object", | ||
"properties": { | ||
"foo": { | ||
"type": "array", | ||
"items": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/components/schemas/Bar" | ||
} | ||
] | ||
}, | ||
"maxItems": 2147483647, | ||
"minItems": 1 | ||
} | ||
} | ||
}, | ||
"Bar": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
packages/openapi-ts/test/spec/3.1.x/array-items-one-of-length-1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"openapi": "3.1.0", | ||
"info": { | ||
"title": "OpenAPI 3.1.0 array items oneOf length 1 example", | ||
"version": "1" | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Foo": { | ||
"type": "object", | ||
"properties": { | ||
"foo": { | ||
"type": "array", | ||
"items": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/components/schemas/Bar" | ||
} | ||
] | ||
}, | ||
"maxItems": 2147483647, | ||
"minItems": 1 | ||
} | ||
} | ||
}, | ||
"Bar": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} |