nest
nest copied to clipboard
feat(fastify): add decorator for custom schema
Add an ability to attach json schema to request with a RequestSchema decorator
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [x] Tests for the changes have been added (for bug fixes / features)
- [x] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
What is the current behavior?
Currently, there is no easy way of using fastify's schema property and adding a response schema can have positive impact on performance source
Issue Number: N/A
What is the new behavior?
This PR adds a new decorator RequestSchema that takes a schema object and sets it as schema property on fastify route doc
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Pull Request Test Coverage Report for Build 4564b87f-2f8f-4f0f-8778-fcf6b60673ff
Details
- 5 of 5 (100.0%) changed or added relevant lines in 2 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.007%) to 88.93%
| Totals | |
|---|---|
| Change from base Build c493f148-f1dd-4b7d-a940-d13270fde234: | 0.007% |
| Covered Lines: | 7182 |
| Relevant Lines: | 8076 |
💛 - Coveralls
This should include some documentation on how to use it.
Oh, and it should have example usage in the fastify example.
LGTM