Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Swagger:应为类型数组,但在#/paths/./参数处找到类型对象_Java_Rest_Api_Swagger_Swagger 2.0 - Fatal编程技术网

Java Swagger:应为类型数组,但在#/paths/./参数处找到类型对象

Java Swagger:应为类型数组,但在#/paths/./参数处找到类型对象,java,rest,api,swagger,swagger-2.0,Java,Rest,Api,Swagger,Swagger 2.0,我有一个带有服务的YAML文件,但在接收数组而不是对象时,我一直遇到一些wierd错误 swagger: "2.0" info: description: "" version: 1.0.0 title: Your project basePath: / schemes: - http paths: /trocarProprietarioVeiculo: post: description: ""

我有一个带有服务的YAML文件,但在接收数组而不是对象时,我一直遇到一些wierd错误

swagger: "2.0"
info:
    description: ""
    version: 1.0.0
    title: Your project
basePath: /
schemes:
  - http
paths: 
    /trocarProprietarioVeiculo:
        post:
            description: ""
            consumes: 
              -application/json
            produces: 
              -application/json
            parameters:
              -in: body
                schema: 
                  $ref: "#/definitions/TrocarProprietarioVeiculoChamada"
            responses:
                "200": 
                  description: ""
                  schema: 
                    $ref: "#/definitions/TrocarProprietarioVeiculoResposta"
definitions: 
    Resposta:
        type: object
        properties:
            erro:
                type: integer
            mensagens:
                type: array
                items:
                    type: string
    RespostaServico:
        type: object
        properties:
            resposta:
                $ref: "#/definitions/Resposta"
    TrocarProprietarioVeiculoChamada:
        type: object
        properties:
            chassi:
                type: string
            codigoCliente:
                type: integer
            nomeCliente:
                type: string
    TrocarProprietarioVeiculoResposta:
        type: object
        properties:
            respostaServico:
                $ref: "#/definitions/RespostaServico"
显示的消息错误为:

  Swagger schema validation failed. 
  Expected type array but found type object at #/paths//trocarProprietarioVeiculo/post/parameters
  Expected type array but found type string at #/paths//trocarProprietarioVeiculo/post/produces
  Expected type array but found type string at #/paths//trocarProprietarioVeiculo/post/consumes

JSON_OBJECT_VALIDATION_FAILED
这是我动态生成的YAML文件。任何关于我可以回答的问题,我都乐意回答

将YAML粘贴到中,然后按照提示操作。具体问题是:

1)
-
和值之间必须有空格,例如:

- application/json
2) body参数需要一个
名称
,并且所有属性必须对齐(具有相同的缩进):

-in:body
姓名:body
模式:
$ref:“#/definitions/TrocarProprietarioVeiculoChamada”