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] generateSourceCodeOnly value is not checked properly #2066

Closed
qbedard opened this issue Feb 5, 2019 · 5 comments
Closed

[BUG] [PYTHON] generateSourceCodeOnly value is not checked properly #2066

qbedard opened this issue Feb 5, 2019 · 5 comments

Comments

@qbedard
Copy link
Contributor

qbedard commented Feb 5, 2019

Description

This is the code from PythonClientCodegen.java that checks the config property for generateSourceCodeOnly:

Boolean generateSourceCodeOnly = false;
if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) {
    generateSourceCodeOnly = true;
}

It's pretty obvious that when the config json includes:

{
    "generateSourceCodeOnly": false
}

...the above code will incorrectly set generateSourceCodeOnly to true.

openapi-generator version

4.0.0

OpenAPI declaration file content or url

< any valid declaration file >

Command line used for generation

openapi-generator generate -i openapi.yaml -g python -c config.json

Steps to reproduce

Run the above command on a valid declaration file with generateSourceCodeOnly set to false in the config.json.

Suggest a fix

Actually set the value to what's in the config.

Boolean generateSourceCodeOnly = false;
if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) {
    generateSourceCodeOnly = convertPropertyToBoolean(CodegenConstants.SOURCECODEONLY_GENERATION);
}
@auto-labeler
Copy link

auto-labeler bot commented Feb 5, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@wing328
Copy link
Member

wing328 commented Feb 6, 2019

I think it should be fixed by #2015. Please give the latest master a try.

Closing this for the time being. We'll reopen it if it's still an issue.

@wing328 wing328 closed this as completed Feb 6, 2019
@wing328 wing328 added this to the 4.0.0 milestone Feb 6, 2019
@qbedard
Copy link
Contributor Author

qbedard commented Feb 6, 2019

Searched but still missed it. Thanks.

@wing328
Copy link
Member

wing328 commented Feb 7, 2019

if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) {
generateSourceCodeOnly = convertPropertyToBoolean(CodegenConstants.SOURCECODEONLY_GENERATION);
}

Do you mind filing a PR with your suggested fix if it's still an issue?

@wing328 wing328 reopened this Feb 7, 2019
@qbedard
Copy link
Contributor Author

qbedard commented Feb 7, 2019

Nah, #2015 fixed it.

@qbedard qbedard closed this as completed Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants