Skip to content

Commit

Permalink
Release 1.8.2 (#50)
Browse files Browse the repository at this point in the history
* fix: wrong array unions type

* docs: update CHANGELOG; bump: up version to 1.8.2
  • Loading branch information
js2me committed May 29, 2020
1 parent 5e2f3a6 commit acc770b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# next release

# 1.8.2

Fixes:
- Broken types for arrays of union types ([issue](https://github.com/acacode/swagger-typescript-api/issues/49))

# 1.8.1

Fixes:
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swagger-typescript-api",
"version": "1.8.1",
"version": "1.8.2",
"description": "Create typescript api module from swagger schema",
"scripts": {
"cli": "node index.js -r -d -p http://localhost:8080/api/v1/swagger.json -n swagger-test-cli.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const types = {
},
array: ({ items, ...schemaPart }) => {
const { content } = parseSchema(items, null, inlineExtraFormatters);
return checkAndAddNull(schemaPart, `${content}[]`);
return checkAndAddNull(schemaPart, `(${content})[]`);
},

// TODO: probably it can be needed
Expand Down
2 changes: 1 addition & 1 deletion tests/generated/v2.0/another-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class Api<SecurityDataType = any> extends HttpClient<SecurityDataType> {
* @secure
* @description Multiple status values can be provided with comma separated strings
*/
findPetsByStatus: (query: { status: "available" | "pending" | "sold"[] }, params?: RequestParams) =>
findPetsByStatus: (query: { status: ("available" | "pending" | "sold")[] }, params?: RequestParams) =>
this.request<Pet[], any>(
`/pet/findByStatus${this.addQueryParams(query)}`,
"GET",
Expand Down
5 changes: 3 additions & 2 deletions tests/generated/v2.0/github-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ export type hook = {
active?: boolean;
config?: { content_type?: string; url?: string };
created_at?: string;
events?:
events?: (
| "push"
| "issues"
| "issue_comment"
Expand All @@ -507,7 +507,8 @@ export type hook = {
| "member"
| "public"
| "team_add"
| "status"[];
| "status"
)[];
id?: number;
name?: string;
updated_at?: string;
Expand Down
2 changes: 1 addition & 1 deletion tests/generated/v2.0/petstore-swagger-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class Api<SecurityDataType = any> extends HttpClient<SecurityDataType> {
* @secure
* @description Multiple status values can be provided with comma separated strings
*/
findPetsByStatus: (query: { status: "available" | "pending" | "sold"[] }, params?: RequestParams) =>
findPetsByStatus: (query: { status: ("available" | "pending" | "sold")[] }, params?: RequestParams) =>
this.request<Pet[], any>(
`/pet/findByStatus${this.addQueryParams(query)}`,
"GET",
Expand Down
5 changes: 3 additions & 2 deletions tests/spec/noClient/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ export type hook = {
active?: boolean;
config?: { content_type?: string; url?: string };
created_at?: string;
events?:
events?: (
| "push"
| "issues"
| "issue_comment"
Expand All @@ -507,7 +507,8 @@ export type hook = {
| "member"
| "public"
| "team_add"
| "status"[];
| "status"
)[];
id?: number;
name?: string;
updated_at?: string;
Expand Down
5 changes: 3 additions & 2 deletions tests/spec/routeTypes/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ export type hook = {
active?: boolean;
config?: { content_type?: string; url?: string };
created_at?: string;
events?:
events?: (
| "push"
| "issues"
| "issue_comment"
Expand All @@ -507,7 +507,8 @@ export type hook = {
| "member"
| "public"
| "team_add"
| "status"[];
| "status"
)[];
id?: number;
name?: string;
updated_at?: string;
Expand Down

0 comments on commit acc770b

Please sign in to comment.