Skip to content

Commit f530fdd

Browse files
authored
Merge pull request #2939 from FirelyTeam/6.0/2930-remove-isnested-type
2930 Clean up IsNested/BackboneType attribute information
2 parents 581baec + be68c7b commit f530fdd

File tree

592 files changed

+28614
-6450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

592 files changed

+28614
-6450
lines changed

src/Hl7.Fhir.Base/CompatibilitySuppressions.xml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
<Right>lib/net8.0/Hl7.Fhir.Base.dll</Right>
99
<IsBaselineSuppression>true</IsBaselineSuppression>
1010
</Suppression>
11+
<Suppression>
12+
<DiagnosticId>CP0001</DiagnosticId>
13+
<Target>T:Hl7.Fhir.Introspection.BackboneTypeAttribute</Target>
14+
<Left>lib/net8.0/Hl7.Fhir.Base.dll</Left>
15+
<Right>lib/net8.0/Hl7.Fhir.Base.dll</Right>
16+
<IsBaselineSuppression>true</IsBaselineSuppression>
17+
</Suppression>
1118
<Suppression>
1219
<DiagnosticId>CP0001</DiagnosticId>
1320
<Target>T:System.Runtime.CompilerServices.CollectionBuilderAttribute</Target>
@@ -21,6 +28,13 @@
2128
<Right>lib/netstandard2.0/Hl7.Fhir.Base.dll</Right>
2229
<IsBaselineSuppression>true</IsBaselineSuppression>
2330
</Suppression>
31+
<Suppression>
32+
<DiagnosticId>CP0001</DiagnosticId>
33+
<Target>T:Hl7.Fhir.Introspection.BackboneTypeAttribute</Target>
34+
<Left>lib/netstandard2.0/Hl7.Fhir.Base.dll</Left>
35+
<Right>lib/netstandard2.0/Hl7.Fhir.Base.dll</Right>
36+
<IsBaselineSuppression>true</IsBaselineSuppression>
37+
</Suppression>
2438
<Suppression>
2539
<DiagnosticId>CP0002</DiagnosticId>
2640
<Target>M:Hl7.Fhir.ElementModel.TypedElementExtensions.IsExactlyEqualTo``1(``0,``0,System.Boolean)</Target>
@@ -98,6 +112,41 @@
98112
<Right>lib/net8.0/Hl7.Fhir.Base.dll</Right>
99113
<IsBaselineSuppression>true</IsBaselineSuppression>
100114
</Suppression>
115+
<Suppression>
116+
<DiagnosticId>CP0002</DiagnosticId>
117+
<Target>M:Hl7.Fhir.Introspection.ClassMapping.get_DefinitionPath</Target>
118+
<Left>lib/net8.0/Hl7.Fhir.Base.dll</Left>
119+
<Right>lib/net8.0/Hl7.Fhir.Base.dll</Right>
120+
<IsBaselineSuppression>true</IsBaselineSuppression>
121+
</Suppression>
122+
<Suppression>
123+
<DiagnosticId>CP0002</DiagnosticId>
124+
<Target>M:Hl7.Fhir.Introspection.FhirTypeAttribute.get_IsNestedType</Target>
125+
<Left>lib/net8.0/Hl7.Fhir.Base.dll</Left>
126+
<Right>lib/net8.0/Hl7.Fhir.Base.dll</Right>
127+
<IsBaselineSuppression>true</IsBaselineSuppression>
128+
</Suppression>
129+
<Suppression>
130+
<DiagnosticId>CP0002</DiagnosticId>
131+
<Target>M:Hl7.Fhir.Introspection.FhirTypeAttribute.get_IsResource</Target>
132+
<Left>lib/net8.0/Hl7.Fhir.Base.dll</Left>
133+
<Right>lib/net8.0/Hl7.Fhir.Base.dll</Right>
134+
<IsBaselineSuppression>true</IsBaselineSuppression>
135+
</Suppression>
136+
<Suppression>
137+
<DiagnosticId>CP0002</DiagnosticId>
138+
<Target>M:Hl7.Fhir.Introspection.FhirTypeAttribute.set_IsNestedType(System.Boolean)</Target>
139+
<Left>lib/net8.0/Hl7.Fhir.Base.dll</Left>
140+
<Right>lib/net8.0/Hl7.Fhir.Base.dll</Right>
141+
<IsBaselineSuppression>true</IsBaselineSuppression>
142+
</Suppression>
143+
<Suppression>
144+
<DiagnosticId>CP0002</DiagnosticId>
145+
<Target>M:Hl7.Fhir.Introspection.FhirTypeAttribute.set_IsResource(System.Boolean)</Target>
146+
<Left>lib/net8.0/Hl7.Fhir.Base.dll</Left>
147+
<Right>lib/net8.0/Hl7.Fhir.Base.dll</Right>
148+
<IsBaselineSuppression>true</IsBaselineSuppression>
149+
</Suppression>
101150
<Suppression>
102151
<DiagnosticId>CP0002</DiagnosticId>
103152
<Target>M:Hl7.Fhir.Model.Parameters.get_Item(System.String)</Target>
@@ -231,6 +280,41 @@
231280
<Right>lib/netstandard2.0/Hl7.Fhir.Base.dll</Right>
232281
<IsBaselineSuppression>true</IsBaselineSuppression>
233282
</Suppression>
283+
<Suppression>
284+
<DiagnosticId>CP0002</DiagnosticId>
285+
<Target>M:Hl7.Fhir.Introspection.ClassMapping.get_DefinitionPath</Target>
286+
<Left>lib/netstandard2.0/Hl7.Fhir.Base.dll</Left>
287+
<Right>lib/netstandard2.0/Hl7.Fhir.Base.dll</Right>
288+
<IsBaselineSuppression>true</IsBaselineSuppression>
289+
</Suppression>
290+
<Suppression>
291+
<DiagnosticId>CP0002</DiagnosticId>
292+
<Target>M:Hl7.Fhir.Introspection.FhirTypeAttribute.get_IsNestedType</Target>
293+
<Left>lib/netstandard2.0/Hl7.Fhir.Base.dll</Left>
294+
<Right>lib/netstandard2.0/Hl7.Fhir.Base.dll</Right>
295+
<IsBaselineSuppression>true</IsBaselineSuppression>
296+
</Suppression>
297+
<Suppression>
298+
<DiagnosticId>CP0002</DiagnosticId>
299+
<Target>M:Hl7.Fhir.Introspection.FhirTypeAttribute.get_IsResource</Target>
300+
<Left>lib/netstandard2.0/Hl7.Fhir.Base.dll</Left>
301+
<Right>lib/netstandard2.0/Hl7.Fhir.Base.dll</Right>
302+
<IsBaselineSuppression>true</IsBaselineSuppression>
303+
</Suppression>
304+
<Suppression>
305+
<DiagnosticId>CP0002</DiagnosticId>
306+
<Target>M:Hl7.Fhir.Introspection.FhirTypeAttribute.set_IsNestedType(System.Boolean)</Target>
307+
<Left>lib/netstandard2.0/Hl7.Fhir.Base.dll</Left>
308+
<Right>lib/netstandard2.0/Hl7.Fhir.Base.dll</Right>
309+
<IsBaselineSuppression>true</IsBaselineSuppression>
310+
</Suppression>
311+
<Suppression>
312+
<DiagnosticId>CP0002</DiagnosticId>
313+
<Target>M:Hl7.Fhir.Introspection.FhirTypeAttribute.set_IsResource(System.Boolean)</Target>
314+
<Left>lib/netstandard2.0/Hl7.Fhir.Base.dll</Left>
315+
<Right>lib/netstandard2.0/Hl7.Fhir.Base.dll</Right>
316+
<IsBaselineSuppression>true</IsBaselineSuppression>
317+
</Suppression>
234318
<Suppression>
235319
<DiagnosticId>CP0002</DiagnosticId>
236320
<Target>M:Hl7.Fhir.Model.Parameters.get_Item(System.String)</Target>

src/Hl7.Fhir.Base/Introspection/BackboneTypeAttribute.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/Hl7.Fhir.Base/Introspection/ClassMapping.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,13 @@ public static bool TryCreate(Type type, [NotNullWhen(true)]out ClassMapping? res
8888
// Now continue with the normal algorithm, types adorned with the [FhirTypeAttribute]
8989
if (GetAttribute<FhirTypeAttribute>(type.GetTypeInfo(), release) is not { } typeAttribute) return false;
9090

91-
var backboneAttribute = GetAttribute<BackboneTypeAttribute>(type, release);
92-
9391
result = new ClassMapping(collectTypeName(typeAttribute, type), type, release)
9492
{
95-
IsResource = typeAttribute.IsResource || type.CanBeTreatedAsType(typeof(Resource)),
93+
IsResource = type.CanBeTreatedAsType(typeof(Resource)),
9694
IsCodeOfT = ReflectionHelper.IsClosedGenericType(type) &&
9795
ReflectionHelper.IsConstructedFromGenericTypeDefinition(type, typeof(Code<>)),
9896
IsFhirPrimitive = typeof(PrimitiveType).IsAssignableFrom(type),
99-
IsBackboneType = typeAttribute.IsNestedType || backboneAttribute is not null,
100-
DefinitionPath = backboneAttribute?.DefinitionPath,
97+
IsBackboneType = typeAttribute.IsBackboneType,
10198
IsBindable = GetAttribute<BindableAttribute>(type.GetTypeInfo(), release)?.IsBindable ?? false,
10299
Canonical = typeAttribute.Canonical,
103100
ValidationAttributes = GetAttributes<ValidationAttribute>(type.GetTypeInfo(), release).ToArray(),
@@ -173,13 +170,6 @@ private ClassMapping(string name, Type nativeType, FhirRelease release)
173170
/// </summary>
174171
public bool IsBackboneType { get; private set; } = false;
175172

176-
177-
/// <summary>
178-
/// If this is a backbone type (<see cref="IsBackboneType"/>), then this contains the path
179-
/// in the StructureDefinition where the backbone was defined first.
180-
/// </summary>
181-
public string? DefinitionPath { get; private set; }
182-
183173
/// <summary>
184174
/// Indicates whether this class can be used for binding.
185175
/// </summary>

src/Hl7.Fhir.Base/Introspection/FhirTypeAttribute.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace Hl7.Fhir.Introspection
3737
/// <summary>
3838
/// This attribute is applied to classes that represent FHIR datatypes and resources.
3939
/// </summary>
40-
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
40+
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
4141
public sealed class FhirTypeAttribute : VersionedAttribute
4242
{
4343
public FhirTypeAttribute(string name)
@@ -57,20 +57,13 @@ public FhirTypeAttribute(string name, string canonical)
5757
public string Name { get; private set; }
5858

5959
/// <summary>
60-
/// Indicates whether this class represents the nested complex type for a (backbone) element.
61-
/// </summary>
62-
public bool IsNestedType { get; set; }
63-
64-
/// <summary>
65-
/// Indicates whether this class represents a Resource
60+
/// The canonical of the StructureDefinition defining this type.
6661
/// </summary>
67-
public bool IsResource { get; set; }
62+
public string? Canonical { get; set; }
6863

6964
/// <summary>
70-
/// The canonical of the StructureDefinition defining this type.
65+
/// Indicates whether this class represents the nested complex type for a (backbone) element.
7166
/// </summary>
72-
public string? Canonical { get; set; }
67+
public bool IsBackboneType { get; set; }
7368
}
74-
}
75-
76-
#nullable restore
69+
}

src/Hl7.Fhir.Base/Model/Generated/Binary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model
5555
/// </remarks>
5656
[Serializable]
5757
[DataContract]
58-
[FhirType("Binary","http://hl7.org/fhir/StructureDefinition/Binary", IsResource=true)]
58+
[FhirType("Binary","http://hl7.org/fhir/StructureDefinition/Binary")]
5959
public partial class Binary : Hl7.Fhir.Model.Resource
6060
{
6161
/// <summary>

src/Hl7.Fhir.Base/Model/Generated/Bundle.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace Hl7.Fhir.Model
5151
/// </remarks>
5252
[Serializable]
5353
[DataContract]
54-
[FhirType("Bundle","http://hl7.org/fhir/StructureDefinition/Bundle", IsResource=true)]
54+
[FhirType("Bundle","http://hl7.org/fhir/StructureDefinition/Bundle")]
5555
public partial class Bundle : Hl7.Fhir.Model.Resource, IIdentifiable<Identifier>
5656
{
5757
/// <summary>
@@ -945,14 +945,13 @@ public enum HTTPVerb
945945
/// </remarks>
946946
[Serializable]
947947
[DataContract]
948-
[FhirType("Bundle#Link", IsNestedType=true)]
949-
[BackboneType("Bundle.link")]
948+
[FhirType("Bundle.link", IsBackboneType=true)]
950949
public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement
951950
{
952951
/// <summary>
953952
/// FHIR Type Name
954953
/// </summary>
955-
public override string TypeName { get { return "Bundle#Link"; } }
954+
public override string TypeName { get { return "Bundle.link"; } }
956955

957956
/// <summary>
958957
/// See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
@@ -1135,14 +1134,13 @@ protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
11351134
/// </remarks>
11361135
[Serializable]
11371136
[DataContract]
1138-
[FhirType("Bundle#Entry", IsNestedType=true)]
1139-
[BackboneType("Bundle.entry")]
1137+
[FhirType("Bundle.entry", IsBackboneType=true)]
11401138
public partial class EntryComponent : Hl7.Fhir.Model.BackboneElement
11411139
{
11421140
/// <summary>
11431141
/// FHIR Type Name
11441142
/// </summary>
1145-
public override string TypeName { get { return "Bundle#Entry"; } }
1143+
public override string TypeName { get { return "Bundle.entry"; } }
11461144

11471145
/// <summary>
11481146
/// Links related to this entry
@@ -1407,14 +1405,13 @@ protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
14071405
/// </remarks>
14081406
[Serializable]
14091407
[DataContract]
1410-
[FhirType("Bundle#Search", IsNestedType=true)]
1411-
[BackboneType("Bundle.entry.search")]
1408+
[FhirType("Bundle.entry.search", IsBackboneType=true)]
14121409
public partial class SearchComponent : Hl7.Fhir.Model.BackboneElement
14131410
{
14141411
/// <summary>
14151412
/// FHIR Type Name
14161413
/// </summary>
1417-
public override string TypeName { get { return "Bundle#Search"; } }
1414+
public override string TypeName { get { return "Bundle.entry.search"; } }
14181415

14191416
/// <summary>
14201417
/// match | include - why this is in the result set
@@ -1596,14 +1593,13 @@ protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
15961593
/// </remarks>
15971594
[Serializable]
15981595
[DataContract]
1599-
[FhirType("Bundle#Request", IsNestedType=true)]
1600-
[BackboneType("Bundle.entry.request")]
1596+
[FhirType("Bundle.entry.request", IsBackboneType=true)]
16011597
public partial class RequestComponent : Hl7.Fhir.Model.BackboneElement
16021598
{
16031599
/// <summary>
16041600
/// FHIR Type Name
16051601
/// </summary>
1606-
public override string TypeName { get { return "Bundle#Request"; } }
1602+
public override string TypeName { get { return "Bundle.entry.request"; } }
16071603

16081604
/// <summary>
16091605
/// GET | HEAD | POST | PUT | DELETE | PATCH
@@ -1959,14 +1955,13 @@ protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
19591955
/// </remarks>
19601956
[Serializable]
19611957
[DataContract]
1962-
[FhirType("Bundle#Response", IsNestedType=true)]
1963-
[BackboneType("Bundle.entry.response")]
1958+
[FhirType("Bundle.entry.response", IsBackboneType=true)]
19641959
public partial class ResponseComponent : Hl7.Fhir.Model.BackboneElement
19651960
{
19661961
/// <summary>
19671962
/// FHIR Type Name
19681963
/// </summary>
1969-
public override string TypeName { get { return "Bundle#Response"; } }
1964+
public override string TypeName { get { return "Bundle.entry.response"; } }
19701965

19711966
/// <summary>
19721967
/// Status response code (text optional)

src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace Hl7.Fhir.Model
5151
/// </remarks>
5252
[Serializable]
5353
[DataContract]
54-
[FhirType("DomainResource","http://hl7.org/fhir/StructureDefinition/DomainResource", IsResource=true)]
54+
[FhirType("DomainResource","http://hl7.org/fhir/StructureDefinition/DomainResource")]
5555
public abstract partial class DomainResource : Hl7.Fhir.Model.Resource, Hl7.Fhir.Model.IModifierExtendable
5656
{
5757
/// <summary>

src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace Hl7.Fhir.Model
5252
/// </remarks>
5353
[Serializable]
5454
[DataContract]
55-
[FhirType("OperationOutcome","http://hl7.org/fhir/StructureDefinition/OperationOutcome", IsResource=true)]
55+
[FhirType("OperationOutcome","http://hl7.org/fhir/StructureDefinition/OperationOutcome")]
5656
public partial class OperationOutcome : Hl7.Fhir.Model.DomainResource
5757
{
5858
/// <summary>
@@ -316,14 +316,13 @@ public enum IssueType
316316
/// </remarks>
317317
[Serializable]
318318
[DataContract]
319-
[FhirType("OperationOutcome#Issue", IsNestedType=true)]
320-
[BackboneType("OperationOutcome.issue")]
319+
[FhirType("OperationOutcome.issue", IsBackboneType=true)]
321320
public partial class IssueComponent : Hl7.Fhir.Model.BackboneElement
322321
{
323322
/// <summary>
324323
/// FHIR Type Name
325324
/// </summary>
326-
public override string TypeName { get { return "OperationOutcome#Issue"; } }
325+
public override string TypeName { get { return "OperationOutcome.issue"; } }
327326

328327
/// <summary>
329328
/// fatal | error | warning | information | success

src/Hl7.Fhir.Base/Model/Generated/Parameters.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace Hl7.Fhir.Model
5252
/// </remarks>
5353
[Serializable]
5454
[DataContract]
55-
[FhirType("Parameters","http://hl7.org/fhir/StructureDefinition/Parameters", IsResource=true)]
55+
[FhirType("Parameters","http://hl7.org/fhir/StructureDefinition/Parameters")]
5656
public partial class Parameters : Hl7.Fhir.Model.Resource
5757
{
5858
/// <summary>
@@ -68,14 +68,13 @@ public partial class Parameters : Hl7.Fhir.Model.Resource
6868
/// </remarks>
6969
[Serializable]
7070
[DataContract]
71-
[FhirType("Parameters#Parameter", IsNestedType=true)]
72-
[BackboneType("Parameters.parameter")]
71+
[FhirType("Parameters.parameter", IsBackboneType=true)]
7372
public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement
7473
{
7574
/// <summary>
7675
/// FHIR Type Name
7776
/// </summary>
78-
public override string TypeName { get { return "Parameters#Parameter"; } }
77+
public override string TypeName { get { return "Parameters.parameter"; } }
7978

8079
/// <summary>
8180
/// Name from the definition

src/Hl7.Fhir.Base/Model/Generated/Resource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace Hl7.Fhir.Model
5151
/// </remarks>
5252
[Serializable]
5353
[DataContract]
54-
[FhirType("Resource","http://hl7.org/fhir/StructureDefinition/Resource", IsResource=true)]
54+
[FhirType("Resource","http://hl7.org/fhir/StructureDefinition/Resource")]
5555
public abstract partial class Resource : Hl7.Fhir.Model.Base
5656
{
5757
/// <summary>

0 commit comments

Comments
 (0)