Skip to content

Commit

Permalink
Release 5.0.0 (#149)
Browse files Browse the repository at this point in the history
* BREAKING_CHANGE: fully refactored http-client.eta template; feat: image content kind; feat: request content type auto substitution

* chore: update funding

* feat: RequestHeaders, RequestParams types (issue #150, thanks @Fabiencdp); chore: removed apiConfig.generic usage in templates

* internal: rename test scripts; docs: update CHANGELOG

* fix: try to fix pseudo duplicated operationIds (issue #152, thanks @RoXuS for report)

* feat: --default-response option; BREAKING_CHANGE: changed the default response body type ('any' -> 'void')

* fix: remove hard coded request content type (issue #153, thanks @po5i); BREAKING_CHANGE: changed request body transformation

* feat: request cancellation support (issue #96, thanks @ApacheEx)

* bump: up project version to 5.0.0

* fix: critical bug with `:paramName` path params (issue #149)
  • Loading branch information
js2me authored Feb 12, 2021
1 parent 0f6a69c commit baf3814
Show file tree
Hide file tree
Showing 82 changed files with 17,479 additions and 11,132 deletions.
12 changes: 1 addition & 11 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
# These are supported funding model platforms

github: [js2me]
patreon: js2me
open_collective: # Replace with a single Open Collective username
ko_fi: js2me
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://paypal.me/acacode'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: ["https://paypal.me/acacode"]
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# next release

# 5.0.0

Fixes:
- Request content types auto substitution
i.e. if request body is form data, then request body content type will be `multipart/form-data`
- Strange method name (issue #152, thanks @RoXuS)
- Hardcoded Content-Type causes issues with some endpoints (issue #153, thanks @po5i)
- Critical bug with `:paramName` path params (issue #154)

Features:
- Ability to provide custom formatting `fetch` response
- `"IMAGE"` content kind for response\request data objects
- `RequestParams` `RequestHeaders` types for `--route-types` (`routeTypes: true`) option (issue #150, thanks @Fabiencdp )
- `--default-response` option. Allows to set default type for empty response schema (default: `void`) (based on issue #14)
- Request cancellation support (issue #96, thanks @ApacheEx)
`RequestParams` type now have the `cancelToken` field
`HttpClient` instance now have the `abortRequest(cancelToken)` method

BREAKING_CHANGES:
- Fully refactored `http-client.eta` template, make it more flexible and simpler.
`HttpClient["request"]` takes one argument with type `FullRequestParams`
(previously it takes many count of arguments which was not flexible)
- Changed the default response body type from `any` to `void` (issue #14)

Internal:
- Changed templates:
- `http-client.eta`
- `procedure-call.eta`
- `api.eta`

This version works with previous templates.

# 4.4.0

Fixes:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Options:
--modular generate separated files for http client, data contracts, and routes (default: false)
--disableStrictSSL disabled strict SSL (default: false)
--clean-output clean output folder before generate api. WARNING: May cause data loss (default: false)
--default-response <type> default type for empty response schema (default: "void")
-h, --help display help for command
```

Expand Down
6 changes: 5 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ interface GenerateApiParams {
* prettier configuration
*/
prettier?: object;
/**
* default type for empty response schema (default: "void")
*/
defaultResponseType?: boolean;
cleanOutput?: boolean;
enumNamesAsValues?: boolean;

Expand Down Expand Up @@ -215,7 +219,7 @@ export interface GenerateApiConfiguration {
componentsMap: Record<string, SchemaComponent>;
convertedFromSwagger2: boolean;
moduleNameIndex: number;
disableStrictSSSL: boolean;
disableStrictSSL: boolean;
extractRequestParams: boolean;
fileNames: {
dataContracts: string;
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const { Command } = require("commander");
const { resolve } = require("path");
const { generateApi } = require("./src");
const { version, name: packageName } = require("./package.json");
const { TS_KEYWORDS } = require("./src/constants");

const program = new Command(packageName);

Expand Down Expand Up @@ -61,6 +62,7 @@ program
0,
)
.option("--disableStrictSSL", "disabled strict SSL", false)
.option("--default-response <type>", "default type for empty response schema", TS_KEYWORDS.VOID)
.option(
"--clean-output",
"clean output folder before generate api. WARNING: May cause data loss",
Expand All @@ -86,6 +88,7 @@ const {
enumNamesAsValues,
disableStrictSSL,
cleanOutput,
defaultResponse,
} = program;

generateApi({
Expand All @@ -94,6 +97,7 @@ generateApi({
generateRouteTypes: routeTypes,
generateClient: client,
defaultResponseAsSuccess: defaultAsSuccess,
defaultResponseType: defaultResponse,
generateUnionEnums: unionEnums,
generateResponses: responses,
extractRequestParams: extractRequestParams,
Expand Down
Loading

0 comments on commit baf3814

Please sign in to comment.