blomqma / next-rest-framework

Type-safe, self-documenting APIs for Next.js
https://next-rest-framework.vercel.app
Other
136 stars 18 forks source link

Texts are not changing when using `docsConfig` in `defineDocsRoute` function #83

Closed momegas closed 11 months ago

momegas commented 11 months ago

This code:

export const GET = defineDocsRoute({
  autoGenerateOpenApiSpec: true,
  docsConfig: {
    title: 'Squaredev API',
    description: 'Squaredev API',
    logoUrl: 'https://squaredev.io/wp-content/uploads/2022/08/Squaredev-B2.png',
  },
});

Results in this docs page.

Screenshot 2023-10-17 at 3 42 09 PM

The expected results is that the texts should be changing.

blomqma commented 11 months ago

The docsConfig values only change the HTML meta tag values of the generated docs frontend. You can override the texts using the openApiSpecOverrides config option which changes the generated openapi.json spec, so your config should look something like this:

export const GET = defineDocsRoute({
  openApiSpecOverrides: {
    info: {
      title:'Squaredev API',
      description: 'Squaredev API',
    }
  },
  docsConfig: {
    title: 'Squaredev API',
    description: 'Squaredev API',
    logoUrl: 'https://squaredev.io/wp-content/uploads/2022/08/Squaredev-B2.png',
  },
});

I do admit though that this is a bit confusing, so maybe I could simplify these options a bit.

blomqma commented 11 months ago

This should be fixed in the latest release, the docs config options should now take precedence.

momegas commented 10 months ago

Yup indeed it is. I spent some time before opening the issue and couldnt find something.