Подтвердить что ты не робот

Ошибка проверки: данные не соответствуют никаким схемам из 'oneOf'

Я получаю сообщение об ошибке Data does not match any schemas from 'oneOf' со следующей спецификацией:

{
  "info": {
    "version": "1.0.0",
    "title": "REST API"
  },
  "paths": {
    "/doit": {
      "post": {
        "responses": {
          "200": {
            "description": "Successful response"
          }
        },
        "parameters": [
          {
            "type": "object",
            "schema": {
              "$ref": "#/definitions/ResponseDefinition"
            },
            "required": "true",
            "name": "docs",
            "in": "body"
          }
        ]
      }
    }
  },
  "swagger": "2.0",
  "definitions": {
    "ResponseDefinition": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": ""
        }
      }
    }
  }
}

Эта полная ошибка в валидаторе инструментов swagger-tools:

#/paths/~1doit/post/parameters/0: Data does not match any schemas from 'oneOf'
#/paths/~1doit/post/parameters/0: Data does not match any schemas from 'oneOf'
  #/required: Expected type boolean but found type string
  #/: Missing required property: type
#/paths/~1doit/post/parameters/0: Additional properties not allowed: in,name,required,schema

Я не понимаю ошибку или как ее решить.

4b9b3361

Ответ 1

Вы не можете включить type в параметр body. Вот почему schema. Попробуйте следующее:

{
  "info": {
    "version": "1.0.0",
    "title": "REST API"
  },
  "paths": {
    "/doit": {
      "post": {
        "responses": {
          "200": {
            "description": "Successful response"
          }
        },
        "parameters": [
          {
            "schema": {
              "$ref": "#/definitions/ResponseDefinition"
            },
            "required": "true",
            "name": "docs",
            "in": "body"
          }
        ]
      }
    }
  },
  "swagger": "2.0",
  "definitions": {
    "ResponseDefinition": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": ""
        }
      }
    }
  }
}