Skip to content

Commit

Permalink
Merge pull request #2369 from FirelyTeam/feature/since-on-markdown
Browse files Browse the repository at this point in the history
DeclaredType attributes on ElementDefintion properties
  • Loading branch information
ewoutkramer authored Jan 19, 2023
2 parents dac7ba8 + 8eab577 commit 42f8a97
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,8 @@ public string Key
/// Why this constraint is necessary or appropriate
/// </summary>
[FhirElement("requirements", InSummary=true, Order=40)]
[DeclaredType(Type = typeof(FhirString))]
[DeclaredType(Type = typeof(Markdown), Since = FhirRelease.R5)]
[DataMember]
public Hl7.Fhir.Model.Markdown Requirements
{
Expand Down Expand Up @@ -2113,6 +2115,8 @@ public Hl7.Fhir.Model.BindingStrength? Strength
/// Intended use of codes in the bound value set
/// </summary>
[FhirElement("description", InSummary=true, Order=40)]
[DeclaredType(Type = typeof(FhirString))]
[DeclaredType(Type = typeof(Markdown), Since = FhirRelease.R5)]
[DataMember]
public Hl7.Fhir.Model.Markdown Description
{
Expand Down Expand Up @@ -2684,6 +2688,8 @@ public string Map
/// Comments about the mapping or its use
/// </summary>
[FhirElement("comment", InSummary=true, Order=60)]
[DeclaredType(Type = typeof(FhirString))]
[DeclaredType(Type = typeof(Markdown), Since = FhirRelease.R5)]
[DataMember]
public Hl7.Fhir.Model.Markdown Comment
{
Expand Down
4 changes: 4 additions & 0 deletions src/Hl7.Fhir.R5.Tests/Hl7.Fhir.R5.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

<Import Project="..\firely-net-sdk-tests.props" />

<PropertyGroup>
<DefineConstants>R5</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<AssemblyName>Hl7.Fhir.R5.Tests</AssemblyName>
</PropertyGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,8 @@ public string Key
/// Why this constraint is necessary or appropriate
/// </summary>
[FhirElement("requirements", InSummary=true, Order=40)]
[DeclaredType(Type = typeof(FhirString))]
[DeclaredType(Type = typeof(Markdown), Since = FhirRelease.R5)]
[DataMember]
public Hl7.Fhir.Model.FhirString RequirementsElement
{
Expand Down Expand Up @@ -1720,6 +1722,8 @@ public Hl7.Fhir.Model.BindingStrength? Strength
/// Human explanation of the value set
/// </summary>
[FhirElement("description", InSummary=true, Order=40)]
[DeclaredType(Type = typeof(FhirString))]
[DeclaredType(Type = typeof(Markdown), Since = FhirRelease.R5)]
[DataMember]
public Hl7.Fhir.Model.FhirString DescriptionElement
{
Expand Down Expand Up @@ -1976,6 +1980,8 @@ public string Map
/// Comments about the mapping or its use
/// </summary>
[FhirElement("comment", InSummary=true, Order=60)]
[DeclaredType(Type = typeof(FhirString))]
[DeclaredType(Type = typeof(Markdown), Since = FhirRelease.R5)]
[DataMember]
public Hl7.Fhir.Model.FhirString CommentElement
{
Expand Down
39 changes: 38 additions & 1 deletion src/Hl7.Fhir.Shared.Tests/ElementModel/PocoTypedElementTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Hl7.Fhir.ElementModel;
using FluentAssertions;
using Hl7.Fhir.ElementModel;
using Hl7.Fhir.FhirPath;
using Hl7.Fhir.Model;
using Hl7.Fhir.Serialization;
Expand Down Expand Up @@ -191,5 +192,41 @@ public async Tasks.Task ValidateFiveWs()

Assert.AreEqual(poco.Subject, subjectProp);
}


[TestMethod]
public void CheckTypeOfElementDefinitionMembers()
{
#if !R5
var resultType = "string";
#else
var resultType = "markdown";
#endif
var ed = new ElementDefinition()
{
Mapping = new System.Collections.Generic.List<ElementDefinition.MappingComponent>() {
new ElementDefinition.MappingComponent() {
Comment = "comment"
}
},
Binding = new ElementDefinition.ElementDefinitionBindingComponent()
{
Description = "description",

},
Constraint = new System.Collections.Generic.List<ElementDefinition.ConstraintComponent>()
{
new ElementDefinition.ConstraintComponent()
{
Requirements = "requirements"
}
}
};
var element = ed.ToTypedElement();
element.Select("mapping.comment").First().InstanceType.Should().Be(resultType);
element.Select("binding.description").First().InstanceType.Should().Be(resultType);
element.Select("constraint.requirements").First().InstanceType.Should().Be(resultType);
}

}
}

0 comments on commit 42f8a97

Please sign in to comment.