Tag: swagger

将Swagger Express项目迁移到AWS Serverless

我正在做一个Swagger Express项目。 (大约50个API端点) 我想将此项目迁移到使用Lambda的AWS Serverless。 从https://github.com/awslabs/aws-serverless-express/tree/master/example ,我可以看到如何从Express项目迁移到无服务器。 但Swagger Express项目似乎有所不同。 任何build议或我应该遵循的步骤表示赞赏。

如何在单个API调用中在swagger中定义查询和正文参数

该API有正文和查询中的参数,我需要像这样在swagger中定义这个: parameters: [ { "name": "businessCode", "in": "query", "required": true, "type": "string", }, { "name":"clientCode", "in":"query", "required":true, "type":"string", }, { "name":"client", "in":"body", "required":true, } ]

在服务器端结束时使用状态码404使用swagger

当我添加一个API通过像POST和GET这样的环回Swagger函数,我得到相同的状态码时, 'use strict'; var http = require("http"); const keepAliveAgent = new http.Agent({ keepAlive: true }); const getOptions = { hostname: '127.0.0.1', port: 8001, path: '/plugins/', method: 'GET', headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }; const options = { hostname: '127.0.0.1', port: 8001, path: '/plugins/', method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }; module.exports = function (Plugins) […]

Hapi Swagger跳过某些端点

由于npm模块hapi-swagger不支持file upload端点,所以我需要一种在我的testing中跳过某些端点的方法。 我已经检查了文档,没有beforeEach或任何方式来检查testing期间哪个端点是运行的。 目前我刚刚把我的环境设置为TEST,并且在目标处理程序中有一个if,但是这很麻烦和复杂。 有什么办法可以跳过端点吗?

Gulp插件validationSwagger文档?

我已经决定维护一个巨大的Swagger文档的最合理的方法是将其分解成节点模块,然后有一个Gulp任务将它们一起构build。 但是我想在写完之后validationSwagger。 有没有一个插件来做到这一点?

无法从http:// localhost:3000 / sw-import.js / resources中读取Swagger JSON

我是新来的节点和大招,并正在通过loopback.io示例来尝试和build立一个API。 我的机器上安装了node,strongloop。 我创build了一个新的环回应用程序,并build立了一个快速的“用户”模型,并尝试运行swagger explorer来查看是否可以查看这些API。 但是,我运行localhost时出现以下错误:3000 / explorer / 有任何想法吗?

Swagger参数多态性

在Swagger中可以使用多种types定义input参数? 示例:我有使用URL http://localhost/tasks/{taskId}资源的API。 但是每个任务都包含整数id和stringuuid。 我想允许用户通过id或uuid来寻址资源 – 所以http://localhost/tasks/123和http://localhost/tasks/51f12dbc-02e7-41a6-ab81-2381caea0176 URL都是有效的。 但是,对于swagger文档( https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#parameter-object )参数对象只能有单一的types types:必需。 参数的types。 由于该参数不在请求主体处,因此仅限于简单types(即不是对象)。 该值必须是“string”,“数字”,“整数”,“布尔”,“数组”或“文件”之一。 那么如何将inputpath参数描述为string/整数?

招摇过市没有模式

我正在使用节点的招摇。 这工作正常。 我想发布json主体而不用定义详细的模式。 例如下面我不想指定对象的属性。 有没有办法做到这一点? /pets: post: description: Add new parameters: – name: id in: body description: data to post required: true type: object responses: '200': description: A list of pets schema: type : string 这不是渲染textarea发布json数据。

Swagger UI不发送url的参数

我正在构build一个使用MongoDB和mongoose的应用程序的api,我正在使用Swagger UI来testing它,我做了一个删除路线: app.delete '/venues/:id', venueController.delete venueController.delete看起来像这样(在coffeescript): exports.delete = (req, res) -> console.log req.params.id Venue.remove id: req.params.id .then (dbVenue) -> res.json dbVenue .catch (err) -> console.log err res.sendStatus(500).end err.message 在swagger UI中我input一个id并发送删除请求,但是req.params.id的console.log只是吐出":id"而不是我input的id。 我该如何解决?

如何设置数组jschema对象的默认值?

我试图设置默认值的数组在jschema与招摇。 下面是示例模式。 'Myobj': { 'type': 'object', 'title': 'Myobj', 'description': 'Some text', 'properties': { 'outputForms': { 'type': 'array', 'description': 'Some text', 'default': 'two', 'items': { 'type': 'string', 'enum': ['one','two'], }, 'maxItems': 4, 'uniqueItems': true, 'additionalItems': false } } } 这不行,我做错了什么? 我会很感激任何帮助。