-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I think I found a regression about this. We're using the Annotated class + pydantic to validate types of a user-defined config in conf.py...
CSSClassType = Annotated[str, pydantic.AfterValidator(nodes.make_id)]
class CustomAdmonitionConfig(pydantic.BaseModel):
title: Annotated[Optional[str], pydantic.Field(validate_default=True)] = None
classes: List[CSSClassType] = []But autodoc-ing CustomAdmonitionConfig's title and classes attributes results in errors trying to reference the metadata:
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/sphinx_immaterial/custom_admonitions.py:docstring of sphinx_immaterial.custom_admonitions.CustomAdmonitionConfig.title:1: WARNING: py:obj reference target not found: typing.Annotated[str | None, FieldInfo(annotation=NoneType, required=True, validate_default=True)]
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/sphinx_immaterial/custom_admonitions.py:docstring of sphinx_immaterial.custom_admonitions.CustomAdmonitionConfig.classes:1: WARNING: py:obj reference target not found: typing.List[~typing.Annotated[str, AfterValidator(func=<function make_id at 0x7fd2a7b5cae0>)]]
I think lesson here is that not all metadata is compatible with autodoc. Is there a way to disable it?
Originally posted by @2bndy5 in #11785 (comment)