Swagger 创建 API 文档:Swagger Editor [英] Swagger create API document: Swagger Editor
问题描述
我正在使用 swagger 来记录我的 REST API 服务.我有我提供给服务的特定输入.我正在使用 swagger 编辑器自己创建 YAML 代码.我面临的问题是我无法将输入类型获取为 XML,默认情况下它采用 JSON.我的 yaml 代码中是否有任何问题.代码如下:
I am using swagger for documenting my REST API service. I have an specific input that I provide to the service. I am creating YAML code by myself using swagger editor. The issue I am facing is I am not able to get the input type as XML, it by default takes JSON. Is there any issue in my yaml code. The code is given below:
swagger: "2.0"
info:
title: Order Update to Dealers
description: API description in Markdown.
version: 1.0.0
host: #Host name cannot be specified here
basePath: /api/OrderUpdate
schemes:
- http
paths:
/GetFullOrderAcknowlegement:
post:
summary: Returns a list of users.
consumes:
- application/xml
produces:
- text/plain
parameters:
- in: body
name: DealerInput
description: Optional extended description in Markdown.
schema:
properties:
DealerID:
type: string
PONumber:
type: string
responses:
201:
description: Created
200:
schema: {}
description: OK
401:
schema: {}
description: Authorization information is missing or invalid.
推荐答案
This是 Swagger Editor 3.3.0 和 Swagger UI 3.11.0 中的一个错误.已在 Editor 3.3.1 和 UI 3.12.0(2018 年 3 月 4 日发布)中修复.
This was a bug in Swagger Editor 3.3.0 and Swagger UI 3.11.0. It was fixed in Editor 3.3.1 and UI 3.12.0 (released on March 4, 2018).
作为一种解决方法,您可以下载编辑器 v3.2.9 并通过在浏览器中打开 index.html
文件在本地运行它.
As a workaround, you can download Editor v3.2.9 and run it locally by opening the index.html
file in your browser.
这篇关于Swagger 创建 API 文档:Swagger Editor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!