Inversifyjs: inversify-express-utils (5.2.2): @requestBody and other decorators do not take in a parameter anymore

Created on 16 Apr 2018  路  3Comments  路  Source: inversify/InversifyJS

With the release of inversify-express-utils (5.2.2), decorators like @requestBody do not take in parameters anymore.

Expected Behavior

As per the documentation here, these decorators should accept a parameter name and behave according to the said documentation.

Current Behavior

@requestBody(name) returns the full request body during runtime, even when the name is passed in.
During build with TypeScript, existing codebases get the following build error (if enabled):

error TS2554: Expected 0 arguments, but got 1.

This points to the location in code where @requestBody is used.

Possible Solution

I'm not familiar with the codebase myself, but reverting back to the earlier implementation seems like a possible solution.

The file in question seems to be this.

Steps to Reproduce (for bugs)

  1. Use @requestBody decorator in one of the controllers with name as a parameter
  2. Freeze inversify-express-utils version in package.json to 5.2.2
  3. Try to build the app (in case of TypeScript) OR...
  4. Run the app and hit the specific endpoint

Context

This issue was caused by a patch version upgrade. In our case, it worked perfectly fine in one environment but not in the other. This caused havoc during the release. Please mention breaking changes like these in the release notes. Also, please do not release breaking changes like this in the form of a patch.

Environment

  • Version used: 5.2.2
  • Environment name and version: v6.12.3
  • Operating System and version (desktop or mobile): macOS Sierra 10.12.6

Stack trace

TypeScript Build Output:
error TS2554: Expected 0 arguments, but got 1.

Most helpful comment

@ashraymehta You are correct. This should not have been released as a patch and the docs were not updated. My fault. I am sorry for all the trouble

All 3 comments

@ashraymehta You are correct. This should not have been released as a patch and the docs were not updated. My fault. I am sorry for all the trouble

@ashraymehta @AltekkeE I have released 6.0.0. You can rollback to 5.2.1 or upgrade to 6.0.0. Sorry for any inconvenience caused.

Upgrading to 6.0.0 doesn't seem to solve the problem. requestBody implementation doesn't change from 5.2.2 to 6.0.0. Is the decision to get rid of 'name' parameter intentional/permanent?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rashtao picture rashtao  路  3Comments

RastriginSergey picture RastriginSergey  路  3Comments

stjepangolemac picture stjepangolemac  路  5Comments

remojansen picture remojansen  路  4Comments

matthewjh picture matthewjh  路  3Comments