-
Notifications
You must be signed in to change notification settings - Fork 27
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
PydanticUndefined is shown even if there is a default_factory #114
Comments
Thanks for pointing this out! Technically, it is correct to have the However, for documentation purposes, a rather non technical label/marker is more appropriate, I agree. You've proposed the I suggest we add a new configuration property named |
Normally I am a huge fan of keeping things short but this is imho one of the times where I think explicit is better than implicit.
If there is no How about the opposite of The config switch could than be named |
You have convinced me - let's be more explicit. In support of your point, the optional/required tag might be even necessary even if the type already contains
I added an example section outlining all these possibilities here. Taking a closer look at this example, it becomes evident that all So, taking this into account, what about |
I think On the other hand the required marker uses Thank you for your help! |
Let's go with |
@spacemanspiff2007 This feature request should be accomplished via #117
By the way, I took the chance to modify how the default value is fetched from pydantic fields. This results in properly showing the default value Before merging the related PR, it would be great if you could test the behavior on your site. To do so, please install the current dev release in your doc-building-environment via |
Currently
PydanticUndefined
is shown if there is a default factory.Source
Output

I think
PydanticUndefined
is a bit misleading since the default is not undefined.How about
[has default]
(so it's the same as with[required]
) so it's clear that the field will have a default when created.Possible output:
The text was updated successfully, but these errors were encountered: