swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[Python] Nullable bugfix in model.mustache

Open MalteEbner opened this issue 4 years ago • 12 comments

Description of the PR

Before bugfix: a required and nullable attribute set to null/None causes a ValueError when received by the client. After bugfix: This error is only caused for properties being required and not nullable General info: The python client cannot distinguish between unset attributes (value=None) and attributes set to null (value=None)

Issue to solve with a good description of the bug:

closes: https://github.com/swagger-api/swagger-codegen/issues/10535 closes: https://github.com/swagger-api/swagger-codegen/issues/8710

PR checklist

Performed tests:

Tested with own api-specs and the swagger-cli:

  • The generation works.
  • The two lines causing the error are removed in the python client, nothing else changes.

MalteEbner avatar Feb 11 '21 15:02 MalteEbner

Hi, any update on this? Do you know when it will be merged? Thank you (:

aarighi avatar May 27 '21 08:05 aarighi

Hi, any update on this? Do you know when it will be merged? Thank you (:

Sorry, I would love to see it merged, but do not know get the maintainers to do it.

MalteEbner avatar May 27 '21 08:05 MalteEbner

Hi, any update on this? Do you know when it will be merged? Thank you (:

Sorry, I would love to see it merged, but do not know get the maintainers to do it.

I don't know if it may be relevant, but from the PR preview it looks like there are missing tasks required to close it

img

Any idea on how to fix this? I guess all 4 must be checked before the PR can be merged

aarighi avatar May 27 '21 08:05 aarighi

Any idea on how to fix this? I guess all 4 must be checked before the PR can be merged

The tasks are one for each checkbox in the PR description. They are not necessary to get it merged, see https://github.com/swagger-api/swagger-codegen/pull/10985.

I guess the issue is rather that @kenjones-cisco did not find the time to review and he's responsible for the python part: https://github.com/swagger-api/swagger-codegen/#swagger-codegen-technical-committee

MalteEbner avatar May 27 '21 10:05 MalteEbner

Any progress here? Does something need to be changed in this PR or not to be good to merge and fix this problem? Thanks for the info!

fedepad avatar Nov 11 '21 15:11 fedepad

Any progress here? Does something need to be changed in this PR or not to be good to merge and fix this problem? Thanks for the info!

I guess the problem is that @kenjones-cisco is still not active. Perhaps you could update us here @HugoMario, as you have been the last to update this file, according to the git blame.

MalteEbner avatar Nov 11 '21 16:11 MalteEbner

I just ran into this problem as well, would be great if we can get this merged and released. I will have to work around it by just removing all the required attributes from the JSON file before generating code, which isn't ideal.

Here is the jq command I used to do that in case anyone else wants to do the same workaround: jq 'del(.definitions | .. | .required?)' api.json > api.processed.json

Not sure who can approve but just from the recent people who have committed code, can anyone help? @frantuma, @HugoMario, @gracekarina

bonnici avatar Feb 07 '22 05:02 bonnici

How can we get this change merged? I can't believe it's been there for more than a year.

ampuerod avatar Mar 18 '22 16:03 ampuerod

@HugoMario @keithbsb this seems like a pretty easy change for any maintainer to move along. Thoughts on helping us out?

mhaley-tignis avatar Sep 21 '23 19:09 mhaley-tignis

We also ran into this bug.

Maybe @frantuma could unblock us all here? He seems to be the most recent active maintainer 😁

antoineauger avatar Jan 08 '24 14:01 antoineauger

I'm also running into this issue.

DavidMetaphysic avatar Jun 27 '24 17:06 DavidMetaphysic