Skip to content

[BUG] Python client: response parsing fails for array of anyOf items  #6546

@hleb-albau

Description

@hleb-albau

Bug Report Checklist

  • [] Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used? latest master
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output? error during result parsing from server
  • [Optional] Bounty to sponsor the fix (example)
Description

If openapi definition contains model of type array with anyOf items description, generated Python client can't parse request from server. Generated model has openapi_types with next type list[AnyOfFirstSecondThird]. During response parsing client takes one by one list items and try to de-serialize to non existing type klass AnyOfFirstSecondThird. Parsing fails at klass = getattr(openapi_client.models, klass) line with next error - module 'openapi_client.models' has no attribute 'AnyOfFirstSecondThird'

openapi-generator version

latest master, 5.0.0-SNAPSHOT

OpenAPI declaration file content or url
    ContainerList:
       type: array
       items:
         anyOf:
           - $ref: "#/components/schemas/FirstResultType"
           - $ref: "#/components/schemas/SecondResultType"
           - $ref: "#/components/schemas/ThirdResultType"
Command line used for generation
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -i /local/docs/openapi.yml -g python -o /local/clients/python
Steps to reproduce
Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions