-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
Validator does not work with express router #65
Comments
Looks like the validator middleware only gets pushed onto the app not the routes:
I imagine this is the issue. |
ok wow, did more digging and it turns out that the order in which the middlewares are added matters
|
Let me know if you'd like me to open up a pr to talk about this in the documentation |
I believe the issue is the fact in the second example (Does not validate), the Assuming this is the case, perhaps, a note should be added to the documentation. Note that I can certainly have the validator install the parser middleware automatically, however I feel the choice of parser should be left to the user and not to the library. |
@SpencerLawrenceBrown i've added some notes to the doc. feel free to provide feedback. thanks! |
I am not sure if this is a feature request or a bug, but the validator does not validate requests and responses to/from express routers.
When I originally set up my app, all of my routes lived in the app.ts file and were being validated correctly.
app.ts
however I am going to have a lot of routes + middlewares and want to use express routers to split them up. So I split my routes to use a router and the validator stopped working:
app.ts
api/progress.ts
Furthermore I tried to install the routers to the
OpenApiValidator
but it only acceptsApplications
.Am I missed a configuration step or are routers not supported currently? If they are not, is there timeline for when they would be supported?
Is there another workaround for this?
thank you!
The text was updated successfully, but these errors were encountered: