Skip to content

Commit

Permalink
Merge pull request #5 from FirelyTeam/feature/improve-valueset-gen
Browse files Browse the repository at this point in the history
Used the new features in the fhir model information (experimental, st…
  • Loading branch information
ewoutkramer authored Jul 28, 2020
2 parents bdf8035 + 91c13a9 commit 01f1b91
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/Microsoft.Health.Fhir.SpecManager/Language/CSharpFirely.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,6 @@ private void WriteSearchParameters()

foreach (FhirSearchParam sp in complex.SearchParameters.Values.OrderBy(s => s.Name))
{
if (sp.IsExperimental)
{
continue;
}

string description;

if ((!string.IsNullOrEmpty(sp.Description)) &&
Expand Down Expand Up @@ -686,7 +681,7 @@ private void WriteCommonValueSets()
{
HashSet<string> usedEnumNames = new HashSet<string>();

string filename = Path.Combine(_exportDirectory, "Generated", "Template-Bindings.cs");
string filename = Path.Combine(_exportDirectory, "Generated", "CommonValueSets.cs");

using (FileStream stream = new FileStream(filename, FileMode.Create))
using (ExportStreamWriter writer = new ExportStreamWriter(stream))
Expand All @@ -703,9 +698,21 @@ private void WriteCommonValueSets()
{
if (vs.ReferencedByComplexes.Count < 2)
{
/* ValueSets that are used in a single POCO are generated as a nested enum inside that
* POCO, not here in the shared valuesets */
continue;
}


if (vs.StrongestBinding != FhirElement.ElementDefinitionBindingStrength.Required)
{
/* Since required bindings cannot be extended, those are the only bindings that
can be represented using enums in the POCO classes (using <c>Code&lt;T&gt;</c>). All other coded members
use <c>Code</c>, <c>Coding</c> or <c>CodeableConcept</c>.
Consequently, we only need to generate enums for valuesets that are used as
required bindings anywhere in the datamodel. */
continue;
}

if (_exclusionSet.Contains(vs.URL))
{
continue;
Expand Down

0 comments on commit 01f1b91

Please sign in to comment.