-
Notifications
You must be signed in to change notification settings - Fork 370
swagger-validator performance improvement ideas #394
Comments
Thanks a lot for your feedback. I'll make sure to use this for https://github.com/apigee-127/sway |
By looking into project sway, is sway going to replace the validation logic inside swagger-tools in the future? |
#335 explains what is going on. Read this and let me know if things are more clear. |
glad to know, thanks for your hard-work! |
Seems good. Thank you. What's the status of Sway now? Can it be used for new API projects? |
Sway is ready as an API but the middleware part (https://github.com/whitlockjc/sway-connect) is not yet complete. So if you use swagger-tools' API, Sway is a much better alternative. But if you use the swagger-tools middleware, the replacement is not complete yet. |
I'm using swagger-tools middleware. Will it be easy to switch to sway-connect when it's ready in the future? |
I did some performance diagnostic in swagger-tools, and I found that, for a request, the most time spending module in the API infrastructure is the validator middleware. By looking into the call stack, most of the time is spending in helpers.js#L59.
For this simple schema:
It still takes about 1ms for it. (Comparing to the fact that all other stacks take 1ms.)
By looking into the doc of ZSchema, I cannot find any description about caching the complied schema.
Further, I also found that other projects doing similar jobs seem to have a better performance.
And Ajv is providing support for caching the compiled schema.
I am new to swagger-tools, so I don't know if there is some other considerations in choosing of ZSchema (If have, would you like to give some information here?). But for my research, if there is no special consideration, I think it's good to replace it by Avj, which may improve the performance.
Thanks!
The text was updated successfully, but these errors were encountered: