Skip to content

[BUG][python-flask] Generator fails to create required imports for models #1755

@ericraymond

Description

@ericraymond
Description

Model are created the lack the required imports to run correctly. This fails for petstore example!

openapi-generator version

Failed for 3.3.4 and lastest from master branch

OpenAPI declaration file content or url

https://raw.githubusercontent.com/OpenAPITools/openapi-petstore/master/src/main/resources/openapi.yaml

Command line used for generation

Options for gradle used for 4.4.3 test:

    inputSpec = "${rootDir}/openapi.yaml".toString()
    outputDir = swaggerOutputDir
    templateDir= "${rootDir}/templates/flaskConnexion".toString()
    apiPackage = "swagger_server"
    invokerPackage = "swagger_server"
    modelPackage = "models"
    additionalProperties = [
        packageName: "swagger_server",
        controllerPackage:  "controllers"
    ]

Pretty sure that only generatorName = "python-flask" is relevant.

For head of master, used a local docker build:

docker build .  

Get image ID from above command

docker run --rm -v ${PWD}:/local <ID> generate -i https://raw.githubusercontent.com/OpenAPITools/openapi-petstore/master/src/main/resources/openapi.yaml     -g python-flask     -o /local/out/py

Steps to reproduce
  1. Generate code for python-flask using petstore yaml (https://raw.githubusercontent.com/OpenAPITools/openapi-petstore/master/src/main/resources/openapi.yaml)

  2. Look at generated model for models/pet.py

There are no imports for Category or Tag

Related issues/PRs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions