2016-05-09 6 views
0

swagger.ioでAPIを文書化しています。私は、ヘッダー内の必要な文字列プロパティとしてsession_tokenを定義しようとすると、私はエラーを取得する:swagger.io:ヘッダーに必要なパラメーター定義が正しくありません。

enter image description here

私の定義では、私は の問題の原因はよく分からないdocumentationでサンプルと一致しました。

スニペット

/customerVerifyLogin: 
    post: 
     summary: Validate verification code sent to authenticate login. Returns session_token 
     parameters: 
     - name: Authorization 
      in: header 
      type: string 
      required: true 
      default: Basic YWRtaW46WDRCbzViWnZTamlXU0hoZDFMOGNpUHkyUERzekUwU3I= 
     - name: session_type 
      in: header 
      type: string 
      enum: 
      - android 
      - ios 
      required: true 
     - name: VerificationCode 
      in: body 
      type: string 
      required: true 
      description: 
      schema: 
      type: object 
      properties: 
       phone: 
       type: string 
       description: The mobile number to which the verification was sent. 
       device_id: 
       type: string 
       description: ID that uniquely identifies the device 
       code: 
       in: body 
       type: integer 
       format: int32 
       required: true 
       description: Verification code to be validated. 
     responses: 
     200: 
      description: Customer logged-in successfully. 
      schema: 
      $ref: '#/definitions/Customer' 
     tags: 
     - Verification 
     - Login 

答えて

0

ドキュメント内のカップルのエラー:

  • VerificationCodetype: stringschema:を示しています。ボディーパラメーター(in: body)の場合はschemaしか使用できません。ちょうどtype: stringを削除してください。
  • プロパティcodeのためのあなたの定義には、いくつかの不要なフィールドがあります。
    • in: bodyを削除します。おそらくコピー/ペーストエラーです。
    • required: trueを削除してください。
required: 
    - code 
properties: 
    code: 
    # the rest of your definition 
:それは、このようなような propertiesオブジェクトの兄弟に移動し、プロパティが必要だと言って正しい方法ではありません
関連する問題