-
Notifications
You must be signed in to change notification settings - Fork 96
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
Generated Unmarshal for fields with time.Time
#159
Comments
Hi @rbellido-ut thanks for reporting this issue, I will look into it! |
@rbellido-ut I can't seem to reproduce your error, but I get a different one as |
I investigated the matter a bit today and it seems the problem is a bit more complex than I expected, as we are dealing with a nullable reference type here, which makes implementing custom unmarshalling the value correctly a bit of a challenge. I will try to see if I can find a solution in the next days, let's see. |
Hi, I think I may have a related problem. I'm operating on https://csrc.nist.gov/schema/nvd/api/2.0/cve_api_json_2.0.schema, and having invoked it as
A sample of what I'm trying to decode is (see https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2023-4863):
Whilst debugging why decoding was failing, I noticed this error:
I've been having some fun decoding the ISO 8601 format the NVD is using (see also https://mastodon.au/@andrewpollock/111447117663929594) I'm not actually understanding how the time format "2006-01-02T15:04:05Z07:00" is getting arrived at. I know this is the time.RFC3339 constant, but I'm not seeing how things are defaulting to this? I think if I can override this (somewhere) to be "2006-01-02T15:04:05.999" instead, I might be in business... |
@omissis @rbellido-ut wondering if you found a workaround to this? I believe I'm observing the same bug, before marshaling, my |
hey @dstubbersfield unfortunately I haven't. I am trying to prioritise the open PRs over the issues, hopefully I will get there soon enough. |
This JSON schema generates the following types and
UnmarshalJSON
method:The
json.Unmarshal(data, &cloudevent)
for it results in an error:Is there a way for the generated
UnmarshalJSON
to account for Unmarshalling theTime
field?We've resorted to implementing our own
UnmarshalJSON
and passing--only-models
in the generate command for the time being.The text was updated successfully, but these errors were encountered: