Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Incorrect Instant serialization to JSON #66

Closed
jozemlakar opened this issue Jun 7, 2021 · 5 comments
Closed

Incorrect Instant serialization to JSON #66

jozemlakar opened this issue Jun 7, 2021 · 5 comments

Comments

@jozemlakar
Copy link

We are using dgc-java in Slovenia, forked at https://github.com/ixtlan-team/dgc-java
We have prepared the DGCs and found that for "test" DGCs that include sc field, we get a value of:
"sc": "2021-06-04T10:46:25.619935900Z"
This value is not well recieved by the verification app, as fraction has too many digits (9).
We have also found that in samples submitted by SE, value is
'"sc": "2021-06-02T06:02:13.262564Z"'
This value is correct, it has 6 digits in fraction.

You can disregard this issue and mark it closed and we will try and resolve the issue on our own. But if you feel that you want this resolved for you as well, then let us know, what the preffered way would be.

From what we found the correct way would be to fix the 'ObjectMapper jsonMapper' in 'DigitalCovidCertificate'.
Alternative would be to add JsonFormatter to the Instant field in 'TestStatement'

@martin-lindstrom
Copy link
Collaborator

@jozemlakar Thanks for pointing it out. The PR #67 fixes this.

@jozemlakar
Copy link
Author

PR #67 removes all fractions. As test show, it should hold EXACTLY 6 digits for fractions.

jozemlakar added a commit to ixtlan-team/dgc-java that referenced this issue Jun 7, 2021
@martin-lindstrom
Copy link
Collaborator

6 fractions? From where did you get that information?

From the specification:

The date and time when the test sample was collected. The time MUST include information on the time zone. The value MUST NOT denote the time when the test result was produced.

Exactly 1 (one) non-empty field MUST be provided.

One of the following ISO 8601 formats MUST be used. Other options are not supported.

YYYY-MM-DDThh:mm:ssZ 
YYYY-MM-DDThh:mm:ss[+-]hh 
YYYY-MM-DDThh:mm:ss[+-]hhmm 
YYYY-MM-DDThh:mm:ss[+-]hh:mm 

Examples:

"sc": "2021-08-20T10:03:12Z"	(UTC time) 
"sc": "2021-08-20T12:03:12+02"	(CEST time) 
"sc": "2021-08-20T12:03:12+0200"	(CEST time) 
"sc": "2021-08-20T12:03:12+02:00"	(CEST time) 

@jozemlakar
Copy link
Author

Yes, I am aware of the spec. However test on dgc-testdata denied samples with 0 fraction digits. Tests might be wrong.

@martin-lindstrom
Copy link
Collaborator

martin-lindstrom commented Jun 7, 2021 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants