Questions & Answers

Is it possible to use Deepkit for API documentation generation?

Deepkit HTTP
50 up-votes
Warning: The answer is generated by an artificial intelligence. It might not be correct.
To adjust rating, open the thread in Discord and click on the up/down vote button.

Yes, you can use Deepkit for API documentation generation. Deepkit provides a built-in OpenAPI (formerly known as Swagger) module that automatically generates API documentation based on your defined routes and their types.

To enable the OpenAPI module, you can import the OpenApiModule from @deepkit/openapi and include it in your application's modules.

Here's an example:

import { App } from '@deepkit/app';
import { OpenApiModule } from '@deepkit/openapi';

const app = new App({
  imports: [new OpenApiModule()],
  // other configuration
});

app.run();

With the OpenAPI module enabled, you can access the generated documentation by visiting the /openapi endpoint of your application. This endpoint provides the OpenAPI specification in JSON format, which can be used by external tools for API documentation or integration with other systems.

Additionally, you can customize the generated documentation by using OpenAPI decorators and annotations on your routes and controller classes. This allows you to provide additional information, such as API descriptions and parameter details, directly in your code.