Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][python] ClassCastException on specific configuration variables of python-flask generator #11854

Closed
4 of 6 tasks
MiltiadisKoutsokeras opened this issue Mar 11, 2022 · 0 comments · Fixed by #11916
Closed
4 of 6 tasks

Comments

@MiltiadisKoutsokeras
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Using any of the following configuration variables with python-flask generator results in the following error:

Exception in thread "main" java.lang.ClassCastException: class java.lang.Boolean cannot be cast to class java.lang.String (java.lang.Boolean and java.lang.String are in module java.base of loader 'bootstrap')
	at org.openapitools.codegen.languages.AbstractPythonConnexionServerCodegen.processOpts(AbstractPythonConnexionServerCodegen.java:191)
	at org.openapitools.codegen.DefaultGenerator.configureGeneratorProperties(DefaultGenerator.java:251)
	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:877)
	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:441)
	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

Configuration Variables:

  • featureCORS
  • testsUsePythonSrcRoot
  • useNose
  • usePythonSrcRootInImports

According to config-help --generator-name python-flask output these all should be boolean.

openapi-generator version

Latest Docker image

openapi-generator-cli 6.0.0-SNAPSHOT
  commit : 6f37409
  built  : 2022-03-10T08:57:57Z
OpenAPI declaration file content or url
openapi: "3.0.3"

info:
  title: Test python-flask generator
  version: "1.0.0"

paths:
  /test:
    get:
      responses:
        "200":
          description: OK
Generation Details

Using this configuration file

additionalProperties:
  featureCORS: false
  testsUsePythonSrcRoot: false
  useNose: false
  usePythonSrcRootInImports: false

And launching the Docker image:

docker run --name "openapi-generator-cli" --rm -u $(id -u ${USER}):$(id -g ${USER}) --mount type=bind,src=$(pwd),dst=/host openapitools/openapi-generator-cli:latest generate --input-spec /host/openapi/openapi.yaml --generator-name python-flask --config /host/openapi/python-flask-config.yaml --output /host/output/python-flask/ --verbose

Keeping any value in the configuration file still reproduces the problem.

Steps to reproduce

Just follow the steps above.

Related issues/PRs

Have not found any.

Suggest a fix

Nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants