nitrojs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.build
MIT License
6.23k stars 513 forks source link

update open api docs #2867

Closed de-n3xus closed 1 day ago

de-n3xus commented 2 days ago

Environment

Node Version: v20.16.0 Nitro Version: v2.10.4

Reproduction

Go to https://stackblitz.com/edit/github-fvcvgg?file=nitro.config.ts and try to open /_nitro/openapi.json /_nitro/scalar /_nitro/swagger

Describe the bug

Nitro config has enabled openAPI in experimental section, but openapi routes is not found Nothing in logs

/server/api/test.ts contains this

defineRouteMeta({
  openAPI: {
    tags: ["test"],
    description: "Test route description",
    parameters: [{ in: "query", name: "test", required: true }],
  },
});

export default defineEventHandler(() => "OK");

Additional context

No response

Logs

No response

de-n3xus commented 2 days ago

omg https://github.com/nitrojs/nitro/blob/8c934c93ac29bf016858a0a6eff56504821c7b34/src/core/config/resolvers/open-api.ts#L24 https://github.com/nitrojs/nitro/blob/8c934c93ac29bf016858a0a6eff56504821c7b34/src/core/config/resolvers/open-api.ts#L34 https://github.com/nitrojs/nitro/blob/8c934c93ac29bf016858a0a6eff56504821c7b34/src/core/config/resolvers/open-api.ts#L45

why its not in docs...

Exotelis commented 1 day ago

omg

why its not in docs...

You should leave this issue open. I've been scratching my head in confusion for the past two hours.

Thank you for the post, you saved me a lot of time.

de-n3xus commented 1 day ago

omg why its not in docs...

You should leave this issue open. I've been scratching my head in confusion for the past two hours.

Thank you for the post, you saved me a lot of time.

ok i opened it

Exotelis commented 1 day ago

I opened https://github.com/nitrojs/nitro/pull/2869

pi0 commented 1 day ago

Thanks for docs PR. Please note that the defaults and behavior might change while this feature is in experimental state (we communicate them via release notes)

Exotelis commented 1 day ago

Thanks for docs PR. Please note that the defaults and behavior might change while this feature is in experimental state (we communicate them via release notes)

This is absolutely fine, but please ensure the documentation stays up to date. It becomes challenging to use features and contribute effectively if the docs are outdated.