Skip to content

Commit cbfcabb

Browse files
committed
fix: ensure MISSING defaults not shown in preview
1 parent c010110 commit cbfcabb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

quartodoc/ast.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,17 @@ def tuple_to_data(el: "tuple[ds.DocstringSectionKind, str]"):
160160

161161
@dispatch
162162
def fields(el: BaseModel):
163+
# TODO: this is the only quartodoc specific code.
164+
# pydantic seems to copy MISSING() when it's a default, so we can't
165+
# whether a MISSING() is the default MISSING(). Instead, we'll just
166+
# use isinstance for this particular class
167+
from .layout import MISSING
168+
163169
# return fields whose values were not set to the default
164170
field_defaults = {mf.name: mf.default for mf in el.__fields__.values()}
165-
return [k for k, v in el if field_defaults[k] is not v]
171+
return [
172+
k for k, v in el if field_defaults[k] is not v if not isinstance(v, MISSING)
173+
]
166174

167175

168176
@dispatch

0 commit comments

Comments
 (0)