-
Notifications
You must be signed in to change notification settings - Fork 529
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
String field for timestamp has incorrect formatting in this client library #2040
Comments
It's not clear to me which library you are using as there are over a hundred in this repo. In any case chances are that the CreateTime property of the connection has been defined by the API as a datetime or timestamp or similar type and not as a string, in which case the library will correctly expose it as a System.DateTime. You can print a DateTime in whatever format you want, see here https://docs.microsoft.com/en-us/dotnet/api/system.datetime.tostring. |
In addition to this, date/time values with a [Newtonsoft.Json.JsonPropertyAttribute("time")]
public virtual string TimeRaw { get; set; }
[Newtonsoft.Json.JsonIgnoreAttribute]
public virtual System.Nullable<System.DateTime> Time
{
get => Google.Apis.Util.Utilities.GetDateTimeFromString(TimeRaw);
set => TimeRaw = Google.Apis.Util.Utilities.GetStringFromDateTime(value);
} Date/time values with a type of |
Thanks, I see in the discovery document this field has the type of In the meantime, I'll see if it's possible for us to adjust to |
It's far from ideal, but we can't change it now. What we can do is:
We'd need to think about how these related properties interact with each other, but fundamentally we can add new properties without breaking anything; we can't change existing properties. |
Both of those options sound like worthwhile improvements and dodge the issue of introducing a breaking change, +1. At the very least, the first option would resolve this specific issue if there were some reason we couldn't use On that note–and we can continue this line of discussion internally–we're not quite sure how to influence the format such that it would change in the discovery document from |
Will start an internal discussion tomorrow. |
Just as a status update: we do have a plan around this now, but it's relatively low priority. |
Understood, that makes sense. Thanks for the update. |
This will implement the changes for googleapis#2424 and googleapis#2040.
This didn't end up in generator 1.4.18, but is in 1.4.19. Due to release process details, this means the new properties (with Raw and DateTimeOffset suffixes) will only appear as APIs are changed in other ways, or when we do the next support library release. I expect this to be sufficient though, so I'll close this issue now. |
I'm developing samples for several client libraries. For this library, I see that a
string
field containing a formatted timestamp is instead returned as anobject
. Additionally, attempting to print its contents returns a formatted date and time that does not match what is sent over the wire. For example, the Python client library correctly returns "2021-08-18T16:26:05.695663Z" in RFC3339 UTC format, whereas this library returns "8/18/2021 4:26:05 PM". It looks like this library is modifying the formatting of the string timestamp, but we want to use the original formatting.Environment details
Steps to reproduce
The above should print the string as it is returned in the response, but it instead has some other human-readable formatting applied.
Feel free to contact me internally for additional details.
The text was updated successfully, but these errors were encountered: