omermecitoglu / next-openapi-json-generator

a Next.js plugin to generate OpenAPI documentation from route handlers
MIT License
1 stars 1 forks source link

A quick start option without a Route Handler, based on JSDoc? #1

Open dmythro opened 3 months ago

dmythro commented 3 months ago

Hi. Found this, looks cool.

But for starters (and existing project with a lot of routes) it would be great to generate a spec simply based on standard Next.js route.ts handlers and JSDoc. It would be really cool.

I checked Route Handler as well, looks pretty useful. But migration would take a lot of time and I need a quicker solution for now over my plain Next.js app codepase to at least list all API endpoints (and use some data from JSDoc if possible).

Does it make sense?

omermecitoglu commented 3 months ago

Yea, I hear you. You've got a point. When I was migrating for myself, I've done that manually and it was a real pain. I think I can make a route generator from a swagger.json but not JSdoc. I'm really done with JSdoc after that migration.

gvzq commented 3 months ago

@dmythro take a look at https://github.com/jellydn/next-swagger-doc. It might be closer to what you're looking for. Note that you will need to use @openapi tags to add the endpoint spec in a way that looks like a open api yaml file.

dmythro commented 2 months ago

@dmythro take a look at https://github.com/jellydn/next-swagger-doc. It might be closer to what you're looking for. Note that you will need to use @openapi tags to add the endpoint spec in a way that looks like a open api yaml file.

Thanks! I did check that before and not really a solution I'd look at. Mainly, it doesn't really utilise app routing and you have to specify routes manually for each request handler. Plus, this @swagger thing is required. And for existing project with a lot of APIs is exhausting to migrate to.