FHIR / GoFSH

GoFSH is a FHIR Shorthand (FSH) decompiler, able to convert formal FHIR definitions from JSON/XML to FSH.
Apache License 2.0
35 stars 5 forks source link

Extract extension contexts to keyword #244

Closed mint-thompson closed 1 year ago

mint-thompson commented 1 year ago

Completes #234 and task CIMPL-1163.

When processing an Extension definition, set the contexts directly on the ExportableExtension object. When doing so, convert paths back to FSH-style paths. When extracting caret value rules on an Extension definition, do not extract any rules for contexts.

Add optimizer plugin to resolve URLs in contexts.

This ended up being a bit simpler than I had anticipated in regards to differentiating between core and non-core resources. Since SUSHI does the hard work of actually resolving contexts, GoFSH gets to use the name of anything that it can fish up, no matter where it came from.

mint-thompson commented 1 year ago

@jafeltra Thank you for the review!

  1. That change in USCore is a SUSHI bug, similar to the one recently found for Instances of Identifier: if you look at StructureDefinitionExporter.setContext, you'll see that it fishes for extensions before any other type.
  2. It looks like that's the default context that SUSHI sets when no Context keyword is used. There's a corresponding RemoveDefaultExtensionContextRulesOptimizer in GoFSH. This optimizer probably doesn't do much of anything anymore. So, the optimizer should change to instead check the context on each extension, and if the only context is the default, remove it so that no Context keyword is used.