2017-04-05 22 views
0
/cancel: 
    post: 
     description: '' 
     summary: Cancel 
     operationId: Cancel 
     produces: 
     - application/json 
     parameters: 
     - name: Body 
     in: body 
     required: true 
     description: '' 
     schema: 
      $ref: '#/definitions/CancelRequest' 
     - name: Authorization 
     in: header 
     required: true 
     description: '' 
     schema: 
      $ref: '#/definitions/Authorization' 
     - name: Content-Type 
     in: header 
     required: true 
     type: string 
     description: '' 

ここがスニペットです。 $ref: '#/definitions/CancelRequest'の行に間違ったパラメータ定義があると言われています。何が問題なのでしょうか?有効なパラメータ定義ではありません

答えて

0

エラーは、おそらく誤解を招く、という問題が他のパラメータである:

  1. Content-Typeヘッダはconsumesキーワードではなく、パラメータを使用して定義されるべきである。

    /cancel: 
        post: 
         consumes: 
         - application/json 
         - application/xml 
    
  2. ヘッダパラメータが必要typeschemaではない)とtypeはシンプルタイプでなければならず、$refにすることはできません。だから、次のようになります。

    - name: Authorization 
         in: header 
         required: true 
         description: '' 
         type: string # <------- 
    

    しかし、Authorizationヘッダの場合には、おそらく代わりにsecurity definitionを使用する必要があります。たとえば、APIで基本認証を使用している場合:

関連する問題