Skip to content

Instantly share code, notes, and snippets.

@mikeacjones
Created June 24, 2021 12:49
Show Gist options
  • Save mikeacjones/a9eb5a4cbfdf287a3f0c72534654b08a to your computer and use it in GitHub Desktop.
Save mikeacjones/a9eb5a4cbfdf287a3f0c72534654b08a to your computer and use it in GitHub Desktop.
Provides an example of the update function using a pattern matching pattern.
%dw 2.0
output application/json
---
payload update {
case value at .software.name if (value contains "XYZ") -> "XYZ FHIR 2017"
case value at .software.version -> "1.0.0"
case value at .software.releaseDate -> "2017-03-06T00:00:00Z"
case value at .date if(!isEmpty(value)) -> "2017-03-06T00:00:00Z"
case value at .version if(!isEmpty(value)) -> "1.0.0"
case value at .copyright if(!isEmpty(value)) -> "Copyright XYZ 2017"
case value at .*rest -> value map (
$ update {
case value at .security.*extension -> value map (
$ update {
case value at .*extension -> value map (
$ update {
case value at .valueUri -> "https://xyz.com/Interconnect-POC-FHIR/oauth2/token"
}
)
}
)
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment