nitro icon indicating copy to clipboard operation
nitro copied to clipboard

swagger API

Open pi0 opened this issue 2 years ago • 2 comments

expose swagger compatible API from dev server based on handler defenitions.

pi0 avatar Feb 09 '22 21:02 pi0

~~Not a periority~~ (reopened following up https://github.com/unjs/nitro/discussions/170)

Related:

  • https://github.com/nuxt/framework/discussions/4582

pi0 avatar Apr 06 '22 16:04 pi0

Quoting from https://github.com/nuxt/framework/discussions/4582:

[..] swagger UI is a great feature for newcomers, product managers and smoke-testing (:

So would really love to see this - with the correct pointers I'd even try myself on it, but am unsure if this is a good first issue.

BracketJohn avatar Jun 01 '22 07:06 BracketJohn

Is the whole /server/api of Nuxt 3 mostly handled by nuxt or nitro? ...if nitro only has access to the routes and url arguments but not the return type or similar it would make little sense to implement it inside nitro.

Or generally: Is there any access to the route definitions and types during runtime in either nitro or nuxt? I would think so as nuxt generates .d.ts file on the fly based on my understanding so far but I might be wrong. If that is the case than that could be used to generate them and potentially expose them on a special endpoint, kinda like FastAPI does.

septatrix avatar Oct 25 '22 20:10 septatrix

Is there any more work being done on this? Could it be possible to export a json schema or zod type to reflect what the endpoint is returning in the OpenAPI spec?

sannajammeh avatar Nov 02 '23 13:11 sannajammeh

Currently it is exposed via experimental flag as /_nitro/openapi.json. So you can use it already.

It is in our roadmap after introducing route meta support to improve this feature and iterate.

pi0 avatar Nov 02 '23 17:11 pi0

how can you modify the tags?

MrlolDev avatar Jan 06 '24 20:01 MrlolDev

is there any way to support nested route. Api need to be grouped in most case.

chenyuncai avatar Mar 08 '24 12:03 chenyuncai

@chenyuncai feel free to open new individual issue for it 👍🏼 (or any other idea related to openapi)

pi0 avatar Mar 08 '24 12:03 pi0