adonisjs / validator

Schema based validator for AdonisJS
MIT License
115 stars 40 forks source link

feat: validate cookies and headers #171

Open Melchyore opened 1 year ago

Melchyore commented 1 year ago

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

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.

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 commented 11 months ago

Any news on this, please?

stale[bot] commented 9 months ago

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.