cloudflare / chanfana

OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router and more!
https://chanfana.pages.dev
MIT License
288 stars 38 forks source link

Nested router "No operations defined in spec" #51

Closed ghost closed 1 year ago

ghost commented 1 year ago

Same as #30

Have tried setting up nested router (as I often do in itty-router) and while this works, I still see "No operations defined in spec!" when viewing /docs.

I've tested this on both my own projects and with the tasks example from Cloudflare Workers SDK which is at https://github.com/jasiqli/tasks-openapi-issue


Related to this, the example 7. Nested Routers shows

router.all('/api/v1/attacks/*', attacksRouter)

however I find this generates a "c is not function" error and the only way it will work (as with itty-router) is

router.all('/api/v1/attacks/*', attacksRouter.handle)
G4brym commented 1 year ago

Hey @jasiqli i've cloned your https://github.com/jasiqli/tasks-openapi-issue, and solved the issue by upgrading to the latest version of itty-router-openapi

ghost commented 1 year ago

Thanks @G4brym. Seems to work a treat 🎉