docs.nestjs.com icon indicating copy to clipboard operation
docs.nestjs.com copied to clipboard

docs(guards): Add missing imports and fix information content

Open Daniel-Yonkov opened this issue 2 years ago • 5 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our guidelines: https://github.com/nestjs/docs.nestjs.com/blob/master/CONTRIBUTING.md

PR Type

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [x] Docs
  • [ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

Daniel-Yonkov avatar May 26 '22 09:05 Daniel-Yonkov

I feel that the line import { validateRequest } from 'custom-authorization' could confuse people. What if someone publish a package called custom-authorization?

Also, the snippet below @@switch line is the JS version.

Modified the example import statement towards local file which should not prevent confusion in the readers. Also moved the definition of the request in the typescript version (before the @@switch)

Daniel-Yonkov avatar May 27 '22 15:05 Daniel-Yonkov

could you please fix L11 as well?

https://github.com/Daniel-Yonkov/docs.nestjs.com/blob/cc470436fde8189e56a58d30a3d55f4a647af5e5/content/guards.md?#L11

should be

> info **Hint** Guards are executed **all** middleware, but **before** any interceptor or pipe.

micalevisk avatar Jun 13 '22 18:06 micalevisk

@micalevisk

> info **Hint** Guards are executed **all** middleware, but **before** any interceptor or pipe.

I am not sure I understand what is implied in this info - Does this mean that Guards are executed after all middleware or before them or are executed before/after the middleware defined in a dependency chain during runtime?

Daniel-Yonkov avatar Jun 14 '22 13:06 Daniel-Yonkov

@Daniel-Yonkov my bad, should be:

> info **Hint** Guards are executed **after** all middlewares, but **before** any interceptor or pipe. More on this [here](https://docs.nestjs.com/faq/request-lifecycle#summary).

micalevisk avatar Jun 14 '22 13:06 micalevisk

@micalevisk - Addressed

Daniel-Yonkov avatar Jun 14 '22 15:06 Daniel-Yonkov