title: Swagger codegen discriminated values in python
body: <p>We are using Swagger 2.0 to define our API. We have a model like this in the swagger.yaml:</p>
  
  <pre><code>Reading:
    title: Reading
    type: object
    discriminator: type
    properties:
      type: 
        $ref: '#/definitions/ReadingType'
  
  SensorReading:
    description: Teralytic probe reading
    allOf:
      - $ref: "#/definitions/Reading"
      - properties:
          value:
            description: Sensor reading value
            type: number
            format: float64
  </code></pre>
  
  <p>We use swagger-codegen 2.4.0 to generate the python client and are using python 3.7.0.</p>
  
  <p>The issue we are having is when we call our client:</p>
  
  <pre><code>response = api_instance.readings_query(start_date=start_date, end_date=end_date)
  
  for result in api_response:
          for reading in result.readings:
              if reading.type == 'SensorReading':
                  reading.__class__ = SensorReading
                  pprint(reading)
  </code></pre>
  
  <p>This is how we assumed we would "cast" our reading back to its specific type but this doesn't seem to work.</p>
  
  <p>We get an error back similar to:</p>
  
  <pre><code>AttributeError: 'SensorReading' object has no attribute '_value'
  </code></pre>
  
  <p>It seems that swagger-codegen for python doesn't quite support this, unless we are totally missing something.</p>