OpenAPI specs through Nitro

I'm trying to set up OpenAPI specs generation through Nitro but when I open http://localhost:3000/_nitro/swagger I get stuck at:
Unable to render this definition
The provided definition does not specify a valid version field.

Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).

I'm trying to resolve this by specifying the version in nuxt.config.ts as:
    experimental: {
      openAPI: true,
    },
    openAPI: {
      meta: {
        title: 'Nitro Test Fixture',
        description: 'Nitro Test Fixture API',
        version: '2.0',
      },
    },

But openAPI at root level gives type error:
Object literal may only specify known properties, and 'openAPI' does not exist in type '{ extends?: string | ... | (() => NitroConfig) | (string | undefined)[] | undefined; routeRules?: { [x: string]: { cache?: false | { base?: string | undefined; swr?: boolean | undefined; ... 6 more ...; varies?: (string | undefined)[] | undefined; } | undefined; ... 8 more ...; appMiddleware?: "auth" | ... 2 more .....'.ts(2353)


http://localhost:3000/_nitro/openapi.json lists all the endpoints and starts with:
{
  "openapi": "3.1.0",
  "info": {
    "title": "Nitro Server Routes",
    "version": null
  },


How do I correctly generate the specs?
Was this page helpful?