Closed PipeKnight closed 2 years ago
So maybe it's the problem with supporting sqlmodel
library in your extension, which is something like a bridge between pydantic
and sqlalchemy
Thanks for reporting the issue here! It is very likely related to sqlmodel. There is a similar issue here #124. I will take a look at it soonish.
Okay, this is related to what a Relationship
represents in sqlmodel
. In fact, it is not a field (or column) of a pydantic model (or sqlalchemy table).
autodoc_pydantic
currently assumes all class attributes of a parent pydantic model to be a pydantic field which is simply wrong in this case. It will require an additional, more explicit check if a class attribute of a pydantic model parent is truly a pydantic field. Luckily, this is not too difficult to implement and it should actually prevent further unwanted side effects.
This bug is addressed via #130 .
Before merging the related PR, it would be great if you could test the bugfix on your site. To do so, please install the current dev release in your doc-building-environment via pip install git+https://github.com/mansenfranzen/autodoc_pydantic.git@v1.7.2-a.1
and rebuild your docs.
@all-contributors please add @PipeKnight for bug
@mansenfranzen
I've put up a pull request to add @PipeKnight! :tada:
@PipeKnight This should be fixed with the current v1.7.2
release of today. Feel free to reopen if the issue persists.
Full error trace:
My conf file:
I have several models in my app with field named
created_by
, for example:And for some reason this broke my docs generation. If I comment
'sphinxcontrib.autodoc_pydantic'
inconf.py
extensions, than everything works