-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
featureNew feature or requestNew feature or requestgriffe extensionCan be solved with a Griffe extensionCan be solved with a Griffe extension
Description
Is your feature request related to a problem? Please describe.
Similar to #27, it would be beneficial to add support for pydantic-xml within griffe-pydantic.
Currently, griffe-pydantic only handles Pydantic BaseModel classes, but does not recognize or enrich pydantic_xml.BaseXmlModel subclasses.
Describe the solution you'd like
Extend griffe-pydantic so subclasses of pydantic_xml.BaseXmlModel are treated like BaseModel subclasses, exposing their fields in extra metadata and rendering them through mkdocstrings templates.
At a minimum:
- Compatibility with existing
griffe-pydantictemplates
Ideally (nice-to-have):
-
Extraction of XML binding metadata (from
pydantic-xmlfield markers)attr(...)→ attributeelement(...)/ default field → elementwrapped(...)→ nested elementtext(...)→ text node- namespace / root element info when available
Describe alternatives you've considered
- Documenting these models manually in Markdown.
- Falling back to plain
BaseModelfor docs (but losing the built-in XML support)
Additional context
Here’s a small example that illustrates the bindings:
from pydantic_xml import BaseXmlModel, attr, element, text, wrapped
class Item(BaseXmlModel, tag="Item"):
id: int = attr(name="id")
name: str = element(name="Name")
description: str | None = text()
long_description: str | None = wrapped('LongDescription/Text')It would be great if griffe-pydantic could expose both the normal Pydantic field info and the XML mapping (id → attribute, name → element, description → text).
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or requestgriffe extensionCan be solved with a Griffe extensionCan be solved with a Griffe extension