为什么我的 swagger PUT 或 POST 不会?
Why won't my swagger PUT or POST?
我正在使用 Swagger 2.0,我的定义是:
{
"/users/{UserId}": {
"get": {
"summary": "Get a specific user by id",
"description": "",
"parameters": [{
"name": "UserId",
"in": "path",
"description": "Id of the User.",
"required": true,
"type": "string"
}],
"tags": [
"Users"
],
"responses": {
"200": {
"description": "An specific user",
"schema": {
"$ref": "#/definitions/User"
}
}
}
},
"put": {
"summary": "Update a User",
"description": "",
"consumes": "application/x-www-form-urlencoded",
"parameters": [{
"name": "UserId",
"in": "path",
"description": "Id of the user.",
"required": true,
"type": "string"
}, {
"name": "name",
"in": "formData",
"description": "Name of the user",
"required": false,
"type": "string"
}, {
"name": "username",
"in": "formData",
"description": "Username of the user. Must be unique and cannot have spaces.",
"required": false,
"type": "string"
}, {
"name": "email",
"in": "formData",
"description": "Email of the user. Must be unique.",
"required": false,
"type": "string"
}, {
"name": "entities",
"in": "formData",
"description": "Entities that the user is associated with.",
"required": false,
"type": "array",
"items": {
"name": "entity_id",
"type": "string"
}
}],
"tags": [
"Users"
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/User"
}
}
}
}
}
}
但我大摇大摆 UI,我正尝试根据 UI 放置一些数据:
但是当它发出请求时,它不会在正文中发送任何内容。我做错了什么?
这是其中一个 alpha 版本 (https://github.com/swagger-api/swagger-ui/issues/838) 的问题。 M1 版本(目前为 master)解决了这个问题。
我正在使用 Swagger 2.0,我的定义是:
{
"/users/{UserId}": {
"get": {
"summary": "Get a specific user by id",
"description": "",
"parameters": [{
"name": "UserId",
"in": "path",
"description": "Id of the User.",
"required": true,
"type": "string"
}],
"tags": [
"Users"
],
"responses": {
"200": {
"description": "An specific user",
"schema": {
"$ref": "#/definitions/User"
}
}
}
},
"put": {
"summary": "Update a User",
"description": "",
"consumes": "application/x-www-form-urlencoded",
"parameters": [{
"name": "UserId",
"in": "path",
"description": "Id of the user.",
"required": true,
"type": "string"
}, {
"name": "name",
"in": "formData",
"description": "Name of the user",
"required": false,
"type": "string"
}, {
"name": "username",
"in": "formData",
"description": "Username of the user. Must be unique and cannot have spaces.",
"required": false,
"type": "string"
}, {
"name": "email",
"in": "formData",
"description": "Email of the user. Must be unique.",
"required": false,
"type": "string"
}, {
"name": "entities",
"in": "formData",
"description": "Entities that the user is associated with.",
"required": false,
"type": "array",
"items": {
"name": "entity_id",
"type": "string"
}
}],
"tags": [
"Users"
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/User"
}
}
}
}
}
}
但我大摇大摆 UI,我正尝试根据 UI 放置一些数据:
但是当它发出请求时,它不会在正文中发送任何内容。我做错了什么?
这是其中一个 alpha 版本 (https://github.com/swagger-api/swagger-ui/issues/838) 的问题。 M1 版本(目前为 master)解决了这个问题。