Skip to content

Commit

Permalink
Release 6.2.1 (#194)
Browse files Browse the repository at this point in the history
* fix: missing generateUnionEnums in .d.ts (#193)

* fix: problem with missing default params for axios http client (issue #192, thanks @Nihisil); docs: update CHANGELOG

* bump: up version to 6.2.1

Co-authored-by: Artem Shabanov <[email protected]>
  • Loading branch information
js2me and artsaban authored Mar 4, 2021
1 parent 08a5790 commit c9753aa
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# next release

# 6.2.1

Fixes:
- missing `generateUnionEnums?: boolean;` in `index.d.ts` file (thanks @artsaban)
- missing default params to axios http client (`--axios`) (issue #192, thanks @Nihisil)

# 6.2.0

Features:
Expand Down
5 changes: 5 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ interface GenerateApiParams {
*/
templates?: string;

/**
* generate all "enum" types as union types (T1 | T2 | TN) (default: false)
*/
generateUnionEnums?: boolean;

/**
* generate type definitions for API routes (default: false)
*/
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": "6.2.0",
"version": "6.2.1",
"description": "Create typescript api module from swagger schema",
"scripts": {
"cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts --extract-request-params --enum-names-as-values",
Expand Down
2 changes: 2 additions & 0 deletions templates/base/http-clients/axios-http-client.eta
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ export class HttpClient<SecurityDataType = unknown> {

private mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig {
return {
...this.instance.defaults,
...params1,
...(params2 || {}),
headers: {
...this.instance.defaults,
...(params1.headers || {}),
...((params2 && params2.headers) || {}),
},
Expand Down
2 changes: 2 additions & 0 deletions tests/spec/axios/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1483,9 +1483,11 @@ export class HttpClient<SecurityDataType = unknown> {

private mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig {
return {
...this.instance.defaults,
...params1,
...(params2 || {}),
headers: {
...this.instance.defaults,
...(params1.headers || {}),
...((params2 && params2.headers) || {}),
},
Expand Down
2 changes: 2 additions & 0 deletions tests/spec/axiosSingleHttpClient/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1483,9 +1483,11 @@ export class HttpClient<SecurityDataType = unknown> {

private mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig {
return {
...this.instance.defaults,
...params1,
...(params2 || {}),
headers: {
...this.instance.defaults,
...(params1.headers || {}),
...((params2 && params2.headers) || {}),
},
Expand Down
2 changes: 2 additions & 0 deletions tests/spec/jsAxios/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ export class HttpClient {
}
mergeRequestParams(params1, params2) {
return {
...this.instance.defaults,
...params1,
...(params2 || {}),
headers: {
...this.instance.defaults,
...(params1.headers || {}),
...((params2 && params2.headers) || {}),
},
Expand Down

0 comments on commit c9753aa

Please sign in to comment.