validator icon indicating copy to clipboard operation
validator copied to clipboard

feat: validate cookies and headers

Open Melchyore opened this issue 1 year ago • 2 comments

Proposed changes

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • [x] I have read the CONTRIBUTING doc
  • [x] Lint and unit tests pass locally with my changes
  • [x] I have added tests that prove my fix is effective or that my feature works.
  • [ ] I have added necessary documentation (if appropriate)

Further comments

Since we can append the route parameters to the validator schema, I assume we can do the same for cookies and headers, plus, it prevents some injections and make it easy for users to write smaller controllers' methods. In addition to that, I'm currently working on a module to generate Swagger/OpenAPI information automatically and in the latter, we can add parameters' location: https://spec.openapis.org/oas/v3.1.0#parameterIn, so it will help me a lot to generate the correct location automatically and users won't have to do it manually.

If this PR is merged, I'll add the necessary documentation + document the params property in schema that can be used (currently new comers are lost, because they don't know how to validate route parameters using validators as it's not mentioned on the docs).

Thank you!

Melchyore avatar Jul 18 '23 14:07 Melchyore

Any news on this, please?

Melchyore avatar Oct 09 '23 09:10 Melchyore

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 15 '23 07:12 stale[bot]