在使用swagger时,如何让Azure API管理层记录请求的主体



我们正在使用swagger 2.0来记录我们的.Net Web API,我们将托管在Azure API管理之后的Azure中。我在获取文档以详细说明作为正文一部分发布的复杂对象时遇到了问题。Azure根本没有显示对象的详细信息,这让我不得不自己记录它们。下面是我导入Azure API管理的json文件。

{
    "swagger": "2.0",
    "info": {
        "version": "1.0.0",
        "title": "Hotel Search",
        "description": "The seodecnvewjkl"
    },
    "basePath": "/v1",
    "consumes": [
        "application/xml",
        "application/json"
    ],
    "produces": [
        "application/xml",
        "application/json"
    ],
    "schemes": [
        "http",
        "https"
    ],
    "paths": {
        "/hotels/search": {
            "post": {
                "operationId": "searchCommand",
                "description": "Searches for hotels",
                "parameters": [
                    {
                        "name": "hotelSearchRq",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/HotelSearchRq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "schema": {
                            "title": "HotelSearchRs",
                            "$ref": "#/definitions/HotelSearchRs"
                        }
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "404": {
                        "description": "Unauthorised"
                    }
                }
            },
            "get": {
                "operationId": "searchQuery",
                "parameters": [
                    {
                        "name": "CorrelationId",
                        "in": "query",
                        "type": "string"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response"
                    }
                }
            }
        }
    },
    "definitions": {
        "StayDetail": {
            "type": "object",
            "properties": {
                "NumberOfGuests": {
                    "type": "integer"
                },
                "CheckinDate": {
                    "type": "string",
                    "format": "date",
                    "description": "the date that the stay starts from"
                }
            }
        },
        "HotelSearchCriteria": {
            "type": "object",
            "properties": {
                "MaximumResults": {
                    "type": "integer",
                    "format": "int64"
                },
                "StayDetails": {
                    "$ref": "#/definitions/StayDetail"
                }
            }
        },
        "HotelSearchRq": {
            "type": "object",
            "properties": {
                "CustomerTransactionIdentifier": {
                    "type": "string",
                    "description": "The customers transaction identifier"
                },
                "search_criteria": {
                    "$ref": "#/definitions/HotelSearchCriteria"
                }
            }
        },
        "HotelSearchRs": {
            "type": "object"
        }
    }
}

Azure Api管理操作屏幕

有人能帮我如何从招摇文件中自动记录尸体吗?

目前Swagger文档中的请求和响应主体信息未显示在开发人员门户文档中。

现在已经不是这样了。示例和架构显示在开发人员门户中。

最新更新