我正在使用http://apidocjs.com/为我正在构建的Express.js API创建公共文档.我的问题是,如何使用Express.js来路由和提供文档?
这是我的Express服务器设置:
/** Load config into globally defined __config
* @requires fs */
var fs = require('fs');
__config = JSON.parse(fs.readFileSync('config/config.json'));
/** Custom Logging Moduele
* @requires ninja_modules/jacked-logger */
log = require('./ninja_modules/jacked-logger');
/** Configure the Express Server
* @requires express
* @param {function} the callback that configures the server */
var express = require('express');
var app = express();
app.configure(function() {
/** Sets default public directory */
app.use(express.static(__dirname + '/public'));
/** Sets root views directory */
app.set('views', __dirname + …Run Code Online (Sandbox Code Playgroud) 我有一个仅API的Rails应用,需要前端开发人员的文档。这是我的第一次体验。
您为此使用什么工具?请注意,我使用的是Rails 5 API,而不是Grape。
我测试了Apipie,swagger-blocks和swagger-docs 宝石,但它们已过时或越野车。必须有一个更好的选择!
尊重任何建议
我有一个 Tornado Web 服务器,它在其 API 中公开了一些端点。我希望能够在代码中记录我的处理程序(端点),包括描述、参数、示例、响应结构等,然后生成一个交互式文档,使人们能够“玩”我的 API,轻松发出请求和在沙盒环境中体验响应。
我知道Swagger,特别是他们的 SwaggerUI 解决方案是最好的工具之一,但我对它的工作原理感到困惑。我知道我需要为 SwaggerUI 引擎提供一些.yaml定义我的 API 的东西,但是我如何从我的代码中生成它?我发现很多 github 库不够好或者只支持 Flask ......
谢谢
嘿,我正在尝试从我的 apiDoc 中删除/隐藏示例请求表单。我没有在 package.json 配置上使用sampleUrl 标记,在 api_porject.json 上此属性设置为 false。但是,对于每个请求,都有示例请求。我还尝试将参数 @apiSampleRequest off 应用于我的代码块,但没有成功。有什么建议么?

我正在尝试使用Swagger UI,它说我应该首先编写一个api-doc来描述REST api的确切api.问题是我不知道这意味着什么.这份文件是用简单的英文写的吗?或者是否有某种格式可以生成UI?
谢谢!
我正在不断地测试apisusng postman,然后使用app生成 api 文档postman。
但问题是文档没有显示api response我在postman console. 这是我大部分时间收到的回复apis
我怎样才能在我的 api 文档中获得响应正文?
我包含swagger-springmvc在我的项目中并设法让 Swagger UI 工作,但现在关于 UI 中 API 的信息很少。我所看到的只是通过反射提取的信息。
这是控制器方法的样子:
/**
* Read all users matching given filter
* @param String filter The text by which to filter the usernames
* @return User[] Array of users matching given filter
* @throws Exception
*/
@RequestMapping(value = "/users/{filter}", method = RequestMethod.GET)
public
@ResponseBody
Collection<User> getUsers(@PathVariable("filter") String filter) throws Exception {
return domain.getUsersFilteredBy(filter);
}
Run Code Online (Sandbox Code Playgroud)
在每个方法的右侧,Swagger 记录了方法的名称,在这种情况下:
get Users
Run Code Online (Sandbox Code Playgroud)
但我期待看到这个:
Read all users matching given filter
Run Code Online (Sandbox Code Playgroud)
在 helloreverb.com 上的示例中,我看到了每种方法的描述。我怎样才能像这样大摇大摆地将我的控制器方法的描述添加到 UI 中?

这几天我一直在玩APIdoc.js,我似乎无法弄清楚如何使版本工作.据我所知,我需要根据APIDOC将旧的APIDOC注释代码保存到另一个带有@APIVersioning新/旧代码的文件中.无论我在哪里粘贴这个旧文件,我似乎无法让它工作,并且在这个例子中没有任何关于如何加载旧代码来创建这个版本的暗示.非常感谢任何协助.
我尝试使用apidocjs创建API文档,在编译用于在项目文件夹上使用apidoc.json创建apidoc的项目时出现问题.
代码在这里:
~$ apidoc -i ./ -o apidoc/
Run Code Online (Sandbox Code Playgroud)
结果
warning: parser plugin 'param' not found.
error: Error: Can not read: apidoc.json, please check the format (e.g. missing comma).
Run Code Online (Sandbox Code Playgroud)
请有人帮我解决这个问题
与apidocjs.com相关的标签
我正在为其他人编写的 nodejs 项目编写apidocs。我希望在有人访问“myurl.com/docs/api”时显示文档页面。我的文档目录被放置在“app/public/app/docs/apidoc/”下,我试图使用路由来显示它,但给了我一个错误说明:
'错误:无法在视图目录“/Path/To/Project/app/views”中查找视图“/public/app/apidoc/index.html”'
这是我的 routes.js 条目:
app.get('/docs/api', function(req, res) {
res.render('/app/apidoc/index.html');
});
Run Code Online (Sandbox Code Playgroud)
我相信该项目使用 jade 和 ejs,因为它们列在配置文件的某处。
我正在使用功能控制器将 Swagger 添加到我的 Spring Webflux 服务中。首先我收到这个错误:
描述:无法注册在类路径资源 [org/springdoc/webflux/ui/SwaggerConfig.class] 中定义的 bean“swaggerWelcome”。具有该名称的 bean 已在类路径资源 [org/springdoc/webmvc/ui/SwaggerConfig.class] 中定义,并且覆盖被禁用。
行动:
考虑重命名其中一个 bean 或通过设置 spring.main.allow-bean-definition-overriding=true 来启用覆盖
所以我将 spring.main.allow-bean-definition-overriding=true 添加到我的 application.properties 文件中。
现在我收到这个错误:
描述:
org.springdoc.webmvc.ui.SwaggerConfig 中方法 swaggerWebMvcConfigurer 的参数 1 需要一个类型为“org.springdoc.webmvc.ui.SwaggerIndexTransformer”的 bean,但无法找到。
行动:
考虑在配置中定义“org.springdoc.webmvc.ui.SwaggerIndexTransformer”类型的 bean。
Pom 文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company/groupId>
<artifactId>service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- For all mvc and web functions -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency> …Run Code Online (Sandbox Code Playgroud)