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

DGCBarcodeDecoder fails to decode a valid 1.0.0 test result #79

Open
aspruds opened this issue Jun 29, 2021 · 2 comments
Open

DGCBarcodeDecoder fails to decode a valid 1.0.0 test result #79

aspruds opened this issue Jun 29, 2021 · 2 comments

Comments

@aspruds
Copy link

aspruds commented Jun 29, 2021

DGCBarcodeDecoder fails to decode a valid test result which is created using "1.0.0" schema. In particular, field "dr" (Date/Time of Test Result) was valid, but optional field in schema "1.0.0", it is removed in schema "1.3.0". As a result, the decoder now fails. Would it be possible/feasible to support older schemas in addition to "1.3.0"?

Exception
se.digg.dgc.payload.v1.DGCSchemaException: Failed to decode DCC from CBOR encoding
at se.digg.dgc.payload.v1.DigitalCovidCertificate.decode(DigitalCovidCertificate.java:258) ~[dgc-schema-1.0.1.jar:na]
at se.digg.dgc.service.impl.DefaultDGCDecoder.decode(DefaultDGCDecoder.java:71) ~[dgc-create-validate-1.0.1.jar:na]

UnrecognizedPropertyException: Unrecognized field "dr" (class se.digg.dgc.payload.v1.TestEntry), not marked as ignorable (10 known properties: "tt", "tg", "ma", "ci", "is", "co", "tr", "nm", "sc", "tc"])"

Test data
https://github.com/eu-digital-green-certificates/dgc-testdata/blob/main/BG/2DCode/raw/5.json

Schemas
1.0.0: https://github.com/ehn-dcc-development/ehn-dcc-schema/blob/release/1.0.0/DGC.combined-schema.json
1.3.0 (dr is missing): https://github.com/ehn-dcc-development/ehn-dcc-schema/blob/release/1.3.0/DCC.combined-schema.json

@martin-lindstrom
Copy link
Collaborator

We'll try to add some sort of "ignore" flag for attributes that have been removed from older versions.

@htec-milan
Copy link

Hi Martin,

Would configuring CBOR mapper inside DigitalCovidCertificate to cborMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); do the trick in this case?

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

3 participants