routing-controllers icon indicating copy to clipboard operation
routing-controllers copied to clipboard

question: Can we customize the response body using auto validating action parameters?

Open RieUchdia opened this issue 1 year ago • 2 comments

Hello, I want to remove "stuck" and "errors" from the response body created by auto validating action parameters. How to customize the response body created by auto validating action parameters? Here is the auto-generated response body.

{
"name": "BadRequestError",
"message": "Invalid queries, check 'errors' property for more info.",
"stack": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"errors": [
  {"target": {"userId": 1111},"value": 1111,"property": "userId","children": [],"constraints": {"max": "userId must not be greater than 1000"}}
],
"paramName": ""
}

Thank you

RieUchdia avatar Aug 04 '22 17:08 RieUchdia

@RirUchida the stack property should only be added if your node env is not prod. Could you please check if setting it helps?

attilaorosz avatar Aug 06 '22 05:08 attilaorosz

I was able to remove the stack property with this setting. Tahnk you.

const app = createExpressServer({
  development: false, 
});

RieUchdia avatar Aug 09 '22 14:08 RieUchdia

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Dec 13 '22 00:12 github-actions[bot]