1
我需要来形容我的应用程序的途径,因此我用招摇:未知的响应类型为204码状态
paths:
/users:
get:
description: Returns all users
responses:
"204":
description: No Content Found
schema:
$ref: "#/definitions/NoContentFound"
definitions:
NoContentFound:
required:
- message
properties:
message:
type: string
我得到了招摇UI此错误:
Unknown response type
在应用程序.js:
const User = require('../server/models/user');
const sendJsonResponse = function sendJsonResponse(req, res, status, content) {
res.status(status);
res.json(content);
};
app.get('/users/:usersid', (req, res) => {
User
.query()
.where('id', id)
.then(users => {
if(users.length === 0) {
sendJsonResponse(req, res, 204, 'No users Found');
}
});
};
我该如何解决这个问题?
哪个版本扬鞭UI,究竟(2.X,3.X)的?仅供参考,根据[RFC 7331](https://tools.ietf.org/html/rfc7231#section-6.3.5),204个响应不应该有一个机构。 – Helen
Swagger UI回购中的相关问题:https://github.com/swagger-api/swagger-ui/issues/3730 – Helen