OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.3k stars 6.44k forks source link

[BUG] python-flask: oneOf model class doesn't generate though imported #5187

Open zhanwenchen opened 4 years ago

zhanwenchen commented 4 years ago

Bug Report Checklist

Description
openapi-generator version
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix
ssYkse commented 4 years ago

I am facing the same. In one of my models:

from openapi_server.models.one_ofstringnumberboolean import OneOfstringnumberboolean # noqa: E501

however this file doesn't exist: from openapi_server.models.one_ofstringnumberboolean import OneOfstringnumberboolean ModuleNotFoundError: No module named 'openapi_server.models.one_ofstringnumberboolean'

the component yaml looks as follows:

    pair:
      type: object
      properties:
        proba:
          type: number
        label:
          oneOf:
          - type: string
          - type: number
          - type: boolean
      required:
        - proba
        - label
renato-farias commented 4 years ago

I am having the same issue when I tried to generate the code using the following OpenAPI spec: https://raw.githubusercontent.com/bacen/pix-api-recebimentos/master/openapi.yaml

The command to generate was:

openapi-generator generate -i ../openapi.yaml -g python-flask -o . -s --package-name mock

I also tried with the --legacy-discriminator-behavior flag but still not generating the module.

eranreshef commented 3 years ago

+1 Having the same issue

joekickass commented 3 years ago

+1 Same here.

Union is not listed in: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/python-flask.md#schema-support-feature