SolarEdgeTech / pyctuator

Monitor Python applications using Spring Boot Admin
Apache License 2.0
175 stars 17 forks source link

FastAPI: AttributeError: type object 'HealthSummary' has no attribute '__pydantic_model__' #90

Closed uwohlfeil closed 1 year ago

uwohlfeil commented 1 year ago

The current version of FastAPI (0.92.0) does not seem to work with the current Pyctuator (1.0.1).

I found a discussion about this in FastApi's GIT: https://github.com/tiangolo/fastapi/issues/3636

The cause of the problem seems to be a change in the Change https://github.com/tiangolo/fastapi/pull/3576 .

The built-in dataclasses do not seem to be fully compatible with FastAPI when using enums.

As a test, I changed the dataclasses in health/health_provider.py to:

from pydantic.dataclasses import dataclass

And it works again.

Update: The error does not occur in FastAPI version 0.88.0.

michaelyaakoby commented 1 year ago

Thanks, will try to get to this soon.

michaelyaakoby commented 1 year ago

This is the same issue as #87. Fixed in https://github.com/SolarEdgeTech/pyctuator/pull/91

michaelyaakoby commented 1 year ago

Version 1.0.2

uwohlfeil commented 1 year ago

@michaelyaakoby Thank you very much for your work. Just test it and it works.