Skip to content

Releases: acacode/swagger-typescript-api

4.1.0 Release

22 Jan 09:23
c320b9a
Compare
Choose a tag to compare

Features:

  • Improve require() function used in ETA templates (using relative path imports)
  • --clean-output option.
    clean output folder before generate api

Fixes:

  • Error: Unexpected token = (Issue #136, Thanks @jlow-mudbath)
  • Output folder creation (Issue #137, Thanks @Rinta01)
    Create output folder if it is not exist

4.0.5 Release

20 Jan 07:09
e978e98
Compare
Choose a tag to compare

BREAKING_CHANGE:

  • remove 'prettier-plugin-organize-imports' dependency from package

Fixes:

4.0.4 Release

15 Jan 08:43
8c7ce99
Compare
Choose a tag to compare

Features:

  • add require() to template utils object

Docs:

  • add information about contributors

4.0.3 Release

14 Jan 17:43
3641415
Compare
Choose a tag to compare

Features:

  • --disableStrictSSL option for disable strict SSL statement with fetching swagger schema. (Thanks @kel666 for PR with feature request)
    This option fix problem #114

4.0.2 Release

12 Jan 13:59
a2a5fb7
Compare
Choose a tag to compare

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

12 Jan 11:59
c478151
Compare
Choose a tag to compare

Fixes:

  • Cannot find module 'prettier-plugin-organize-imports' #109

4.0.0 Release

12 Jan 11:00
14b6d3d
Compare
Choose a tag to compare

BREAKING_CHANGES:

  • Migrate from mustache template engine to ETA template engine. (Thanks @Fl0pZz)
  • Critical change in HttpResponse type (Remove D | null, E | null unions)
interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
-  data: D | null;
+  data: D;
-  error: E | null;
+  error: E;
}

Features:

  • --modular option. 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 includeFile ETA directive)
    Now you can store only the ETA templates which you need to change for yourself.

  • --extract-request-params option. Generate path and query request params data contract and modify request payload args
    Example:
    extract-request-params

  • Improve data-contracts.eta template. Added more power :)

  • Add extraTemplates property for generateApi(). Allows to generate extra files via this tool.

  • Add hooks property for generateApi()

    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-enumNames support for enums
  • Problem of complex types (oneOf, allOf) with properties field
  • additionalProperties: true should make [key: string]: any for object types (Thanks @brookjordan for issue #103)

Common:

  • HttpClient is exportable by default
  • Improve typings when use swagger-typescript-api with NodeJS (index.d.ts)

3.1.2 Release

07 Jan 08:45
4a5d7ea
Compare
Choose a tag to compare

Fixes:

3.1.1 Release

23 Dec 11:16
9781aff
Compare
Choose a tag to compare

Fixes:

  • name.includes is not a function (issue #98)

3.1.0 Release

21 Dec 08:17
14f59aa
Compare
Choose a tag to compare

Features:

  • --moduleNameIndex option. 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