-
Notifications
You must be signed in to change notification settings - Fork 82
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
core.GetProject api fails with error when trying to unmarshal response from azdo #17
Comments
Looks similar to this issue golang/go#9346 |
Thanks for reporting. I will look into it. |
Looking for feedback on this issue. I am new to Go, so hoping there is a better way to fix this issue. To fix the issue, I created a custom struct that has a time.Time property:
This allows the creation of a custom converter that checks for the error (we can't change the server behavior, so we have to adapt):
The benefit is that this is an easy fix, and we can handle other nuances with the Other options considered were to:
|
@tedchamb can we push on the AzDO team to fix their API response in the default case? Short of that, I think that your approach makes sense in the short term. The long term IMO is to fix the service as this will impact all the clients. |
Thanks, @nmiodice. I will definitely push for a fix on the server side, but the 5.1 api version is already released, and can't be changed. We also need to handle talking to already released Azure DevOps Servers. |
@tedchamb I am ok with current approach. We can handle that in the work we are doing for now. |
@nmiodice , @rguthriemsft , thanks for the feedback! I have pushed the PR. |
I looked into the code on our server side, and it turns out that this is the default deserialization format from newtonsoft for a default DateTime. You can repo this behavior with a simple program:
The console output from this is as follows:
This appears to be a bug in newtonsoft if I am reading the spec correctly. The rfc3339 spec shows that the After doing a quick search through newtonsoft code, it appears that min and max DateTime values are special cased intentionally. |
We have been trying to use the GetProject api passing in project name and getting an error that looks like it can't parse the lastUpdatedTime value in the response.
function that has the bug:
azure-devops-go-api/azuredevops/core/client.go
Line 330 in a196ec5
Error and struct returned:
parsing time ""0001-01-01T00:00:00"" as ""2006-01-02T15:04:05Z07:00"": cannot parse """ as "Z07:00"
&{ 0xc0002bae40 a790779a-4096-43b6-929f-1f1e47917f18 0001-01-01 00:00:00 +0000 UTC 0xc0002bae30 0xc0003305a0 0xc0002bae60 0xc0002bae50 0xc0002baf80 map[collection:map[href:https://dev.azure.com/csedevops/_apis/projectCollections/85fb3d5a-9f21-420f-8de3-fc80bf29054b] self:map[href:https://dev.azure.com/csedevops/_apis/projects/a790779a-4096-43b6-929f-1f1e47917f18] web:map[href:https://dev.azure.com/csedevops/tf_test]] 0xc00008e0e0 0xc0001d8380}
Example code that reproduces the error:
The text was updated successfully, but these errors were encountered: