Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response validation modifies payload #1639

Closed
hueniverse opened this issue May 18, 2014 · 2 comments
Closed

Response validation modifies payload #1639

hueniverse opened this issue May 18, 2014 · 2 comments
Assignees
Milestone

Comments

@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented May 18, 2014

Unlike input validation, responses should not be modified to comply with validation rules (e.g. casting a string to a number).

@hueniverse hueniverse added this to the 5.0.0 milestone May 18, 2014
@hueniverse hueniverse added the bug label May 18, 2014
@hueniverse hueniverse self-assigned this May 18, 2014
@worklez
Copy link

@worklez worklez commented Jun 15, 2014

Would it be a valid use case to allow response objects to be stripped by validator? Consider following scenario:

  1. Server is configured with validation: { stripUnknown: true }
  2. Route config has its response: { schema: Joi... } specified
  3. Request handler retrieves a doc which has more keys than needed for the response, but otherwise its satisfies the schema; and calls reply(doc).

As of now, validation would succeed but the response would contain full set of keys, including those not matched by the validator.

This commit Qey@0bb2152 enables response modifications but they're not restricted to stripping.

@hueniverse
Copy link
Contributor Author

@hueniverse hueniverse commented Jun 16, 2014

Open a new issue requesting this feature. I'll consider it.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants