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

Set matched path in ctx or ctx.request #28

Open
johandalabacka opened this issue Dec 26, 2019 · 2 comments
Open

Set matched path in ctx or ctx.request #28

johandalabacka opened this issue Dec 26, 2019 · 2 comments

Comments

@johandalabacka
Copy link

johandalabacka commented Dec 26, 2019

Hi

I'm trying to rewrite an application I have in express to use koa instead. The package I use for express express-openapi-validator it sets the matched partial schema from the open api - specification (with operationId, tags and params) in the request. I can then use a small middleware to call the right controller and method by using the tags and operationId of the scema from the request (req.openapi.schema)

I have tried to find something similar here but no luck so far. Have I missed something?

@supertong
Copy link
Collaborator

Hey, the koa-oas3 identifies the schema path by using the combination of the request method and request path.
There is a way to trigger a validation by using an operational in https://github.com/atlassian/oas3-chow-chow library which koa-oas3 using under the hood.
Not sure if that answers your question.

@johandalabacka
Copy link
Author

Thanks for answer but I was interested if koa-oas3 leave some info about which path it selected then doing the validation. This is because I want to use this information to call the correct method depending on value of operation-id. Otherwise I also have to resolve the path and it is done two times.

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