FHIR Chat · Bug: unexpected encoding behavior on UUID-Ids · hapi

Stream: hapi

Topic: Bug: unexpected encoding behavior on UUID-Ids


view this post on Zulip Patrick Werner (May 24 2020 at 14:07):

I experienced this issue some while ago:

 Observation o = new Observation();
    o.setStatus(ObservationStatus.FINAL);
    id = IdDt.newRandomUuid();
    o.setId(id);
    System.out.println(id);
    System.out.println(parser.encodeResourceToString(o));

Output:

urn:uuid:92ba7135-b731-430f-bdc0-87d6a78ef0f7
{
  "resourceType": "Observation",
  "status": "final"
}

view this post on Zulip Patrick Werner (May 24 2020 at 14:08):

the parser doesn't encode the id if it is an urn:uuid.

view this post on Zulip Patrick Werner (May 24 2020 at 14:08):

I think this is wrong and should be fixed.

view this post on Zulip Patrick Werner (May 26 2020 at 09:43):

https://github.com/jamesagnew/hapi-fhir/issues/1868

view this post on Zulip Michael Sauer (Jun 01 2020 at 18:55):

I had the same problem. But the specification say:

Any combination of upper- or lower-case ASCII letters ('A'..'Z', and 'a'..'z', numerals ('0'..'9'), '-' and '.', with a length limit of 64 characters. (This might be an integer, an un-prefixed OID, UUID or any other identifier pattern that meets these constraints.) xs:string JSON string
Regex: [A-Za-z0-9\-\.]{1,64}

So an id starting wirh urn:uuid isn‘t a valid id...


Last updated: Apr 12 2022 at 19:14 UTC