0

swagger.io で API を文書化しています。ヘッダーで必須の文字列プロパティとして session_token を定義しようとすると、次のエラーが発生します。

ここに画像の説明を入力

私の定義はドキュメントのサンプルと一致するため、何が問題を引き起こしているのかわかりません。

スニペット

/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
4

1 に答える 1

0

ドキュメントにいくつかのエラーがあります:

  • VerificationCodetype: stringとを示しますschema:。body パラメーター ( in: body) には、 のみを使用できますschema。を削除するだけtype: stringです。
  • プロパティの定義には、code不要なフィールドがいくつかあります。
    • 削除しin: bodyます。それはおそらくコピー/貼り付けエラーです
    • 削除しrequired: trueます。これは、プロパティが必要であると言う正しい方法ではありません。次のpropertiesようにオブジェクトの兄弟に移動します。
required:
  - code
properties:
  code:
   # the rest of your definition
于 2016-05-09T17:01:59.037 に答える