Skip to content

Conversation

@MalteEbner
Copy link

@MalteEbner MalteEbner commented Feb 11, 2021

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: #10535
closes: #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.

Before bugfix: a required and nullable attribute set to null/None causes a value error 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)
@MalteEbner MalteEbner changed the title [Python] Bugfix in model.mustache [Python] Nullabel bugfix in model.mustache Feb 11, 2021
@MalteEbner MalteEbner changed the title [Python] Nullabel bugfix in model.mustache [Python] Nullable bugfix in model.mustache Feb 11, 2021
@aarighi
Copy link

aarighi commented May 27, 2021

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

@MalteEbner
Copy link
Author

MalteEbner commented May 27, 2021

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.

@aarighi
Copy link

aarighi commented May 27, 2021

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

@MalteEbner MalteEbner changed the base branch from master to 3.0.0 May 27, 2021 10:25
@MalteEbner MalteEbner changed the base branch from 3.0.0 to master May 27, 2021 10:29
@MalteEbner
Copy link
Author

MalteEbner commented May 27, 2021

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
#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

@fedepad
Copy link

fedepad commented Nov 11, 2021

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!

@MalteEbner
Copy link
Author

MalteEbner commented Nov 11, 2021

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.

@bonnici
Copy link

bonnici commented Feb 7, 2022

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

@ampuerod
Copy link

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

@mhaley-tignis
Copy link

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

@antoineauger
Copy link

We also ran into this bug.

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

@DavidMetaphysic
Copy link

I'm also running into this issue.

@VKlueber
Copy link

I´m also running in this issue.

@mohit1337
Copy link

Can this be please merged? It is perfectly fine to have required fields which are nullable. Having a key marked as required just means it will be present in the output, it doesn't make any guarantees about the value, and null is a perfectly valid value.

thibgc added a commit to lockss/lockss-parent-pom that referenced this pull request Sep 13, 2025
…r-api/swagger-codegen#10906). Need to reorder the plugins because this requires Antrun before Swagger-Codegen but also Surefire has a position constraint relative to Antrun.
thibgc added a commit to lockss/lockss-pyclient that referenced this pull request Sep 13, 2025
@daniel-kmiecik
Copy link
Contributor

I need to create a new PR request because there were problems building the PR from the fork. New PR is #12630. The author of change is still @MalteEbner. Thank you very much for your contribution and patience. Fix should be released in next week.

@thibgc
Copy link

thibgc commented Oct 30, 2025

#12630 was merged into master, and is now part of release 2.4.49 two days ago! Thank you @daniel-kmiecik! 🥳

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PYTHON] Generated code disregards nullable flag [Python] Generated code does not respect nullable values