unjs / nitro

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

nitro.experimental.openAPI doesn't accept a json configuration like the documentation highlights. #2632

Closed jonasfroeller closed 2 months ago

jonasfroeller commented 2 months ago

Environment

NodeJS: v18.19.0 Nitro: version that nuxt ^3.12.3 uses

Reproduction

nitro: {
    imports: {
      dirs: ['./server/utils'],
    },
    experimental: {
      openAPI: {
        meta: {
          title: 'Nuxai API Documentation',
          description: 'Chat with different AI models using this REST-API.',
          version: '0.0.0',
        }
      },
    },
};    
 ERROR(vue-tsc)  Type '{ meta: { title: string; description: string; version: string; }; }' is not assignable to type 'boolean | undefined'.
 FILE  A:/xxx/nuxt.config.ts:27:7

    25 |     },
    26 |     experimental: {
  > 27 |       openAPI: {
       |       ^^^^^^^
    28 |         meta: {
    29 |           title: 'API Documentation',
    30 |           description: '',

Describe the bug

This doesn't actually work (https://nitro.unjs.io/config#experimental):

image

Additional context

No response

Logs

No response

manniL commented 2 months ago

Because https://github.com/unjs/nitro/pull/2299 didn't land yet. You can try it in the nightly release though.

jonasfroeller commented 2 months ago

Because #2299 didn't land yet. You can try it in the nightly release though.

Thank you for the quick response!
I was confused, because the docs just said the scalar implementation is in nightly and not the openapi stuff. But makes sense. image