Releases: acacode/swagger-typescript-api
4.0.2 Release
Fixes:
Unexpected token '.'on v4 (Thanks @savingprivatebryan for issue #111)
Replaced all new syntax sugar like?.or??to prev. alternatives for support nodejs 12
4.0.1 Release
Fixes:
Cannot find module 'prettier-plugin-organize-imports'#109
4.0.0 Release
BREAKING_CHANGES:
- Migrate from mustache template engine to ETA template engine. (Thanks @Fl0pZz)
- Critical change in
HttpResponsetype (RemoveD | null,E | nullunions)
interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
- data: D | null;
+ data: D;
- error: E | null;
+ error: E;
}Features:
-
--modularoption. Allows to generate api class per module name.
Example: here -
new templates on ETA (enhanced EJS) which can improve your templates! (Thanks @Fl0pZz)
ETA extension for Visual Studio Code (thanks @shadowtime2000)
Also moved out to templates:procedure-call.eta(request api method template)route-name.eta(api method name template)route-docs.eta(api method docs template)
No worry about strange syntax it is very simple in usage :)
-
Optional templates feature (Except templates using in
includeFileETAdirective)
Now you can store only theETAtemplates which you need to change for yourself. -
--extract-request-paramsoption. Generate path and query request params data contract and modify request payload args
Example:

-
Improve
data-contracts.etatemplate. Added more power :) -
Add
extraTemplatesproperty forgenerateApi(). Allows to generate extra files via this tool. -
Add
hooksproperty forgenerateApi()hooks?: Partial<{ onCreateComponent: (component: SchemaComponent) => SchemaComponent | void; onParseSchema: (originalSchema: any, parsedSchema: any) => any | void; onCreateRoute: (routeData: ParsedRoute) => ParsedRoute | void; /** Start point of work this tool (after fetching schema) */ onInit?: <C extends GenerateApiConfiguration["config"]>(configuration: C) => C | void; /** Allows to customize configuration object before sending it to templates. */ onPrepareConfig?: <C extends GenerateApiConfiguration>(currentConfiguration: C) => C | void; }>;
generateApi({ input: "./schema.json", output: "./__generated__", hooks: { onCreateComponent(component) { // do something return component; }, // ... } })
Internal:
- Update all dependencies to latest
Fixes:
x-enumNamessupport for enums- Problem of complex types (
oneOf,allOf) withpropertiesfield additionalProperties: trueshould make[key: string]: anyfor object types (Thanks @brookjordan for issue #103)
Common:
HttpClientis exportable by default- Improve typings when use
swagger-typescript-apiwith NodeJS (index.d.ts)
3.1.2 Release
Fixes:
- axios vulnerability (#101 issue, thanks @Mvbraathen)
3.1.1 Release
Fixes:
name.includes is not a function(issue #98)
3.1.0 Release
Features:
--moduleNameIndexoption. determines which path index should be used for routes separation (Thanks @nikalun)
Examples:
GET:api/v1/fruites/getFruit -> index:2 -> moduleName -> fruites
GET:api/v1/fruites/getFruit -> index:0 -> moduleName -> api
3.0.0 Release
BREAKING_CHANGES:
- Renamed mustache templates:
api.mustache->data-contracts.mustacheclient.mustache->http.client.mustache+api.mustache
- Split the
client.mustachetemplate into two parts:http-client.mustacheandapi.mustache
Fixes:
- Fixed unsafe clone() of Response causing json() hang. (Thanks @Benjamin-Dobell)
2.0.0 Release
Features:
--jsCLI option. [feature request]
BREAKING_CHANGES:
- Requests returns
Promise<HttpResponse<Data, Error>>type.
HttpResponseit is Fetch.Response wrapper with fieldsdataanderror
Example:const api = new Api() // const response: HttpResponse<Data, Error> = await api.fruits.getAll() response.data // Data (can be null if response.ok is false) response.error // Error (can be null if response.ok is true)
- Breaking changes in the
client.mustachetemplate. Needs to update local custom templates.
Fixes:
- Security configuration in methods. When the security definition is in the main configuration of the swagger definition
1.12.0 Release
Features:
Fixes:
1.11.0 release
Features:
- Improve the naming of model types (#65 issue)