Skip to content

Commit acc770b

Browse files
authored
Release 1.8.2 (#50)
* fix: wrong array unions type * docs: update CHANGELOG; bump: up version to 1.8.2
1 parent 5e2f3a6 commit acc770b

File tree

9 files changed

+19
-11
lines changed

9 files changed

+19
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# next release
22

3+
# 1.8.2
4+
5+
Fixes:
6+
- Broken types for arrays of union types ([issue](https://github.com/acacode/swagger-typescript-api/issues/49))
7+
38
# 1.8.1
49

510
Fixes:

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swagger-typescript-api",
3-
"version": "1.8.1",
3+
"version": "1.8.2",
44
"description": "Create typescript api module from swagger schema",
55
"scripts": {
66
"cli": "node index.js -r -d -p http://localhost:8080/api/v1/swagger.json -n swagger-test-cli.ts",

src/schema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const types = {
2020
},
2121
array: ({ items, ...schemaPart }) => {
2222
const { content } = parseSchema(items, null, inlineExtraFormatters);
23-
return checkAndAddNull(schemaPart, `${content}[]`);
23+
return checkAndAddNull(schemaPart, `(${content})[]`);
2424
},
2525

2626
// TODO: probably it can be needed

tests/generated/v2.0/another-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export class Api<SecurityDataType = any> extends HttpClient<SecurityDataType> {
241241
* @secure
242242
* @description Multiple status values can be provided with comma separated strings
243243
*/
244-
findPetsByStatus: (query: { status: "available" | "pending" | "sold"[] }, params?: RequestParams) =>
244+
findPetsByStatus: (query: { status: ("available" | "pending" | "sold")[] }, params?: RequestParams) =>
245245
this.request<Pet[], any>(
246246
`/pet/findByStatus${this.addQueryParams(query)}`,
247247
"GET",

tests/generated/v2.0/github-swagger.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ export type hook = {
492492
active?: boolean;
493493
config?: { content_type?: string; url?: string };
494494
created_at?: string;
495-
events?:
495+
events?: (
496496
| "push"
497497
| "issues"
498498
| "issue_comment"
@@ -507,7 +507,8 @@ export type hook = {
507507
| "member"
508508
| "public"
509509
| "team_add"
510-
| "status"[];
510+
| "status"
511+
)[];
511512
id?: number;
512513
name?: string;
513514
updated_at?: string;

tests/generated/v2.0/petstore-swagger-io.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export class Api<SecurityDataType = any> extends HttpClient<SecurityDataType> {
247247
* @secure
248248
* @description Multiple status values can be provided with comma separated strings
249249
*/
250-
findPetsByStatus: (query: { status: "available" | "pending" | "sold"[] }, params?: RequestParams) =>
250+
findPetsByStatus: (query: { status: ("available" | "pending" | "sold")[] }, params?: RequestParams) =>
251251
this.request<Pet[], any>(
252252
`/pet/findByStatus${this.addQueryParams(query)}`,
253253
"GET",

tests/spec/noClient/schema.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ export type hook = {
492492
active?: boolean;
493493
config?: { content_type?: string; url?: string };
494494
created_at?: string;
495-
events?:
495+
events?: (
496496
| "push"
497497
| "issues"
498498
| "issue_comment"
@@ -507,7 +507,8 @@ export type hook = {
507507
| "member"
508508
| "public"
509509
| "team_add"
510-
| "status"[];
510+
| "status"
511+
)[];
511512
id?: number;
512513
name?: string;
513514
updated_at?: string;

tests/spec/routeTypes/schema.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ export type hook = {
492492
active?: boolean;
493493
config?: { content_type?: string; url?: string };
494494
created_at?: string;
495-
events?:
495+
events?: (
496496
| "push"
497497
| "issues"
498498
| "issue_comment"
@@ -507,7 +507,8 @@ export type hook = {
507507
| "member"
508508
| "public"
509509
| "team_add"
510-
| "status"[];
510+
| "status"
511+
)[];
511512
id?: number;
512513
name?: string;
513514
updated_at?: string;

0 commit comments

Comments
 (0)