Skip to content

Releases: acacode/swagger-typescript-api

13.0.3 Release

09 Aug 17:14
2b6db23
Compare
Choose a tag to compare

fix: problem with type any as base type of discriminator schema (cases when schema without discriminator is empty)

13.0.2 Release

25 Jul 16:44
db92855
Compare
Choose a tag to compare

fix: problem with incorrect settings type suffix for internal discriminator mappings

13.0.1 Release

25 Jul 13:34
5729dcf
Compare
Choose a tag to compare

feat: const keyword OpenAPI 3.0 draft
fix: problem with using anyOf
feat: --extract-responses (nodejs: extractResponses) option to extract all schemas from /components/responses
fix: discriminator and mapping with invalid discriminator property name (#551)
fix: problem with incorrect resolving type name of discriminator mapping types data contracts

Full Changelog: 13.0.0...13.0.1

13.0.0 Release

13 Jul 23:01
9a55e7c
Compare
Choose a tag to compare

BREAKING_CHANGE: disable support NodeJS 14.x
BREAKING_CHANGE: change swagger-typescript-api NodeJS "generateApi" function return type
BREAKING_CHANGE: remove rawModelTypes from output api configuration
feat: --custom-config <string> option (#503)
feat: --sort-routes option, ability to sort routes;
fix: critical bugs based with extract types and enums
fix: sort types option (sort was not correctly work with nested or extracted types)
fix: problems based with extracting enums;
fix: nullable enum with integer values (#543)
fix: generation enum numbers as strings one (#534)
chore: refactoring the axios imports
fix: non-object custom spec extensions (#500)
fix(docs): input instead of output in readme
internal: remove redundant internal scripts
internal: change process with using custom templates

interface GenerateApiOutput {
...
-  files: { name: string; content: string; declaration: { name: string; content: string } | null }[];
+  files: { fileName: string; fileContent: string; fileExtension: string }[];
...
}

internal: refactor schema parser code (preparing it for async code execution)
fix: problem with filtering primitive in complex types (#459)
feat: add discriminator property support (#456)
internal: prepare code + templates for async code execution (next plans)
fix: problems with dot in query params (hard fix) (#460)
feature: ability to send custom Ts output code translator to js. Example:

 const { Translator } = require("swagger-typescript-api/src/translators/translator");
 const { JavascriptTranslator } = require("swagger-typescript-api/src/translators/javascript");

 class MyTranslator extends Translator { // or use extends JavascriptTranslator
     translate({ fileName, fileExtension, fileContent }) {
         // format ts\js code with using this codeFormatter (prettier + ts import fixer)
         this.codeFormatter.format(fileContent)
         // config of the code gen process
         this.config.
         // logger
         this.logger.

         return [
             {
                 fileName,
                 fileExtension,
                 fileContent,
             }
         ]
     }
 }

Full Changelog: 12.0.4...13.0.0

12.0.4 Release

22 Mar 23:13
Compare
Choose a tag to compare

What's Changed

fix: onCreateRoute skip behaviour
fix: problems with prefixes\suffixes for extracted requests params, enums

Full Changelog: 12.0.3...12.0.4

12.0.3 Release

09 Feb 15:19
dbcf6cc
Compare
Choose a tag to compare

What's Changed

Full Changelog: 12.0.2...12.0.3

12.0.2 Release

14 Nov 10:34
79274ac
Compare
Choose a tag to compare

fix: missing option --extract-enums (#344)

12.0.1 Release

13 Nov 16:38
1ce2dd5
Compare
Choose a tag to compare

fix: problem based with http requests and disableStrictSSL option (#453)
docs: update docs for requestOptions nodejs option

12.0.0 Release

13 Nov 07:41
e3e0e6e
Compare
Choose a tag to compare

new hooks:

/** calls before parse\process route path */
onPreBuildRoutePath: (routePath: string) => string | void;
/** calls after parse\process route path */
onBuildRoutePath: (data: BuildRoutePath) => BuildRoutePath | void;
/** calls before insert path param name into string path interpolation */
onInsertPathParam: (paramName: string, index: number, arr: BuildRouteParam[], resultRoute: string) => string | void;
/** calls before parse any kind of schema */
onPreParseSchema: (originalSchema: any, typeName: string, schemaType: string) => any;

BREAKING_CHANGE: add ability to custom prefix for autofix invalid enum keys, invalid type names with nodejs options (fixInvalidTypeNamePrefix: string, fixInvalidEnumKeyPrefix: string)
BREAKING_CHANGE: by default all component enum schemas (even numeric) extracting as enum TS constructions (#344)
feature: ability to extract all enums from nested types\interfaces to enum TS construction using --extract-enums option (#344)
feature: ability to modify route path params before insert them into string (request url, #446, with using hook onInsertPathParam)
feature: (nodejs) ability to add prefix\suffix for type names and enum keys

typePrefix?: string;
typeSuffix?: string;
enumKeyPrefix?: string;
enumKeySuffix?: string;

feature: ability to customize resolving process of the extracting type names (extractingOptions nodejs option)

extractingOptions = {
  // requestBodySuffix: ["Payload", "Body", "Input"],
  // or
  // requestBodyNameResolver: (typeName, reservedNames) => string;

  // requestParamsSuffix: ["Params"],
  // or
  // requestParamsNameResolver: (typeName, reservedNames) => string;

  // responseBodySuffix: ["Data", "Result", "Output"],
  // or
  // responseBodyNameResolver: (typeName, reservedNames) => string;

  // responseErrorSuffix: ["Error", "Fail", "Fails", "ErrorData", "HttpError", "BadResponse"],
  // or
  // responseErrorNameResolver: (typeName, reservedNames) => string;
}

docs: update docs for extraTemplates option
fix: problem with default name of single api file (Api.ts)
fix: problem based with tuple types (#445)
fix: problem with defaultResponseType declaration type

11.1.3 Release

05 Nov 18:28
a0174e9
Compare
Choose a tag to compare

fix: problems with text/* content types (axios, fetch http clients) (thanks @JochenDiekenbrock, #312, #443)
fix: problem with application/json* content type (thanks @JochenDiekenbrock, #440, #441)
fix: different query type parameters declarations (in route name {?accountStatus,createdT, #439)