title: Allow an object to have oneOf some types in swagger
body: <p>I am defining an API and I have a field that is called "payload". We had this field defined as </p>
  
  <blockquote>
    <p>"type": string</p>
  </blockquote>
  
  <p>in our swagger however those payload data begun to have structure. More particular the client sends json objects as payload data that must obey in some rules. For example payload could be:</p>
  
  <pre><code>{
    "bark": true,
    "breed": "Dingo" 
  }
  </code></pre>
  
  <p>if the payload is a Dog object or </p>
  
  <pre><code>{
    "hunts": true,
    "age": 13 
  }
  </code></pre>
  
  <p>if it is a Cat object.</p>
  
  <p>So in the yaml file I initially have:</p>
  
  <pre><code>payload:
          $ref: "#/definitions/payloaddata" 
  </code></pre>
  
  <p>and in the definitions area I have:</p>
  
  <pre><code>payloaddata:
      type: "object"
      schema: 
        oneOf: 
          - $ref: '#/components/schemas/Cat'
          - $ref: '#/components/schemas/Dog'
  </code></pre>
  
  <p>The components are defined as:</p>
  
  <pre><code>components:
    schemas:
      Dog:
        type: object
        properties:
          bark:
            type: boolean
          breed:
            type: string
            enum: [Dingo, Husky, Retriever, Shepherd]
      Cat:
        type: object
        properties:
          hunts:
            type: boolean
          age:
            type: integer
  </code></pre>
  
  <p>However the yaml file does not "compile" with this input. Any ideas how to do this?</p>