Empty strings are not supported in FHIR

XMLWordPrintableJSON

    • Type: Change Request
    • Resolution: Persuasive with Modification
    • Priority: Medium
    • FHIR Core (FHIR)
    • STU3
    • Modeling & Methodology
    • Normative
    • Datatypes
    • Hide

      Will update the existing wording of "Leading and Trailing whitespace is allowed, but SHOULD be removed when using the XML format" to append: "Note: this means that a string that consists only of whitespace could be trimmed to nothing, which would be treated as an invalid element value. Therefore strings SHOULD always contain non-whitespace content."

      Will ensure the validator rejects empty elements.

      The v2 mechanism of using "" to wipe content is not supported in FHIR because FHIR always operates in snapshot mode when sending the full resource. Any omitted element is "to be removed". Any element to be retained must be sent with its full value. The alternative is to use PATCH and only send differences. This is already discussed in the last bullet here: http://build.fhir.org/comparison-v2.html#7.17.1.2

      Show
      Will update the existing wording of "Leading and Trailing whitespace is allowed, but SHOULD be removed when using the XML format " to append: "Note: this means that a string that consists only of whitespace could be trimmed to nothing, which would be treated as an invalid element value. Therefore strings SHOULD always contain non-whitespace content." Will ensure the validator rejects empty elements. The v2 mechanism of using "" to wipe content is not supported in FHIR because FHIR always operates in snapshot mode when sending the full resource. Any omitted element is "to be removed". Any element to be retained must be sent with its full value. The alternative is to use PATCH and only send differences. This is already discussed in the last bullet here: http://build.fhir.org/comparison-v2.html#7.17.1.2
    • Grahame Grieve/Ron Shapiro: 3-0-0
    • Enhancement
    • Non-substantive
    • STU3

      According to the JSON Representation spec

      "String property values can never be empty. Either the property is absent, or it is present with at least one character of content"

      The XML Representation spec says something similar:

      "Attributes cannot be empty. Either they are absent, or they are present with at least one character of non-whitespace content".

      This means cannot represent an empty string because its @value would be "" - which is prohibited by the ITS. In practice: the resource instance validator shows the string as valid (because an empty string is/should be allowed, valid regex) but the FHIR server can't store it because it's invalid JSON.

      • In my opinion we need to support empty strings for a variety of reasons and then the JSON and XML representations need to deal with the prohibition that the value can't be an empty string...ever.

            Assignee:
            Unassigned
            Reporter:
            Ioana Singureanu
            Ioana Singureanu
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: