From 9adf69db3a855d1102a7e4aa3294f78d196b8051 Mon Sep 17 00:00:00 2001
From: VHofman <vincent.hofman@kereval.com>
Date: Thu, 6 Jun 2024 08:56:47 +0200
Subject: [PATCH] Made the traceparent optional in README and Validation
 profiles

---
 ...H-ITI-90-Organization-GetRequest-ValidationProfile.json | 5 +++--
 ...H-ITI-90-Practitioner-GetRequest-ValidationProfile.json | 7 ++++---
 ...I-90-PractitionerRole-GetRequest-ValidationProfile.json | 5 +++--
 .../CH-ITI-90-RetrieveRequest-ValidationProfile.json       | 5 +++--
 EHS/CH_mCSD/README.md                                      | 2 +-
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/EHS/CH_mCSD/CH-ITI-90-Organization-GetRequest-ValidationProfile.json b/EHS/CH_mCSD/CH-ITI-90-Organization-GetRequest-ValidationProfile.json
index 6b42f90..3aef300 100644
--- a/EHS/CH_mCSD/CH-ITI-90-Organization-GetRequest-ValidationProfile.json
+++ b/EHS/CH_mCSD/CH-ITI-90-Organization-GetRequest-ValidationProfile.json
@@ -89,13 +89,13 @@
         },{
           "selector": "request.headers('traceparent').values",
           "id": "traceparent_parameter_presence",
-          "description": "The traceparent parameter is mandatory in the HTTP header.",
+          "description": "The traceparent parameter can be used only once.",
           "requirementPriority": "MANDATORY",
           "checksComposition": "oneOf",
           "checks": [
             {
               "type": "OCCURRENCE",
-              "minOccurrence": 1,
+              "minOccurrence": 0,
               "maxOccurrence": 1
             }
           ]
@@ -106,6 +106,7 @@
           "description": "traceparent parameter's value SHALL be as defined in fhir.ch, section tracecontext.",
           "requirementPriority": "MANDATORY",
           "checksComposition": "oneOf",
+          "applyIf": "request.headers('traceparent').values.size() > 0",
           "checks": [
             {
               "type": "REGEX",
diff --git a/EHS/CH_mCSD/CH-ITI-90-Practitioner-GetRequest-ValidationProfile.json b/EHS/CH_mCSD/CH-ITI-90-Practitioner-GetRequest-ValidationProfile.json
index 0fe8e9b..a026a19 100644
--- a/EHS/CH_mCSD/CH-ITI-90-Practitioner-GetRequest-ValidationProfile.json
+++ b/EHS/CH_mCSD/CH-ITI-90-Practitioner-GetRequest-ValidationProfile.json
@@ -90,13 +90,13 @@
     {
       "selector": "request.headers('traceparent').values",
       "id": "traceparent_parameter_presence",
-      "description": "The traceparent parameter is mandatory in the HTTP header.",
+      "description": "The traceparent parameter can be used only once.",
       "requirementPriority": "MANDATORY",
       "checksComposition": "oneOf",
       "checks": [
         {
           "type": "OCCURRENCE",
-          "minOccurrence": 1,
+          "minOccurrence": 0,
           "maxOccurrence": 1
         }
       ]
@@ -106,7 +106,8 @@
       "id": "traceparent_parameter_value",
       "description": "traceparent parameter's value SHALL be as defined in fhir.ch, section tracecontext.",
       "requirementPriority": "MANDATORY",
-      "checksComposition": "oneOf",
+      "checksComposition": "oneOf",      
+      "applyIf": "request.headers('traceparent').values.size() > 0",
       "checks": [
         {
           "type": "REGEX",
diff --git a/EHS/CH_mCSD/CH-ITI-90-PractitionerRole-GetRequest-ValidationProfile.json b/EHS/CH_mCSD/CH-ITI-90-PractitionerRole-GetRequest-ValidationProfile.json
index 42ce0d0..a1788d3 100644
--- a/EHS/CH_mCSD/CH-ITI-90-PractitionerRole-GetRequest-ValidationProfile.json
+++ b/EHS/CH_mCSD/CH-ITI-90-PractitionerRole-GetRequest-ValidationProfile.json
@@ -90,13 +90,14 @@
     {
       "selector": "request.headers('traceparent').values",
       "id": "traceparent_parameter_presence",
-      "description": "The traceparent parameter is mandatory in the HTTP header.",
+      "description": "The traceparent parameter can be used only once.",
       "requirementPriority": "MANDATORY",
       "checksComposition": "oneOf",
+      "applyIf": "request.headers('traceparent').values.size() > 0",
       "checks": [
         {
           "type": "OCCURRENCE",
-          "minOccurrence": 1,
+          "minOccurrence": 0,
           "maxOccurrence": 1
         }
       ]
diff --git a/EHS/CH_mCSD/CH-ITI-90-RetrieveRequest-ValidationProfile.json b/EHS/CH_mCSD/CH-ITI-90-RetrieveRequest-ValidationProfile.json
index 229bf6d..9cc33bc 100644
--- a/EHS/CH_mCSD/CH-ITI-90-RetrieveRequest-ValidationProfile.json
+++ b/EHS/CH_mCSD/CH-ITI-90-RetrieveRequest-ValidationProfile.json
@@ -89,13 +89,13 @@
         },{
           "selector": "request.headers('traceparent').values",
           "id": "traceparent_parameter_presence",
-          "description": "The traceparent parameter is mandatory in the HTTP header.",
+          "description": "The traceparent parameter can be used only once.",
           "requirementPriority": "MANDATORY",
           "checksComposition": "oneOf",
           "checks": [
             {
               "type": "OCCURRENCE",
-              "minOccurrence": 1,
+              "minOccurrence": 0,
               "maxOccurrence": 1
             }
           ]
@@ -106,6 +106,7 @@
           "description": "traceparent parameter's value SHALL be as defined in fhir.ch, section tracecontext.",
           "requirementPriority": "MANDATORY",
           "checksComposition": "oneOf",
+          "applyIf": "request.headers('traceparent').values.size() > 0",
           "checks": [
             {
               "type": "REGEX",
diff --git a/EHS/CH_mCSD/README.md b/EHS/CH_mCSD/README.md
index b6891f8..2485bbe 100644
--- a/EHS/CH_mCSD/README.md
+++ b/EHS/CH_mCSD/README.md
@@ -17,7 +17,7 @@ date: 2023-03-14
 |   HostChecking   |   REGEX   |   `^(http[s]?:\/\/)?[a-zA-Z0-9.\-\/]+(\:(\d)+)?$` |   Host Shall be a server name  |
 |   Authorization_parameter_presence   |   OCCURRENCE   |   1..1 |   The Authorization parameter is mandatory  |
 |   Authorization_parameter_value   |   REGEX   |   `^Bearer\\ [-a-zA-Z0-9._~+\\/]+=*$` |   Authorization parameter's value SHALL be Bearer, followed by the token.  |
-|   traceparent_parameter_presence   |   OCCURRENCE   |   1..1 |   The traceparent parameter is mandatory in the HTTP header|
+|   traceparent_parameter_presence   |   OCCURRENCE   |   0..1 |   The traceparent parameter can be used only once.|
 |   traceparent_parameter_value   |   REGEX   |   `^(?!f{2})([\da-f]{2})-(?!0{32})([\da-f]{32})-(?!0{16})([\da-f]{16})-([\da-f]{2})$` |   traceparent parameter's value SHALL be as defined in fhir.ch, section [tracecontext](https://fhir.ch/ig/ch-epr-mhealth/tracecontext.html). |
 |   _id_parameter_presence   |   OCCURENCE   | 0..1 |   _id parameter can be used only once. |
 |   _id_parameter_value   |   REGEX   |   `^\S+$` |   _id parameter is a token.  |
-- 
GitLab