Would anyone know of a way to remove the enforced default:None
when converting an OpenApi 3.0.1 yaml document to Pydantic models for later usage?
As of now I see that every model has the following (unless an default value is explicitly stated in the yaml):
self: Optional[str] = Field(
None,
description='blah blah'
)
My issue is that when comes time to validate a JSON response, some fields which should be part of the model against which the response is validated are ignored without error. However, I've noticed that when the None default field value is removed, then errors are captured (missing or invalid field).
Maybe I'm missing something here. I thought the --strip-default-none
would remove None but it is not.
Any ideas would be appreciated.
Thanks!
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too