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] missing explanation why it uses connexion and not flask #15062

Open qyanu opened 1 year ago

qyanu commented 1 year ago

Bug Report Checklist

Description

The generator "python-flask" indeed does not generate anything related to flask (https://flask.palletsprojects.com/), but uses connexion (https://pypi.org/project/connexion/).

While this is technically mentioned in the helpText (e.g. google searchable here https://openapi-generator.tech/docs/generators/python-flask/ ) and also mentioned in the generated/README.md, this is surprising nonetheless.

I would have expected for the generator to have the name 'python-connexion' if indeed the connexion library is used, and to have the name 'python-flask' only if the generated code is somewhat related to the usage of flask according to flask's user-guide (e.g. https://flask.palletsprojects.com/en/2.2.x/quickstart/#a-minimal-application ).

My guess is, that there is some historical reason to the current naming of this python generator. However, indeed the current naming blocks for example me from writing another python generator that produces code using the flask library.

openapi-generator version

I have downloaded the 6.4.0 version of the generator as follows:

$ wget -q -O openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.4.0/openapi-generator-cli-6.4.0.jar
$ sha256sum -b openapi-generator-cli.jar
35aead300e0c9469fbd9d30cf46f4153897dcb282912091ca4ec9212dce9d151 *openapi-generator-cli.jar
OpenAPI declaration file content or url
%YAML 1.2
---
openapi: "3.1.0"
info:
  version: "0.1.0"
  title: "Example API"
servers:
  - url: /
paths:
  /hello:
    summary: a greeting from the server
    get:
      operationId: hello-get
      responses:
        200:
          description: "a greeting from the server"
          content:
            application/json:
              schema:
                type: object
                properties:
                  version:
                    type: string
                    description: >-
                      the software version running at the server
Generation Details

The code was generated as follows:

$ java -jar ./openapi-generator-cli.jar generate -g python-flask -i ./example.yaml -o generated > openapi-generate-output.txt
Related issues/PRs

none found

Suggest a fix
MaxTrautwein commented 1 month ago

This Issue still persists.

And its not "just" python-flask, almost all python Servers face the same issue

In fact, the only Python Server Implementation that actually generates what one would expect is python-fastapi