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

Use autogenerated python apis for regobs, warning apis, etc #6

Open
jorgkv opened this issue Feb 18, 2021 · 4 comments
Open

Use autogenerated python apis for regobs, warning apis, etc #6

jorgkv opened this issue Feb 18, 2021 · 4 comments

Comments

@jorgkv
Copy link
Contributor

jorgkv commented Feb 18, 2021

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.

@jorgkv
Copy link
Contributor Author

jorgkv commented Feb 18, 2021

If we think it is a good idea to use the auto-generated packages, they should be updated before we start using them.

@widforss
Copy link
Member

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?

@jorgkv
Copy link
Contributor Author

jorgkv commented Mar 8, 2021

If you look at getobservations.py most of the classes there are just mapping returned json data to python classes.

Compare this class:

class AvalancheActivityObs(Registration, Location, Observer, Pictures):

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.

@jorgkv
Copy link
Contributor Author

jorgkv commented Mar 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants