Skip to content

编辑工具中导入openapi3.1.0数据时报错 #2495

@Kun-Zhang-x

Description

@Kun-Zhang-x

Describe the bug

Image

To Reproduce

1.新建插件
2.导入工具->选择原始数据导入
3.粘贴以下内容

{
  "openapi": "3.1.0",
  "info": {
    "title": "gfMcp",
    "description": "gfMcp MCP Server",
    "version": "1.10.1"
  },
  "servers": [
    {
      "url": "http://192.168.163.101:8000/gfMcp"
    }
  ],
  "paths": {
    "/get_weekday": {
      "post": {
        "summary": "Get Weekday",
        "description": "根据日期查询该日期是周几",
        "operationId": "tool_get_weekday_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/get_weekday_form_model"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {

                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "get_weekday_form_model": {
        "properties": {
          "date": {
            "type": "string",
            "title": "Date",
            "description": "日期,格式为YYYYMMDD"
          }
        },
        "type": "object",
        "required": [
          "date"
        ],
        "title": "get_weekday_form_model"
      }
    }
  }
}

4.报错:invalid plugin openapi3 document : response body only supports 'object' type

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Version:

Please provide the version of {0.5.0} you are using.

Environment:

The output of go env.

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions