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

RequestValidator.validate uses req.originalUrl #242

Closed
jtinbergen opened this issue Feb 25, 2020 · 2 comments
Closed

RequestValidator.validate uses req.originalUrl #242

jtinbergen opened this issue Feb 25, 2020 · 2 comments

Comments

@jtinbergen
Copy link

This results in a lot of cache entries in the middlewareCache because all the parameter values are taken into consideration too.

/customer/1234/detail/1289
/customer/1235/detail/1288

These two calls with the same method and content type create two entries in the cache. Perhaps the openAPI url definition /customer/{something}/detail/{somthingelse} would be a better key?

@cdimascio
Copy link
Owner

cdimascio commented Feb 25, 2020

@jtinbergen thanks. This should get fixed. I like your proposal.
When openapi.request.validator.ts builds up the middleware cache, it has access to the req.opeanpi object. This contains

 {expressRoute: "/v1/pets/:id", openApiRoute: "/v1/pets/{id}", ...}

Either seems like a good candidate to replace originalUrl here

i'll plan to look at this in the coming days. In the meantime, if you're up to it, feel free to experiment as well. PRs are certainly welcome.

cdimascio pushed a commit that referenced this issue Feb 25, 2020
cdimascio added a commit that referenced this issue Feb 25, 2020
@cdimascio
Copy link
Owner

@jtinbergen this should be fixed in 3.9.0. let me know how it goes. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants