我能否使用https://github.com/TypeStrong/typedoc生成类似于https://apidocjs.com/的REST API文档?
欢迎提供任何在使用Next.js时重用TypeScript类型以生成REST API文档的建议。
我能否使用https://github.com/TypeStrong/typedoc生成类似于https://apidocjs.com/的REST API文档?
欢迎提供任何在使用Next.js时重用TypeScript类型以生成REST API文档的建议。
你是否查看过npm包apidoc?
它可以根据代码注释生成API文档:
/**
* @api {get} /user/:id Request User information
* @apiName GetUser
* @apiGroup User
*
* @apiParam {Number} id User's unique ID.
*
* @apiSuccess {String} firstname Firstname of the User.
* @apiSuccess {String} lastname Lastname of the User.
*/
还有一些与Gulp、Grunt、Eclipse、Sublime Text、Docmaster、Markdown、Swagger等相关的辅助工具/转换器...(参见apidoc GitHub README.md)
import { api, endpoint, request, response, body } from "@airtasker/spot";
@api({
name: "My API"
})
class Api {}
@endpoint({
method: "POST",
path: "/users"
})
class CreateUser {
@request
request(@body body: CreateUserRequest) {}
@response({ status: 201 })
response(@body body: CreateUserResponse) {}
}
interface CreateUserRequest {
firstName: string;
lastName: string;
}
interface CreateUserResponse {
firstName: string;
lastName: string;
role: string;
}