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

feat: custom schema applied on errors #2691

Merged
merged 13 commits into from
Nov 29, 2020
Merged

Conversation

Eomm
Copy link
Member

@Eomm Eomm commented Nov 16, 2020

Closes #2687

Opening draft PR to get feedback since I think a spread operator in the hot path is not a good idea at all.

I'm thinking if there is a better solution and right now I thought that I should write this logic:

if there is a user response schema, use the spread operator.
Otherwise, build the previous code sentence

Checklist

lib/reply.js Outdated Show resolved Hide resolved
lib/validation.js Outdated Show resolved Hide resolved
test/hooks.test.js Outdated Show resolved Hide resolved
@Eomm Eomm marked this pull request as ready for review November 17, 2020 21:47
@mcollina mcollina added the semver-minor Issue or PR that should land as semver minor label Nov 20, 2020
test/hooks.test.js Outdated Show resolved Hide resolved
@mcollina
Copy link
Member

This is ok! Should we document this?

@Eomm
Copy link
Member Author

Eomm commented Nov 21, 2020

This is ok! Should we document this?

Right!
Added

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great feature. LGTM

@Eomm Eomm requested a review from jsumners November 23, 2020 20:50
docs/Reply.md Outdated Show resolved Hide resolved
lib/reply.js Show resolved Hide resolved
lib/reply.js Show resolved Hide resolved
lib/reply.js Show resolved Hide resolved
Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lib/reply.js Outdated Show resolved Hide resolved
Co-authored-by: James Sumners <james@sumners.email>
@mcollina mcollina merged commit 43ea177 into fastify:master Nov 29, 2020
@github-actions
Copy link

github-actions bot commented Feb 5, 2022

This pull request 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 github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
semver-minor Issue or PR that should land as semver minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom error properties via schemas
4 participants