firely-net-sdk icon indicating copy to clipboard operation
firely-net-sdk copied to clipboard

Improvement for validation of StructureDefinition.id

Open alexzautke opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. In R4 the type of StructureDefinition.id is mistakingly set to "string" in the structuredefinition-fhir-type extension. See https://www.hl7.org/fhir/structuredefinition.profile.json.html. Therefore no validation of the id datatype is happening when running the validator. This lets to easy to make mistakes, like including an "_" in it.

Describe the solution you'd like To avoid tooling issues when consuming StructureDefinitions with invalid ids, it would be good to manually fix this issue in the appropriate places in the SDK and apply the id regex.

Additional context The issue in the specification has been fixed in R5. Unit test to reproduce the issue can be found in fix/validation-id-structuredefinition (TestInvalidStructureDefinitionIdIsRejected in BasicValidationTests.cs)

alexzautke avatar Jun 22 '21 12:06 alexzautke

Grahame thinks there are unit tests for this in the validator, so perhaps something to see why it wasn't caught by implementing those: https://chat.fhir.org/#narrow/stream/179167-hapi/topic/This.20is.20not.20a.20valid.20FHIR.20ID/near/243510326

wardweistra avatar Jun 22 '21 16:06 wardweistra

Grahame thinks there are unit tests for this in the validator, so perhaps something to see why it wasn't caught by implementing those: https://chat.fhir.org/#narrow/stream/179167-hapi/topic/This.20is.20not.20a.20valid.20FHIR.20ID/near/243510326

Could be, but we're not using those tests for this purpose yet, we use them just to compare outputs of the new and old validator against Grahames. The differences between the validators are too big currently to be useful to detect bugs. This will come in time, however.

ewoutkramer avatar Jun 23 '21 06:06 ewoutkramer

Only noticed by now that I forgot to push the unit test, added it now

alexzautke avatar Jul 24 '21 15:07 alexzautke