Open jorgkv opened 3 years ago
If we think it is a good idea to use the auto-generated packages, they should be updated before we start using them.
Those python libraries will still basically return JSONs for single days, right? So while it might be a good idea, it won't allow us to remove any code från varsomdata, except some HTTP requests.
Or have I misunderstood what those libraries do?
If you look at getobservations.py
most of the classes there are just mapping returned json data to python classes.
Compare this class: https://github.com/NVE/varsomdata/blob/5c7b750998da1f72319529d22b2e8c0e76511ad7/varsomdata/getobservations.py#L1145
To this autogenerated class: https://github.com/NVE/python-varsom-regobs-client/blob/8bb7fc06d2f6da36a5fa4a475d4f036ebe3cfd72/varsom_regobs_client/models/avalanche_activity_obs_dto.py#L19
and you can see the autogenerated code is pretty similar.
By using the autogenerated code we could probably remove most of the code from getobservations.py
, and we have similar autogenerated apis and models for forecast apis as well.
We would have less control over how the mapping is done, so I am not saying it's the best solution, but we could probably remove a lot of code I think, and changes in the API would be easy to implement, mostly just autogenerating the api/models code again.
I did an experiment some time ago to auto-generate python apis using swagger:
They can be generated using asyncio or without. We should consider using these in varsomdata. I am not sure if it is a good idea or not, but we should discuss it here.