FHIR Chat · Possible bug with dependencies and nesting · shorthand

Stream: shorthand

Topic: Possible bug with dependencies and nesting


view this post on Zulip Rob Reynolds (Nov 15 2020 at 12:22):

Nesting after creating an instance from a dependency results in the following error:

Cannot read property 'length' of undefined

Repro:

  • create a tank with a Profile (let's call it the "profile" tank)
  • run the publisher on the "profile" tank (to get a local package)
  • create another tank (let's call it the "instance" tank) and add a dependency to the "profile" tank (using dev to get the local "profile" package)
  • add an Instance to the "instance" tank with an InstanceOf the Profile from the "profile" tank
  • build the "instance" tank with sushi

The result is the above error. Using sushi v0.16.0.

Code for a Repro:
"profile" tank:

Profile: ReproPlanDefinition
Parent: PlanDefinition

"instance" tank:

Instance: ReproPlanDefinitionInstance
InstanceOf: ReproPlanDefinition
* status = #draft
* action.title = "Repro Title"
* action.action[0].title = "Repro SubTitle One"
* action.action[1].title = "Repro SubTitle Two"
//explicit index on the action doesn't fix
* action[1].title = "Repro Title"
* action[1].action[0].title = "Repro SubTitle One"
* action[1].action[1].title = "Repro SubTitle Two"

result:

error Cannot read property 'length' of undefined
  File: C:\src\fsh-sandbox\SandboxContentIG\fsh\ReproPlanDefinitionInstance.fsh
  Line: 5
error Cannot read property 'length' of undefined
  File: C:\src\fsh-sandbox\SandboxContentIG\fsh\ReproPlanDefinitionInstance.fsh
  Line: 6
error Cannot read property 'length' of undefined
  File: C:\src\fsh-sandbox\SandboxContentIG\fsh\ReproPlanDefinitionInstance.fsh
  Line: 9
error Cannot read property 'length' of undefined
  File: C:\src\fsh-sandbox\SandboxContentIG\fsh\ReproPlanDefinitionInstance.fsh
  Line: 10
error Cannot read property 'length' of undefined

Also, when you do the same thing in a single tank, it doesn't error.
add to the "instance" tank:

Profile: WorkaroundPlanDefinition
Parent: PlanDefinition

Instance: WorkaroundPlanDefinitionInstance
InstanceOf: WorkaroundPlanDefinition
* status = #draft
* action.title = "Workaround Title"
* action.action[0].title = "Workaround SubTitle One"
* action.action[1].title = "Workaround SubTitle Two"
* action[1].title = "Workaround Title"
* action[1].action[0].title = "Workaround SubTitle One"
* action[1].action[1].title = "Workaround SubTitle Two"

result: no errors

view this post on Zulip Mark Kramer (Nov 16 2020 at 17:27):

The dependencies rely on npm packages. I don't know that FSH has a way to specify a dependency to a local directory.

view this post on Zulip Chris Moesel (Nov 16 2020 at 17:44):

If you've built the project using the IG Publisher locally, it should put the dev version into the local FHIR cache and SUSHI should be able to pick it up if the dependency version is specified as dev. Tagging @Nick Freiter to confirm (and see if he has any ideas what might be going on here).

view this post on Zulip Grahame Grieve (Nov 16 2020 at 21:13):

I don't know that FSH has a way to specify a dependency to a local directory

if you do, you should do it the same way as the java tools - the version is a file name. See https://docs.npmjs.com/cli/v6/configuring-npm/package-json#local-paths

view this post on Zulip Nick Freiter (Nov 17 2020 at 20:52):

Looked into this, and it seems like it wasn't a problem with dependencies, but rather an issue with how we handled contentReference elements (PlanDefinition.action.action in this case). The definition generated by the Publisher was using a slightly different format for a contentReference than the format we have been assuming in SUSHI. I've added a fix here, so once that is merged and released this should no longer be an issue. Thanks for the report!

view this post on Zulip Rob Reynolds (Nov 21 2020 at 19:40):

That fixed it! Thank you!

view this post on Zulip Chris Moesel (Nov 25 2020 at 20:41):

@Rob Reynolds -- this fix was just released in SUSHI version 1.0.2.


Last updated: Apr 12 2022 at 19:14 UTC