首页 > 解决方案 > Swagger/OpenApi Codegen 从 xsd 生成请求正文

问题描述

我们正在使用 swagger-codegen/openapi-codegen 来生成我们的 API。

我希望我的 API 使用"application/xml"

以及要从 xsd 方案生成的请求正文。

当我使用application/json 我的帖子代码时,如下所示:

parameters:
      - in: "body"
        name: "body"
        description: "Request Object For Adding User"
        required: true
        schema:
          $ref: "#/definitions/User"

虽然在定义中我有

definitions:
  User:
    type: "object"
    required:
      - "name"
      - "email"
    properties:
      name:
        type: "string"
        example: "john"
      email:
        type: "string"
        example: "john@gmail.com"

一些想法我怎么能做到这一点?

标签: swaggerswagger-2.0openapi

解决方案


推荐阅读