Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backslashes (\) Are Removed During JSON Conversion of PlanDefinition StructureMap #334

Open
2 tasks
sharon2719 opened this issue Jan 30, 2025 · 0 comments
Open
2 tasks
Assignees
Labels

Comments

@sharon2719
Copy link
Contributor

Problem

When converting a PlanDefinition StructureMap to JSON, backslashes (\) inside string literals are being stripped out. This affects expressions such as:

$this + '7 \'days\''.toQuantity()

which should be preserved in the JSON output as:

{
  "variable": "bcgEndDate",
  "transform": "evaluate",
  "parameter": [
    {
      "valueId": "patientBirthDate"
    },
    {
      "valueString": "$this + '7 \\'days\\''.toQuantity()"
    }
  ]
}

However, the backslashes are being removed, causing incorrect JSON formatting and potential failures in evaluation.

Expected Behavior

  • The conversion process should preserve escape characters () within string literals.

  • The JSON output should correctly represent expressions without altering or stripping necessary escape sequences.

Solution

Update the JSON conversion logic to ensure backslashes are properly escaped.

Add test cases to verify that expressions containing single quotes within strings remain correctly formatted.

Impact

Without this fix, expressions may break during execution, leading to incorrect evaluations.

Ensures FHIR-compliant transformation and prevents potential runtime errors in downstream processing.

@sharon2719 sharon2719 self-assigned this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant