Page Contents

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

3.1.0 (2020-03-24)

Bug Fixes

  • rest: allow async custom keyword by setting {$async: true} to referenced schemas (ede4bbd)
  • update package locks (cd2f6fa)

Features

  • rest: add info spec enhancer to build info for OpenAPI spec from application metadata (a440ae2)

3.0.1 (2020-03-17)

Note: Version bump only for package @loopback/rest

3.0.0 (2020-03-05)

Bug Fixes

  • cli: extract messages for generators (2f572bd)
  • rest: improves error handling for express middleware (02d0c91)

chore

  • remove support for Node.js v8.x (4281d9d)

Code Refactoring

  • rest: make getApiSpec() async (fe3df1b)

Features

  • rest: add async validation support (5b9a1ef)
  • rest: add openapi enhancer service (62d55eb), closes #4380
  • rest: add support for ajv-errors (d151475)
  • rest: allow controllers/routes to be added/removed after server is started (b604563)
  • add tslib as dependency (a6e0b4c), closes #4676
  • rest: bind controller routes to the context (a645b17)
  • rest: fixed AjvErrorOptions type & added test for ajvErrors: Object (aa711d0)

BREAKING CHANGES

  • rest: Api specifications are now emitted as a Promise instead of a value object. Calls to getApiSpec function must switch from the old style to new style as follows:
  1. Old style
function() {
  // ...
  const spec = restApp.restServer.getApiSpec();
  // ...
}
  1. New style
async function() {
  // ...
  const spec = await restApp.restServer.getApiSpec();
  // ...
}
  • rest: validateRequestBody is now an async function to allow asynchronous validations by custom Ajv keywords and formats. See https://ajv.js.org/#asynchronous-validation for more details.
  • Node.js v8.x is now end of life. Please upgrade to version 10 and above. See https://nodejs.org/en/about/releases.

2.0.0 (2020-02-06)

Bug Fixes

  • suport complex objects for query params in api explorer (a4ef640)

BREAKING CHANGES

  • This fix has modified the api definitions described by the decorator ‘param.query.object’, to support Open-API’s url-encoded definition for json query parameters.

Previously, such parameters were described with exploded: true and style: deepObject, i.e exploded encoding, which turned out to be problematic as explained and discussed in, https://github.com/swagger-api/swagger-js/issues/1385 and https://github.com/OAI/OpenAPI-Specification/issues/1706

  {
    "in": "query",
    "style": "deepObject"
    "explode": "true",
    "schema": {}
  }

Exploded encoding worked for simple json objects as below but not for complex objects.

   http://localhost:3000/todos?filter[limit]=2

To address these issues with exploded queries, this fix switches definition of json query params from the exploded, deep-object style to the url-encoded style definition in Open-API spec.

LoopBack already supports receiving url-encoded payload for json query parameters.

For instance, to filter api results from the GET ‘/todo-list’ endpoint in the todo-list example with a specific relation, { “include”: [ { “relation”: “todo” } ] }, the following url-encoded query parameter can be used,

   http://localhost:3000/todos?filter=%7B%22include%22%3A%5B%7B%22relation%22%3A%22todoList%22%7D%5D%7D

The above was possible because the coercion behavior in LoopBack performed json parsing for deep object style json query params before this fix. This fix has modified that behavior by removing json parsing. Since the exploded deep-object definition has been removed from the param.query.object decorator, this new behaviour remains just an internal source code aspect as of now.

In effect, this fix only modifies the open api definitions generated from LoopBack APIs. The ‘style’ and ‘explode’ fields are removed and the ‘schema’ field is moved under ‘content[application/json]’. This is the definition that supports url-encoding as per Open-API spec.

  {
    "in": "query"
    "content": {
      "application/json": {
        "schema": {}
      }
    }
  }

Certain client libraries (like swagger-ui or LoopBack’s api explorer) necessiate using Open-API’s url-encoded style definition for json query params to support “sending” url-encoded payload.

All consumers of LoopBack APIs may need to regenerate api definitions, if their client libraries require them to do so for url-encoding.

Otherwise there wouldn’t be any significant impact on API consumers.

To preserve compatibility with existing REST API clients, this change is backward compatible. All exploded queries like ?filter[limit]=1 will continue to work for json query params, despite the fact that they are described differently in the OpenAPI spec.

Existing api clients will continue to work after an upgrade.

The signature of the ‘param.query.object’ decorator has not changed.

There is no code changes required in the LoopBack APIs after upgrading to this fix. No method signatures or data structures are impacted.

1.26.1 (2020-02-05)

Note: Version bump only for package @loopback/rest

1.26.0 (2020-01-27)

Features

  • context: index bindings by tag to speed up matching by tag (566b9d9)

1.25.1 (2020-01-07)

Note: Version bump only for package @loopback/rest

1.25.0 (2019-12-09)

Features

  • context: make it possible to set source information for interceptions (2a1ccb4)

1.24.0 (2019-11-25)

Features

  • rest: upgrade to path-to-regexp 6.x and improve error messages (ad44209)

1.23.0 (2019-11-12)

Bug Fixes

  • rest: improve null check to avoid compilation errors with TypeScript 3.7 (ab47ef6)

Features

  • rest: bind operation spec to the request context (55311df)

1.22.0 (2019-10-24)

Bug Fixes

  • openapi-v3: preserve additionalProperties: false (bc7691b)

Features

  • improve debug logs for schema generators (da88cdf)
  • simplify model schema with excluded properties (b554ac8)

1.21.0 (2019-10-07)

Features

  • rest: add listenOnStart flag to control http listening for a rest server (2c5a131)

1.20.1 (2019-09-28)

Note: Version bump only for package @loopback/rest

1.20.0 (2019-09-27)

Features

  • rest: added support for sockets and pipes to RestServer (e48ebb8)
  • rest: allow developers to transform AJV error objects (8c05b57)
  • self host oas spec by default on relative path in explorer (887556e)

1.19.0 (2019-09-17)

Features

  • eslint-config: enable “no-misused-promises” rule (88d5494)

1.18.1 (2019-09-06)

Note: Version bump only for package @loopback/rest

1.18.0 (2019-09-03)

Bug Fixes

  • make givenHttpServerConfig typing compatible with TypeScript 3.6 (1edbc0b)

Features

  • core: allow application to accept a parent context (ee50007)

1.17.0 (2019-08-19)

Features

  • rest: add support for ajv-keywords (f7bb80d)

1.16.8 (2019-08-15)

Note: Version bump only for package @loopback/rest

1.16.7 (2019-08-15)

Note: Version bump only for package @loopback/rest

1.16.6 (2019-07-31)

Note: Version bump only for package @loopback/rest

1.16.5 (2019-07-26)

Note: Version bump only for package @loopback/rest

1.16.4 (2019-07-17)

Bug Fixes

  • rest: correctly handle basePath set via basePath() API (2118d80)

1.16.3 (2019-06-28)

Bug Fixes

  • rest: honor options for AJV validator caching (1fd52a3)
  • address violations of “no-floating-promises” rule (0947531)

1.16.2 (2019-06-21)

Note: Version bump only for package @loopback/rest

1.16.1 (2019-06-20)

Note: Version bump only for package @loopback/rest

1.16.0 (2019-06-17)

Features

  • rest: expose request body validation options to be configurable (00ec6df)
  • rest: set nullable to true by default for AJV validations (73ad6ad)

1.15.0 (2019-06-06)

Features

  • testlab: add generic helper skipOnTravis (3221d9f)

1.14.0 (2019-06-03)

Features

  • replace tslint with eslint (44185a7)

1.13.1 (2019-05-31)

Note: Version bump only for package @loopback/rest

1.13.0 (2019-05-30)

Bug Fixes

  • specify the type for handler (9e0119d)

Features

  • helpers for building JSON/OpenAPI schema referencing shared definitions (bf07ff9)

1.12.0 (2019-05-23)

Features

  • context: leave local bindings and parent unchanged during close (198af88)

1.11.2 (2019-05-14)

Note: Version bump only for package @loopback/rest

1.11.1 (2019-05-10)

Note: Version bump only for package @loopback/rest

1.11.0 (2019-05-09)

Bug Fixes

  • rest: assign all component properties to target spec (af06b69)

Features

  • context: add support for method interceptors (293188d)

1.10.5 (2019-05-06)

Bug Fixes

  • rest: aggressive redirection to Swagger UI (9f0d8ca)

1.10.4 (2019-04-26)

Note: Version bump only for package @loopback/rest

1.10.3 (2019-04-20)

Bug Fixes

  • rest: fix a variable in sample code for README.md (2bad701)

1.10.2 (2019-04-11)

Note: Version bump only for package @loopback/rest

1.10.1 (2019-04-09)

Bug Fixes

  • rest: a small typo fix in code comments (81d19bb)

1.10.0 (2019-04-05)

Bug Fixes

  • rest: make sure basePath is included in RestServer.url (705bce4)

Features

  • context: pass resolution options into binding.getValue() (705dcd5)
  • rest: add mountExpressRouter (be21cde)

1.9.1 (2019-03-22)

Note: Version bump only for package @loopback/rest

1.9.0 (2019-03-22)

Features

  • context: honor binding scope from @bind (3b30f01)
  • context: tidy up context for resolving injections of a singleton binding (f5bf43c)
  • rest: add requestedBaseUrl API to RequestContext (912bece)
  • testlab: add dummy HTTPS config (a32c885)

1.8.0 (2019-03-12)

Features

  • openapi-v3: add operationId based on controller/method names (89f905b)
  • rest: add strict option for routers (c3c5dab)
  • rest: add support for redirect routes (53bce7f)

1.7.0 (2019-03-01)

Features

  • rest: allow express settings to be customized (962f1cb)

1.6.0 (2019-02-25)

Bug Fixes

  • rest: only return matched trie nodes with values (669ede1)

Features

  • context: introduce async context observers for bind/unbind events (e5e5fc4)
  • rest: add disabled option for OpenAPI spec endpoints (af5b16a)
  • rest: allow rest-server to be mounted on a path to express (de8f626)
  • rest: introduce requestBodyParser options in RestServerOptions (c7f59ba)

1.5.5 (2019-02-08)

Bug Fixes

  • rest: sanitize json for JSON.parse() (5042698)
  • update to the most recent lodash version (65ee865)

1.5.4 (2019-01-28)

Note: Version bump only for package @loopback/rest

1.5.3 (2019-01-15)

Note: Version bump only for package @loopback/rest

1.5.2 (2019-01-14)

Bug Fixes

  • rework tslint comments disabling “no-unused-variable” rule (a18a3d7)

1.5.1 (2018-12-20)

Note: Version bump only for package @loopback/rest

1.5.0 (2018-12-13)

Bug Fixes

  • rest: add tests for request validation per media type (7be76a4)
  • rest: parse query string even when there is no rest query param (ad905a5)

Features

  • rest: allow basePath for rest servers (1016a09)

1.4.0 (2018-11-26)

Bug Fixes

  • rest: allow . to be used in openapi path template (47c24cb)

Features

  • rest: allow body parsers to be extended (86bfcbc)
  • rest: switch to express body-parser (084837f)

1.3.1 (2018-11-17)

Bug Fixes

  • rest: allow users to disable Explorer redirects after RestServer was created (34af6a0)

1.3.0 (2018-11-14)

Features

  • rest: add config option to disable API Explorer redirects (b4d9bc5)

1.2.0 (2018-11-08)

Bug Fixes

  • rest: don’t rely on transitive dependencies from express (a3d5d0c)
  • rest: handle overlapping paths with different vars (17adc7a)
  • rest: improve route sorting to group by path and verb (ce31bf7)
  • rest: make sure the sorting test pass for node 11 (614450b)
  • fix static assets router blocking controller registration (0e1b06f)
  • move serve-static @types to normal dependencies (216bf85), closes #1917
  • optimize serving static files (57a94a5)
  • remove unnecessary dependency from #1918 (63d367b)

Features

  • add ‘x-visibility’ extension property to OpenAPI spec (5634e18)
  • rest: add support for form request body (2d9e0a8)
  • rest: push route(verb, path, spec, fn) down to RestServer (c49b65a)

1.0.1 (2018-10-17)

Note: Version bump only for package @loopback/rest

0.26.0 (2018-10-08)

Features

  • rest: switch to trie based routing (a682ce2)

0.25.5 (2018-10-06)

Note: Version bump only for package @loopback/rest

0.25.4 (2018-10-05)

Note: Version bump only for package @loopback/rest

0.25.3 (2018-10-03)

Performance Improvements

  • improve schema validation peformance (353b202)

0.25.2 (2018-09-28)

Note: Version bump only for package @loopback/rest

0.25.1 (2018-09-27)

Note: Version bump only for package @loopback/rest

0.25.0 (2018-09-25)

Bug Fixes

  • rest: coerce string parameters (reject object values) (1f49844)

Features

  • builders for Filter and Where schemas (ca8d96e)
  • cli: add responses for PingController.ping() (ec52b89)
  • rest: allow controller methods to handle response writing (2bfd50e)

0.24.0 (2018-09-21)

Features

  • testlab: add createRestAppClient(), simplify usage in tests (d75be77)
  • testlab: set port to 0 in givenHttpServerConfig (90a0bfb)

0.23.0 (2018-09-19)

Bug Fixes

  • rest: return 404 when a model was not found (7a56bad)

Features

  • rest: add error codes for REST validation errors (1762765)
  • rest: set status code to 204 when body is undefined (047efcb)

0.22.2 (2018-09-14)

Note: Version bump only for package @loopback/rest

0.22.1 (2018-09-14)

Bug Fixes

  • rest: make sure validation system error is reported (fe4fe16)

0.22.0 (2018-09-14)

Features

  • openapi-v3: add support for openapi responses (0ecaecd)

0.21.1 (2018-09-12)

Bug Fixes

  • rest: tidy up host/port parsing and client url building (b692f45)

0.21.0 (2018-09-10)

Bug Fixes

  • rest: use direct import to work around a TS bug (2cf3b2c)

Features

  • rest: make servers configurable for openapi specs (99b80a9)

0.20.0 (2018-09-08)

Bug Fixes

  • remove extra imports for mixin dependencies (35b916b)
  • rest: use strong-error-handler for writing errors to the response body (ac011f8)

Features

  • rest: allow static assets to be served by a rest server (a1cefcc)
  • coerce object arguments from query strings (d095693)

0.19.6 (2018-08-25)

Note: Version bump only for package @loopback/rest

0.19.5 (2018-08-24)

Bug Fixes

  • openapi-v3: set required to true for path parameters (2b13247)

0.19.4 (2018-08-15)

Bug Fixes

  • rest: set openapi url based on x-forwarded-* headers (8706038)

0.19.3 (2018-08-08)

Note: Version bump only for package @loopback/rest

0.19.2 (2018-07-21)

Note: Version bump only for package @loopback/rest

0.19.1 (2018-07-20)

Note: Version bump only for package @loopback/rest

0.19.0 (2018-07-20)

Features

  • add HTTPs protocol support (6941a5d)

0.18.0 (2018-07-13)

Features

  • localize error in details (3c9f6b4)

0.17.1 (2018-07-11)

Note: Version bump only for package @loopback/rest

0.17.0 (2018-07-10)

Features

  • add tests for array and object (57b968a)
  • rest: add url property (18b3408)

0.16.0 (2018-07-09)

Features

0.15.1 (2018-06-28)

Note: Version bump only for package @loopback/rest

0.15.0 (2018-06-27)

Features

  • add listening property in the server interface (ff0eab7), closes #1368

0.14.1 (2018-06-26)

Note: Version bump only for package @loopback/rest

0.14.0 (2018-06-25)

Features

  • coercion for more types (2b4b269)

0.13.0 (2018-06-25)

Features

  • coercion for more types (2b4b269)

0.12.0 (2018-06-20)

Bug Fixes

  • rest: stop an app that has not been started (1841ebb), closes #822

Features

0.11.3 (2018-06-11)

Note: Version bump only for package @loopback/rest

0.11.2 (2018-06-09)

Note: Version bump only for package @loopback/rest

0.11.1 (2018-06-09)

Note: Version bump only for package @loopback/rest

0.11.0 (2018-06-08)

Bug Fixes

  • make the code compatible with TypeScript 2.9.x (37aba50)

Features

  • add http-server package (bac8d8c)

0.10.5 (2018-05-28)

Note: Version bump only for package @loopback/rest

0.10.4 (2018-05-20)

Note: Version bump only for package @loopback/rest

0.10.3 (2018-05-14)

Bug Fixes

  • change index.d.ts files to point to dist8 (42ca42d)

0.10.2 (2018-05-14)

Note: Version bump only for package @loopback/rest

0.10.1 (2018-05-08)

Note: Version bump only for package @loopback/rest

0.10.0 (2018-05-03)

Features

  • context: allow tags to have an optional value (95acd11)
  • add helper package “dist-util” (532f153)

0.9.0 (2018-05-03)

Features

  • context: allow tags to have an optional value (95acd11)
  • add helper package “dist-util” (532f153)

0.8.1 (2018-04-26)

Note: Version bump only for package @loopback/rest

0.8.0 (2018-04-25)

Features

  • upgrade to openapi3-ts@0.11.0 (1ed79c9)

0.7.0 (2018-04-16)

Note: Version bump only for package @loopback/rest

0.6.3 (2018-04-16)

Note: Version bump only for package @loopback/rest

0.6.2 (2018-04-12)

Note: Version bump only for package @loopback/rest

0.6.1 (2018-04-11)

Note: Version bump only for package @loopback/rest

0.6.0 (2018-04-11)

Bug Fixes

  • change file names to fit advocated naming convention (0331df8)

Features

  • context: typed binding keys (685195c)
  • rest: add typing for controller instance/class/factory (a1cbab3)
  • rest: allow factory for controller routes (184371b)

0.5.3 (2018-04-06)

Note: Version bump only for package @loopback/rest

0.5.2 (2018-04-04)

Note: Version bump only for package @loopback/rest

0.5.1 (2018-04-02)

Note: Version bump only for package @loopback/rest

0.5.0 (2018-03-29)

Note: Version bump only for package @loopback/rest

0.4.1 (2018-03-23)

Note: Version bump only for package @loopback/rest

0.4.0 (2018-03-21)

Features

  • rest: expose app.requestHandler function (20a41ac)

BREAKING CHANGES

  • rest: RestServer#handleHttp was renamed to RestServer#requestHandler.

0.3.4 (2018-03-14)

Note: Version bump only for package @loopback/rest

0.3.3 (2018-03-13)

Note: Version bump only for package @loopback/rest

0.3.2 (2018-03-08)

Bug Fixes

0.3.1 (2018-03-07)

Bug Fixes

  • rest: enable cors preflight (d05bdae)

0.3.0 (2018-03-06)

Bug Fixes

Features

  • upgrade from swagger 2 to openapi 3 (71e5af1)

0.2.0 (2018-03-01)

Note: Version bump only for package @loopback/rest

0.1.2 (2018-03-01)

Bug Fixes

  • rest: log unexpected errors to console (#1058) (b7b0fd8)
  • rest: make the route binding key friendly for find (e3577ab)

Features

  • context: add type as a generic parameter to ctx.get() and friends (24b217d)

BREAKING CHANGES

  • context: ctx.get() and ctx.getSync() require a type now. See the example below for upgrade instructions:
- const c: MyController = await ctx.get('MyController');
+ const c = await ctx.get<MyController>('MyController');

isPromise was renamed to isPromiseLike and acts as a type guard for PromiseLike, not Promise. When upgrading affected code, you need to determine whether the code was accepting any Promise implementation (i.e. PromiseLike) or only native Promises. In the former case, you should use isPromiseLike and potentially convert the userland Promise instance to a native Promise via Promise.resolve(promiseLike). In the latter case, you can replace isPromise(p) with p instanceof Promise.

0.1.1 (2018-02-23)

Bug Fixes

  • context: fix optional param injection for methods (801a82d)

0.1.0 (2018-02-21)

Features

  • rest: app.route() and app.api() (5c3fd62)

4.0.0-alpha.26 (2018-02-15)

Note: Version bump only for package @loopback/rest

4.0.0-alpha.25 (2018-02-07)

build

BREAKING CHANGES

  • Support for Node.js version lower than 8.0 has been dropped. Please upgrade to the latest Node.js 8.x LTS version.

Co-Authored-by: Taranveer Virk taranveer@virk.cc

4.0.0-alpha.24 (2018-02-04)

Bug Fixes

  • remove console output from tests (ff4a320)

4.0.0-alpha.23 (2018-01-30)

Features

  • repository-json-schema: add in top-level metadata for json schema (#907) (fe59e6b)

4.0.0-alpha.22 (2018-01-29)

Note: Version bump only for package @loopback/rest

4.0.0-alpha.21 (2018-01-26)

Note: Version bump only for package @loopback/rest

4.0.0-alpha.20 (2018-01-26)

Bug Fixes

  • rest: correctly re-export decorators at runtime (c81c0ac)
  • rest: fix assertion broken by new deps versions (05a8e0c)
  • rest: fix yaml comparison to tolerate textual diffs (615882c)
  • apply source-maps to test errors (76a7f56), closes #602
  • make mocha self-contained with the source map support (7c6d869)

Features

  • rest: enable dependency injection for controller methods (72afddd)

4.0.0-alpha.19 (2018-01-19)

Bug Fixes

  • rest: export decorators for backward compatibility (#850) (5166388)

4.0.0-alpha.18 (2018-01-11)

Bug Fixes

  • fix imports to use files owning the definitions (a50405a)

4.0.0-alpha.17 (2018-01-03)

Bug Fixes

4.0.0-alpha.16 (2018-01-03)

Features

4.0.0-alpha.15 (2017-12-21)

Features

  • rest: Improve decorators to infer param types (37d881f)
  • rest: Single-server RestApplication (80638b4)

4.0.0-alpha.14 (2017-12-15)

Features

  • Expose reflectors via MetadataInspector (5e6829f)
  • Refactor REST decorators to use factories (d03adf7)

4.0.0-alpha.13 (2017-12-11)

Bug Fixes

  • Fix node module names in source code headers (0316f28)
  • rest: Fix compilation error caused by @types/node (89f1401)

4.0.0-alpha.12 (2017-12-01)

Bug Fixes

4.0.0-alpha.11 (2017-11-30)

Note: Version bump only for package @loopback/rest

4.0.0-alpha.10 (2017-11-29)

Bug Fixes

  • rest: Fix parameter description (c3e6afc)
  • rest: Improve rest metadata inheritance (3f124f3)
  • rest: Listen on all interfaces if host is not configured (99daf63)
  • rest: Remove unused imports (76a08ee)

4.0.0-alpha.9 (2017-11-14)

Features

  • rest: Make rest host and explorer configurable (caa2598)

4.0.0-alpha.8 (2017-11-09)

Bug Fixes

  • rest: Tidy up rest decorator metadata (7d15bfe)

Features

  • rest: Improve http error handling (15d04fa)
  • rest: Improve result serialization for http (d5bc53e)

4.0.0-alpha.7 (2017-11-06)

Note: Version bump only for package @loopback/rest

4.0.0-alpha.6 (2017-10-31)

Note: Version bump only for package @loopback/rest

4.0.0-alpha.5 (2017-10-31)

Note: Version bump only for package @loopback/rest

4.0.0-alpha.4 (2017-10-25)

Bug Fixes

  • rest: Add index boilerplate (02a025e)
  • rest: convert primitives to strings (2e1ca13)
  • rest: Move server instantiation to class definition (051b8e0)
  • testlab: Remove sinon-should integration (8841fce)

Code Refactoring

  • core: Component servers are now key-value pairs (866953a)

BREAKING CHANGES

  • core: Components must now provide key-value pairs in an object called “servers”.