Is your feature request related to a problem? Please describe.
In #2905 we added partial support for the mode input parameter on the $validate operation.
Specifically, when this parameter is set to create or update, we will validate the passed resource by using the corresponding fhir-server-config settings under resources/<resourceType>/profiles.
However, https://www.hl7.org/fhir/operation-resource-validate.html defines mode with a required binding to https://www.hl7.org/fhir/valueset-resource-validation-mode.html whereas our implementation allows any string that would be a valid code.
Specifically, in addition to create and update modes, it defines:
- a
profile mode that it says should only apply to a resource "nominated by id, not provided as a parameter"
- a
delete mode that only makes sense against a previously-ingested resource
But our implementation doesn't even support validation against existing resources in the db.
If you try invoking it at this level, it fails with a 400 Bad Request error that says:
"Input parameter 'resource' is required for the $validate operation"
Describe the solution you'd like
- Support (and advertise support for) resource-instance level $validate (at
[base]/[resourceType]/[id]/$validate)
- Ensure that only valid "mode" codes are accepted by the $validate operation... if an invalid code is sent then return a 400 Bad Request with a reasonable error
- Ensure
delete is only ever invoked at the resource-instance level (although I have no clue when we'd say that a given delete is "invalid"...I guess never?)
- I don't understand why
profile wouldn't be used when validating a passed resource against a particular profile. I think this matches our current behavior if the 'profile' parameter is passed in and that seems fine to me.
Describe alternatives you've considered
Acceptance Criteria
- GIVEN [a precondition]
AND [another precondition]
WHEN [test step]
AND [test step]
THEN [verification step]
AND [verification step]
Additional context
Is your feature request related to a problem? Please describe.
In #2905 we added partial support for the
modeinput parameter on the$validateoperation.Specifically, when this parameter is set to
createorupdate, we will validate the passed resource by using the corresponding fhir-server-config settings underresources/<resourceType>/profiles.However, https://www.hl7.org/fhir/operation-resource-validate.html defines
modewith a required binding to https://www.hl7.org/fhir/valueset-resource-validation-mode.html whereas our implementation allows any string that would be a valid code.Specifically, in addition to
createandupdatemodes, it defines:profilemode that it says should only apply to a resource "nominated by id, not provided as a parameter"deletemode that only makes sense against a previously-ingested resourceBut our implementation doesn't even support validation against existing resources in the db.
If you try invoking it at this level, it fails with a 400 Bad Request error that says:
Describe the solution you'd like
[base]/[resourceType]/[id]/$validate)deleteis only ever invoked at the resource-instance level (although I have no clue when we'd say that a given delete is "invalid"...I guess never?)profilewouldn't be used when validating a passed resource against a particular profile. I think this matches our current behavior if the 'profile' parameter is passed in and that seems fine to me.Describe alternatives you've considered
Acceptance Criteria
AND [another precondition]
WHEN [test step]
AND [test step]
THEN [verification step]
AND [verification step]
Additional context