Forum Discussion

confusedDev's avatar
confusedDev
New Contributor
5 years ago

Polymorphic responses in Python Client Side

Code generation for the response of a method that has multiple possible accepted response schemas is broken in generated python code. I have a GET method that is supposed utilize 3.0's polymorphic capabilities by having a response that should return "oneOf" 3 types of schemas. My response looks like this:

 

components:
  responses:
    RunResponse:
      description: different response types for Runs
      content:
        application/json:
          schema:
            oneOf:
            - $ref: '#/components/schemas/AllRun'
            - $ref: '#/components/schemas/IonRun'
            - $ref: '#/components/schemas/IllRun'

But in the response type in the generated code it is looking for this: 

When ran with this as the response type I get an error as there is no model of "OneOfAllRunsIonRunsIllruns". How can this be fixed? Because as of right now polymorphism doesn't work with python generated code.

No RepliesBe the first to reply