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

Regression: evaluation fails if context/environment contains nulls #138

Closed
ruscoder opened this issue Apr 24, 2023 · 5 comments
Closed

Regression: evaluation fails if context/environment contains nulls #138

ruscoder opened this issue Apr 24, 2023 · 5 comments

Comments

@ruscoder
Copy link
Contributor

ruscoder commented Apr 24, 2023

Hello!

This expression worked in 2.14.0, but after 2.14.1 it started to fail:
TypeError: Cannot convert undefined or null to object

It fails here:

} else if (typeof value === 'object') {

I assume it happens, because of the bug in the check "typeof null" that return "object" for null as well.

Expression: QuestionnaireResponse.repeat(item).where(linkId='test').answer.value

Context:

{
   "resourceType": "QuestionnaireResponse",
   "item": [
      {
         "linkId": "test",
         "answer": [
            {
               "valueInteger": null
            }
         ]
      }
   ]
}
ruscoder added a commit to beda-software/fhirpath.js that referenced this issue Apr 24, 2023
@ruscoder
Copy link
Contributor Author

I created a PR that fixes it #139

@plynchnlm
Copy link
Collaborator

I don't think that example is valid in FHIR. See https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/answer.2Evalue.5Bx.5D.3A.20null.3F/near/352536149.

So, I am not sure we should handle this case.

@plynchnlm
Copy link
Collaborator

Then again, even if this case is not valid, there is a valid case for having a null, per https://build.fhir.org/json.html#primitive, which I suspect would have the same problem.

yuriy-sedinkin added a commit that referenced this issue Jan 23, 2024
…ject-for-null-values to master

* commit '0c5fd085b741455de562fc37d0d477d4241e8c29':
  npm audit fix
  Resolved merge conflicts
  Fixed a typo
  Fixed issues with null values
  Reverted unnecessary changes and did minor refactoring
  Added a benchmark for the "contains" operator
  Changes as per review
  Added unit tests for the hashObject function
  Fix hash for null values #138
@ruscoder
Copy link
Contributor Author

Looks like it's fixed and does not fail anymore, thanks

@plynchnlm
Copy link
Collaborator

Yes, in 3.9.1. Sorry we did not report back here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants