小编Dos*_*eda的帖子

如何在 Swagger 文档中添加 xml 示例

你好,我正在为 api 创建 swagger 文档,我想添加 xml 示例,但我做不到。

这是我写的 swagger 文档

swagger: "2.0"
info:
  title: Documentatie API 
  description: Descriere documentatie API metode POST
  version: 1.0.0
host: xxx.ro
basePath: /v1
schemes:
  - https
paths:
  /stareMesaj:
    post:
      summary: Stare mesaj
      description: Descriere stare mesaj
      consumes:

            - application/xml
      produces:

            - application/xml
      responses:
        200:
          description: OK
          schema:
            type: object
            properties:
              id:
                type: integer
                example: 4
              name:
                type: string
                example: Arthur Dent
Run Code Online (Sandbox Code Playgroud)

我认为模式下的属性会在示例中发生变化,但它说:

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML example cannot be generated; root element name is …
Run Code Online (Sandbox Code Playgroud)

xml api documentation swagger

2
推荐指数
1
解决办法
5748
查看次数

标签 统计

api ×1

documentation ×1

swagger ×1

xml ×1