TheJacksonLaboratory / PhenopacketLab

An Angular/Springboot web application for the loading, editing, saving of data that follows the Phenopacket Schema
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

Clearing field produces an invalid value #293

Closed ielis closed 1 year ago

ielis commented 1 year ago
  1. Start creating phenopacket with stepper/creator
  2. Add required individual fields (unrelated to the issue but to make the code work)
  3. Select Age from the dropdown, in order to add individual's age.
  4. Clear Age by clicking on the cross in the dropdown
  5. Proceed to validate, confirm absence of personal info, and click Complete

Issue

The validator correctly points out presence of errors:

image

The errors are unfixable unless the user adds age despite not wanting to. Of course, he must also know that.

This is likely caused by sending a phenopacket with a phenopacket with empty object instead of valid timeAtLastEncounter value:

..
"subject": {
   "id": "jimmy",
   "taxonomy": {
      "id": "NCBITaxon:9606",
      "label": "Homo sapiens"
   },      
   "timeAtLastEncounter": {}
}
..

Note "timeAtLastEncounter": {}

However, {} is not a valid value of the field.

DOD

Clearing an optional field won't leave an empty object in place.

BethSundberg commented 1 year ago

Fixed, checked this with several other fields and no problems