Skip to content
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

Cannot generate documentation when having class with arbitrary types #182

Open
tkaraouzene opened this issue Nov 8, 2023 · 1 comment
Open
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@tkaraouzene
Copy link

Hello and thank you for this library,

I have a class with arbitrary types such like:

from collections.abc import AsyncIterator

class MyClass(BaseModel):
    stream: AsyncIterator[bytes]

    model_config = ConfigDict(arbitrary_types_allowed=True)

And doc generation crashes with following error:

 WARNING: JSON schema can't be generated for 'MyClass' because the following pydantic fields can't be serialized properly: ['stream']

sphinx: 6.2.1
pydantic: 2.4.0
autodoc_pydantic: 2.0.1

@mansenfranzen
Copy link
Owner

@tkaraouzene thanks for raising the issue here!

To clarify your problem: Does the documentation build process completely fail?

The emitted warning which you have shared is expected. This behaviour can be configured, see here.

@mansenfranzen mansenfranzen added documentation Improvements or additions to documentation question Further information is requested labels Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants