You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This problem occurs when exposing the Emulator models in the generated documentation. The issue appears to be brought on because the ListCommand class can't serialize what root is when generating the documentation:
lassListCommand(RootModel, _Command):
"""Use so that commands with __root__: Sequence[Command] behave like a list."""root: Sequence[Any]
def__iter__(self):
returniter(self.root)
def__getitem__(self, item):
returnself.root[item]
def__len__(self):
returnlen(self.root)
model_config=ConfigDict(arbitrary_types_allowed=True, populate_by_name=True)
This means that any emulated models built using it are raising errors when trying to parse the documentation. I'm not familiar enough with pydantic to understand how to fix this, so I'm removing them from the docs to see if that fixes things.
The warnings summary:
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.commands.SeasonalRelativeHeight' because the following pydantic fields can't be serialized properly: ['root'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.commands.SeasonalRelativeLAI' because the following pydantic fields can't be serialized properly: ['root'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.rvs.Config' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.rvs.RVP' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.BasicRoute' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.Blended' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.CanadianShield' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.GR4JCN' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.HBVEC' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.HMETS' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.HYPR' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.Mohyse' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.SACSMA' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.blended.Blended' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.canadianshield.CanadianShield' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.gr4jcn.GR4JCN' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.hbvec.HBVEC' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.hmets.HMETS' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.hypr.HYPR' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.mohyse.Mohyse' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.routing.BasicRoute' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
/home/tjs/git/RavenPy/docs/autodoc_pydantic.rst: WARNING: JSON schema can't be generated for 'ravenpy.config.emulators.sacsma.SACSMA' because the following pydantic fields can't be serialized properly: ['seasonal_relative_lai', 'seasonal_relative_height'].
Steps To Reproduce
Install autodoc-pydantic;
Enable the sphinxcontrib-autodoc-pydantic extension in docs/conf.py;
Add the imported models found in src/ravenpy/config/emulators/__init__.py to the __all__ listing;
Run $ make docs.
Additional context
It could be the case that the magic methods for the underlying classes aren't written to support the data they might be initialized with (Sequence[Any] could be a lot of things)? I'm not sure.
Setup Information
Description
This problem occurs when exposing the Emulator models in the generated documentation. The issue appears to be brought on because the
ListCommand
class can't serialize whatroot
is when generating the documentation:This means that any emulated models built using it are raising errors when trying to parse the documentation. I'm not familiar enough with
pydantic
to understand how to fix this, so I'm removing them from the docs to see if that fixes things.The warnings summary:
Steps To Reproduce
autodoc-pydantic
;sphinxcontrib-autodoc-pydantic
extension indocs/conf.py
;src/ravenpy/config/emulators/__init__.py
to the__all__
listing;$ make docs
.Additional context
It could be the case that the magic methods for the underlying classes aren't written to support the data they might be initialized with (Sequence[Any] could be a lot of things)? I'm not sure.
Relevant resources:
Contribution
The text was updated successfully, but these errors were encountered: