2017-04-24 5 views
8

私はSwagger Editorを使って簡単なSwagger/Open API定義を書こうとしています。Swaggerパラメータのエラーが「<#/ definitions/parameter>」の1つではありませんか?

swagger: "2.0" 

info: 
    version: 1.0.0 
    title: Test API 
    description: Test API 

schemes: 
    - https 
host: hipaa.ai 
basePath: /v1 

paths: 
    /comments: 
    post: 
     summary: Your comments 
     description: Comments 
     parameters: 
     - name: text 
     in: body 
     description: An array of text strings 
     type: array 
     minItems: 1 
     maxItems: 1000 
     items: 
      type: text 

私は、次のようなエラーになっている:私は闊歩スキーマの参照をチェックしました

Schema error at paths./comments.post.parameters[0] 
is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference> 

、およびPetStoreを例に、私は私がこれを取得しています理由はわかりません。何か案は?

答えて

9

ボディパラメータは、タイプを指定するschemaキーワードを使用するので、あなたはschematypeitemsminItemsmaxItemsを移動する必要があります。

また、type: textvalid typeではありません。代わりにtype: stringを使用してください。

 parameters: 
     - name: text 
     in: body 
     description: An array of text strings 
     schema: 
      type: array 
      minItems: 1 
      maxItems: 1000 
      items: 
      type: string 
関連する問題