openapi-core
openapi-core copied to clipboard
Nullable field or schema not validating for None
Hi,
I've just upgrade openapi-core on my project to 0.13.3, after some months without upgrading, and now nullable schemas are not validating None
values anymore.
I found a commit which seems to fix the issue: https://github.com/p1c2u/openapi-core/commit/7307794656106323b1f46cebd7525fcb265f5f28 - but this seems to have been fixed after the latest tag.
Can you release a new patch version, with the most recent fixes, please? I use nullable schemas quite a lot, and need that fix...
Thanks!
Actually, just since I already created this ticket, there's a very similar issue still going on in the latest version from master
: nullable arrays don't work, if I pass None
it just fails instead of accepting the value. The reason is, the ArrayUnmarshaller
tries to list(map(self.items_unmarshaller, value))
when the value is None
, hence raising a NoneType
error.
Reproducing the same issue.
Unfortunately, this project going to be dead soon (I would say), it seems that author has no time at all, which is fully understandable, but if there is no release for longer time for some already fixed issues, not sure is it worth to contribute here at all (I usually fix issue locally, but that's not it).
If I got time, I will try to create PR for this.
I wouldn't say the project is "going to be dead soon"; It's just that the author, @p1c2u , hasn't been much active on it, but recently I got some replies on tickets here. Maybe it's worth considering adding more people as direct collaborators of the project.
Maybe it's worth considering adding more people as direct collaborators of the project.
That's the key! Without that, there is no too much sense in providing fixes without possibility to release, even potential smaller issues are better than issue with paths resolving. In any case, when (i.e. if) that happens, I'm here to help with PRs.
Looks like a new tag was cut in July, so this issue is moot? https://github.com/p1c2u/openapi-core/commit/0aeb14477bd881247856a8ab520b5adf4223573d
I do not think that fix for this issue is included in the last release, but you can check.
To correct myself (from previous comment) - handling nullable
is partially fixed in the latest release (0.13.4
), but still having two issues:
- When
nullable
is set for arrays (i.e.type: array
&nullable: true
),null
value not being properly validated, instead, it raising error:'NoneType' object is not iterable
. So, the same issue that diogobaeder reported in the second post. - When
nullable
is set for date-time (i.e.type: string
,format: date-time
&nullable: true
),null
value sometimes not being properly validated, instead, it raising error:Parser must be a string or character stream, not NoneType
. So, validatingnull
value for date-times working fine in some cases, but not in others (when it raising mentioned error). Still not sure what is the root cause of such behavior (if I figure out, will report that here).
@stojan-jovic I address the first case in #276.
What do we think ?
any news on this issue?
This is still an issue:
"message": "None for not nullable"
Still an issue. I just updated openapi-core in my project and all of a sudden I started getting that error for a schema model that is nullable
. This is the schema, with the description
simplified:
{'description': 'something something.',
'format': 'uuid',
'nullable': True,
'type': 'string'}
This leads me to:
None is not of type 'string'
Almost same error for:
{'additionalProperties': True,
'description': 'something something.',
'nullable': True,
'type': 'object'}
and almost the same for:
{'format': 'date-time', 'nullable': True, 'type': 'string'}
I see this as a pretty big issue on the current version.