depsdev
depsdev copied to clipboard
Project structure contains field with wrong type
Describe the bug
Some field of the Project struct have changed type on deps.dev service and are not updated in this library. Fields are:
- OpenIssuesCount
- StarsCount
- ForksCount
They all should be integer instead of string.
To Reproduce Steps to reproduce the behavior:
- Check response from API call of
getProject
endpoint:
- https://api.deps.dev/v3/projects/github.com%2Ffacebook%2Freact
- https://api.deps.dev/v3/projects/github.com%2Fedoardottt%2Fdepsdev
Expected behavior This library should update the type of the field to string so it can properly decode the json sent by deps.dev API.
I can open a PR to solve the issue. And I think it would be good to also add a workflow that run periodically to ensure this kind of problem is catch as early as possible. I can also draft a GitHub Action workflow that does that if you want.
Thanks @zaibon .
Seems they are in a moment when things change frequently https://github.com/google/deps.dev/issues/47.
And I think it would be good to also add a workflow that run periodically to ensure this kind of problem is catch as early as possible. I can also draft a GitHub Action workflow that does that if you want.
How? There isn't an openapi file as far as i know. I've setup a change monitor instance for this and I was aware of this change. The main problem is that I'm working full time and I don't have too much time to spend on OS projects for now :(
Also, as you can see in the issues, I'm trying to align the project with the current implementation.
- package v3 for the v3 API (stable, https://docs.deps.dev/api/v3/)
- package v3alpha for the v3alpha API (unstable and frequent changes, https://docs.deps.dev/api/v3alpha/)
How? There isn't an openapi file as far as i know. I've setup a change monitor instance for this and I was aware of this change. The main problem is that I'm working full time and I don't have too much time to spend on OS projects for now :(
My idea is to define a bunch of tests in the code that does actual call to the API and verify the output corresponds to what we expect. We can run this for each PR and also like once a week automatically. This would catch any unmarshal error very early and help to keep in sync with the dev.deps API.
I don't mind helping to support and contribute the fixes when this kind of breaking change happens since I'm actually using this library for my project.
We can run this for each PR and also like once a week automatically.
I see that on the devel branch, you already started creating these tests in https://github.com/edoardottt/depsdev/blob/devel/pkg/depsdev/v3/api_test.go
So the only thing left to do, would be to define a schedule in the Go workflow.
TBH I don't think this is reliable.
Consider that those tests use my own projects and not all the APIs are tested. If as example tomorrow I'll drop a new release of defangjs, the action will fail (https://github.com/edoardottt/depsdev/blob/devel/pkg/depsdev/v3/api_test.go#L31).
You've used defangjs for TestGetProject
too, what if tomorrow someone stars the repo? The stars gonna be 23 and not 22 and the test (so the action) will fail...
That's right, checking the actual value won't be deterministic. But we can probably skip that, since the goal was really just to ensure the unmarshaling process is valid.
That's right, checking the actual value won't be deterministic. But we can probably skip that, since the goal was really just to ensure the unmarshaling process is valid.
makes sense
Thanks for you contribution @zaibon !