2016-04-22 27 views
0

クエリパラメータを使用してAPIを正常に定義しましたが、代わりにすべての状態をJSONオブジェクト経由で渡したかったのです。JSONをインポートしようとしたときにスワッガーエラーが発生しました

私は、次のYAMLファイルに定義している:これは述べてparametersラインとエラーになり

paths: 
    /contact-us: 
    post: 
     summary: Contact Us 
     description: | 
     Originates a new conversation thread 
     consumes: 
     - application/json 
     parameters: 
     - in: body 
      required: true 
      schema: 
      $ref: '#/definitions/RequestConversation' 
     tags: 
     - Email 
     responses: 
     200: 
      description: New conversation has been originated 
      schema: 
      $ref: '#/definitions/Conversation' 

を:

Data does not match any schemas from 'oneOf'

しかし、私は同じYAMLファイルに次の定義を持っています:

definitions: 
    RequestConversation: 
    type: object 
    properties: 
     company_id: 
     type: string 
     # required: true 
     user_email: 
     type: string 
     # required: true 
     type: 
     type: string 
     # required: true 
     default: 'contact-us' 
     sub_type: 
     type: string 
     campaign: 
     type: string 

「必須」の定義は次のとおりです。他のユーザーが私に違うエラーを与えていたからです:

Expected type array but found type boolean

誰かが助けてくれますか?

答えて

0

[OK]をクリックして、自分の問題(少なくとも最初の部分)を解決しました。

  1. 最初の問題は、実際には私が必要とされる「名前」プロパティを指定しなかったことでした。

  2. これはまだ開いています(別名は動作しますが、「必須」プロパティは使用できません)。

関連する問題