fhir_models
fhir_models copied to clipboard
Note from_contents functionality - don't merge
Note functionality of from_contents function:
When using from_contents for json, it will keep any conforming parts and get rid of the rest. It logs an error on the line FHIR.from_contents(json), and there is no error on cap.to_json. In the example in bad_capability.json, the resource field is deleted.
FYI @radamson -- After Nicole put together a test to highlight the issue that you saw, it looks like this behavior is intentional. fhir_models logs the error and parses what it can. It isn't breaking on to_json.
From a testing perspective, this is bad because we don't know that parts of the json that we parsed are invalid, we just know that parts are valid. I don't know if we want to change the behavior of fhir_models, or if we should add some kind of "_errors" element generically, or if we should just manage this in Inferno.