Port CreatedAt and UpdatedAt: add back JSON tags#2477
Port CreatedAt and UpdatedAt: add back JSON tags#2477mandre merged 1 commit intogophercloud:masterfrom
Conversation
Removing them in 48581da was not necessary. Removing them might break client-side serialisation.
7231923 to
bca650e
Compare
|
One reason might be that when sending the JSON representation of a Port to the OpenStack API, maybe if you send the "wrong" time representation you get an error. For a field that would be ignored anyway. Just guessing. |
|
@pierreprinetti Sorry for the late reply. This area of code is only for results returned from the API. Requests being sent to the API shouldn't be hitting this code. The tags were removed so that parsing was picked up by the In that method, two different time formats are supported, noted in However, if The goal being to support an older style timestamp and a more general/generic timestamp simultaneously. Let me know if this helps. |
|
@jtopjian In a Go playground I have implemented a simplified Port type, and copy-pasted the UnmarshalJSON method. CreatedAt and UpdatedAt have tags. Decoding seems to work: https://go.dev/play/p/FlTrhozjqZr What am I missing? |
|
hm... So keeping the JSON tags still causes those fields to be processed in the |
|
Thanks again @jtopjian. WDYT @mandre? |
No strong feeling either way. Let's merge it then, so that the struct doesn't change. |
Removing them in 48581da was not necessary. Removing them might break client-side serialisation.