Skip to content

@response(204, ... ) will not create the same type of response as schema definition. #4841

@AlexDM0

Description

@AlexDM0

Steps to reproduce

Current Behavior

If I want to use decorators for response, I cannot seem to get a correct 204 in the explorer.

If I use the schema definition:

  @post('/example', {responses: {204: { description: "Hello world"}}})
  example(
    @param.query.number("test") test : number,
  ) : void {
    // do something
  }

I get a clean 204 in the explorer:

Code | Description | Links
-- | -- | --
204 | Hello world

If I use the decorator however:

 @post('/example')
  @response(204, {description:"Hello world"})
  example(
    @param.query.number("test") test : number,
  ) : void {
    // do something
  }

I get the typeselector for the response:

Code | Description | Links
204 | No ContentMedia typeapplication/jsonControls Accept header.Example ValueSchema(no example available)

Since I cannot stack the @response decorators once I use the schema as described above, I can't easily compose my responses if the default return type is 204.

Finally, if I define no schema and no response decorator, the default return code is 200 which should be success with data instead of 204, which would make more sense if no data return type has been specified.

Expected Behavior

Link to reproduction sandbox

This works with the simple lb4 app empty project and a controller with that endpoint. Look at the explorer to see the difference.

Additional information

None required.

Related Issues

I searched for 204 but I could not find anything similar.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions