Skip to content

Commit db0cd18

Browse files
committed
Fixed a bug where any class with one pending layer was ignored
1 parent 59114c7 commit db0cd18

File tree

7 files changed

+38967
-29892
lines changed

7 files changed

+38967
-29892
lines changed

Source/Schema.NET/core/Course.cs

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
namespace Schema.NET
2+
{
3+
using System;
4+
using System.Runtime.Serialization;
5+
using Newtonsoft.Json;
6+
7+
/// <summary>
8+
/// A description of an educational course which may be offered as distinct instances at which take place at different times or take place at different locations, or be offered through different media or modes of study. An educational course is a sequence of one or more educational events and/or creative works which aims to build knowledge, competence or ability of learners.
9+
/// </summary>
10+
public partial interface ICourse : ICreativeWork
11+
{
12+
/// <summary>
13+
/// The identifier for the &lt;a class="localLink" href="https://schema.org/Course"&gt;Course&lt;/a&gt; used by the course &lt;a class="localLink" href="https://schema.org/provider"&gt;provider&lt;/a&gt; (e.g. CS101 or 6.001).
14+
/// </summary>
15+
OneOrMany<string> CourseCode { get; set; }
16+
17+
/// <summary>
18+
/// Requirements for taking the Course. May be completion of another &lt;a class="localLink" href="https://schema.org/Course"&gt;Course&lt;/a&gt; or a textual description like "permission of instructor". Requirements may be a pre-requisite competency, referenced using &lt;a class="localLink" href="https://schema.org/AlignmentObject"&gt;AlignmentObject&lt;/a&gt;.
19+
/// </summary>
20+
Values<IAlignmentObject, ICourse, string> CoursePrerequisites { get; set; }
21+
22+
/// <summary>
23+
/// A description of the qualification, award, certificate, diploma or other educational credential awarded as a consequence of successful completion of this course or program.
24+
/// </summary>
25+
Values<string, Uri> EducationalCredentialAwarded { get; set; }
26+
27+
/// <summary>
28+
/// An offering of the course at a specific time and place or through specific media or mode of study or to a specific section of students.
29+
/// </summary>
30+
OneOrMany<ICourseInstance> HasCourseInstance { get; set; }
31+
32+
/// <summary>
33+
/// The number of credits or units awarded by a Course or required to complete an EducationalOccupationalProgram.
34+
/// </summary>
35+
Values<int?, IStructuredValue> NumberOfCredits { get; set; }
36+
37+
/// <summary>
38+
/// A description of the qualification, award, certificate, diploma or other occupational credential awarded as a consequence of successful completion of this course or program.
39+
/// </summary>
40+
Values<string, Uri> OccupationalCredentialAwarded { get; set; }
41+
}
42+
43+
/// <summary>
44+
/// A description of an educational course which may be offered as distinct instances at which take place at different times or take place at different locations, or be offered through different media or modes of study. An educational course is a sequence of one or more educational events and/or creative works which aims to build knowledge, competence or ability of learners.
45+
/// </summary>
46+
[DataContract]
47+
public partial class Course : CreativeWork, ICourse, IEquatable<Course>
48+
{
49+
/// <summary>
50+
/// Gets the name of the type as specified by schema.org.
51+
/// </summary>
52+
[DataMember(Name = "@type", Order = 1)]
53+
public override string Type => "Course";
54+
55+
/// <summary>
56+
/// The identifier for the &lt;a class="localLink" href="https://schema.org/Course"&gt;Course&lt;/a&gt; used by the course &lt;a class="localLink" href="https://schema.org/provider"&gt;provider&lt;/a&gt; (e.g. CS101 or 6.001).
57+
/// </summary>
58+
[DataMember(Name = "courseCode", Order = 206)]
59+
[JsonConverter(typeof(ValuesJsonConverter))]
60+
public OneOrMany<string> CourseCode { get; set; }
61+
62+
/// <summary>
63+
/// Requirements for taking the Course. May be completion of another &lt;a class="localLink" href="https://schema.org/Course"&gt;Course&lt;/a&gt; or a textual description like "permission of instructor". Requirements may be a pre-requisite competency, referenced using &lt;a class="localLink" href="https://schema.org/AlignmentObject"&gt;AlignmentObject&lt;/a&gt;.
64+
/// </summary>
65+
[DataMember(Name = "coursePrerequisites", Order = 207)]
66+
[JsonConverter(typeof(ValuesJsonConverter))]
67+
public Values<IAlignmentObject, ICourse, string> CoursePrerequisites { get; set; }
68+
69+
/// <summary>
70+
/// A description of the qualification, award, certificate, diploma or other educational credential awarded as a consequence of successful completion of this course or program.
71+
/// </summary>
72+
[DataMember(Name = "educationalCredentialAwarded", Order = 208)]
73+
[JsonConverter(typeof(ValuesJsonConverter))]
74+
public Values<string, Uri> EducationalCredentialAwarded { get; set; }
75+
76+
/// <summary>
77+
/// An offering of the course at a specific time and place or through specific media or mode of study or to a specific section of students.
78+
/// </summary>
79+
[DataMember(Name = "hasCourseInstance", Order = 209)]
80+
[JsonConverter(typeof(ValuesJsonConverter))]
81+
public OneOrMany<ICourseInstance> HasCourseInstance { get; set; }
82+
83+
/// <summary>
84+
/// The number of credits or units awarded by a Course or required to complete an EducationalOccupationalProgram.
85+
/// </summary>
86+
[DataMember(Name = "numberOfCredits", Order = 210)]
87+
[JsonConverter(typeof(ValuesJsonConverter))]
88+
public Values<int?, IStructuredValue> NumberOfCredits { get; set; }
89+
90+
/// <summary>
91+
/// A description of the qualification, award, certificate, diploma or other occupational credential awarded as a consequence of successful completion of this course or program.
92+
/// </summary>
93+
[DataMember(Name = "occupationalCredentialAwarded", Order = 211)]
94+
[JsonConverter(typeof(ValuesJsonConverter))]
95+
public Values<string, Uri> OccupationalCredentialAwarded { get; set; }
96+
97+
/// <inheritdoc/>
98+
public bool Equals(Course other)
99+
{
100+
if (other is null)
101+
{
102+
return false;
103+
}
104+
105+
if (ReferenceEquals(this, other))
106+
{
107+
return true;
108+
}
109+
110+
return this.Type == other.Type &&
111+
this.CourseCode == other.CourseCode &&
112+
this.CoursePrerequisites == other.CoursePrerequisites &&
113+
this.EducationalCredentialAwarded == other.EducationalCredentialAwarded &&
114+
this.HasCourseInstance == other.HasCourseInstance &&
115+
this.NumberOfCredits == other.NumberOfCredits &&
116+
this.OccupationalCredentialAwarded == other.OccupationalCredentialAwarded &&
117+
base.Equals(other);
118+
}
119+
120+
/// <inheritdoc/>
121+
public override bool Equals(object obj) => this.Equals(obj as Course);
122+
123+
/// <inheritdoc/>
124+
public override int GetHashCode() => HashCode.Of(this.Type)
125+
.And(this.CourseCode)
126+
.And(this.CoursePrerequisites)
127+
.And(this.EducationalCredentialAwarded)
128+
.And(this.HasCourseInstance)
129+
.And(this.NumberOfCredits)
130+
.And(this.OccupationalCredentialAwarded)
131+
.And(base.GetHashCode());
132+
}
133+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
namespace Schema.NET
2+
{
3+
using System;
4+
using System.Runtime.Serialization;
5+
using Newtonsoft.Json;
6+
7+
/// <summary>
8+
/// A code for a medical entity.
9+
/// </summary>
10+
public partial interface IMedicalCode : IMedicalIntangible
11+
{
12+
/// <summary>
13+
/// A short textual code that uniquely identifies the value.
14+
/// </summary>
15+
OneOrMany<string> CodeValue { get; set; }
16+
17+
/// <summary>
18+
/// The coding system, e.g. 'ICD-10'.
19+
/// </summary>
20+
OneOrMany<string> CodingSystem { get; set; }
21+
}
22+
23+
/// <summary>
24+
/// A code for a medical entity.
25+
/// </summary>
26+
[DataContract]
27+
public partial class MedicalCode : MedicalIntangible, IMedicalCode, IEquatable<MedicalCode>
28+
{
29+
/// <summary>
30+
/// Gets the name of the type as specified by schema.org.
31+
/// </summary>
32+
[DataMember(Name = "@type", Order = 1)]
33+
public override string Type => "MedicalCode";
34+
35+
/// <summary>
36+
/// A short textual code that uniquely identifies the value.
37+
/// </summary>
38+
[DataMember(Name = "codeValue", Order = 306)]
39+
[JsonConverter(typeof(ValuesJsonConverter))]
40+
public OneOrMany<string> CodeValue { get; set; }
41+
42+
/// <summary>
43+
/// The coding system, e.g. 'ICD-10'.
44+
/// </summary>
45+
[DataMember(Name = "codingSystem", Order = 307)]
46+
[JsonConverter(typeof(ValuesJsonConverter))]
47+
public OneOrMany<string> CodingSystem { get; set; }
48+
49+
/// <inheritdoc/>
50+
public bool Equals(MedicalCode other)
51+
{
52+
if (other is null)
53+
{
54+
return false;
55+
}
56+
57+
if (ReferenceEquals(this, other))
58+
{
59+
return true;
60+
}
61+
62+
return this.Type == other.Type &&
63+
this.CodeValue == other.CodeValue &&
64+
this.CodingSystem == other.CodingSystem &&
65+
base.Equals(other);
66+
}
67+
68+
/// <inheritdoc/>
69+
public override bool Equals(object obj) => this.Equals(obj as MedicalCode);
70+
71+
/// <inheritdoc/>
72+
public override int GetHashCode() => HashCode.Of(this.Type)
73+
.And(this.CodeValue)
74+
.And(this.CodingSystem)
75+
.And(base.GetHashCode());
76+
}
77+
}

Source/Schema.NET/core/MedicalEntity.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
/// </summary>
1010
public partial interface IMedicalEntity : IThing
1111
{
12+
/// <summary>
13+
/// A medical code for the entity, taken from a controlled vocabulary or ontology such as ICD-9, DiseasesDB, MeSH, SNOMED-CT, RxNorm, etc.
14+
/// </summary>
15+
OneOrMany<IMedicalCode> Code { get; set; }
16+
1217
/// <summary>
1318
/// A medical guideline related to this entity.
1419
/// </summary>
@@ -52,45 +57,52 @@ public partial class MedicalEntity : Thing, IMedicalEntity, IEquatable<MedicalEn
5257
[DataMember(Name = "@type", Order = 1)]
5358
public override string Type => "MedicalEntity";
5459

60+
/// <summary>
61+
/// A medical code for the entity, taken from a controlled vocabulary or ontology such as ICD-9, DiseasesDB, MeSH, SNOMED-CT, RxNorm, etc.
62+
/// </summary>
63+
[DataMember(Name = "code", Order = 106)]
64+
[JsonConverter(typeof(ValuesJsonConverter))]
65+
public OneOrMany<IMedicalCode> Code { get; set; }
66+
5567
/// <summary>
5668
/// A medical guideline related to this entity.
5769
/// </summary>
58-
[DataMember(Name = "guideline", Order = 106)]
70+
[DataMember(Name = "guideline", Order = 107)]
5971
[JsonConverter(typeof(ValuesJsonConverter))]
6072
public OneOrMany<IMedicalGuideline> Guideline { get; set; }
6173

6274
/// <summary>
6375
/// The drug or supplement's legal status, including any controlled substance schedules that apply.
6476
/// </summary>
65-
[DataMember(Name = "legalStatus", Order = 107)]
77+
[DataMember(Name = "legalStatus", Order = 108)]
6678
[JsonConverter(typeof(ValuesJsonConverter))]
6779
public virtual Values<IDrugLegalStatus, MedicalEnumeration?, string> LegalStatus { get; set; }
6880

6981
/// <summary>
7082
/// The system of medicine that includes this MedicalEntity, for example 'evidence-based', 'homeopathic', 'chiropractic', etc.
7183
/// </summary>
72-
[DataMember(Name = "medicineSystem", Order = 108)]
84+
[DataMember(Name = "medicineSystem", Order = 109)]
7385
[JsonConverter(typeof(ValuesJsonConverter))]
7486
public OneOrMany<MedicineSystem?> MedicineSystem { get; set; }
7587

7688
/// <summary>
7789
/// If applicable, the organization that officially recognizes this entity as part of its endorsed system of medicine.
7890
/// </summary>
79-
[DataMember(Name = "recognizingAuthority", Order = 109)]
91+
[DataMember(Name = "recognizingAuthority", Order = 110)]
8092
[JsonConverter(typeof(ValuesJsonConverter))]
8193
public OneOrMany<IOrganization> RecognizingAuthority { get; set; }
8294

8395
/// <summary>
8496
/// If applicable, a medical specialty in which this entity is relevant.
8597
/// </summary>
86-
[DataMember(Name = "relevantSpecialty", Order = 110)]
98+
[DataMember(Name = "relevantSpecialty", Order = 111)]
8799
[JsonConverter(typeof(ValuesJsonConverter))]
88100
public OneOrMany<MedicalSpecialty?> RelevantSpecialty { get; set; }
89101

90102
/// <summary>
91103
/// A medical study or trial related to this entity.
92104
/// </summary>
93-
[DataMember(Name = "study", Order = 111)]
105+
[DataMember(Name = "study", Order = 112)]
94106
[JsonConverter(typeof(ValuesJsonConverter))]
95107
public OneOrMany<IMedicalStudy> Study { get; set; }
96108

@@ -108,6 +120,7 @@ public bool Equals(MedicalEntity other)
108120
}
109121

110122
return this.Type == other.Type &&
123+
this.Code == other.Code &&
111124
this.Guideline == other.Guideline &&
112125
this.LegalStatus == other.LegalStatus &&
113126
this.MedicineSystem == other.MedicineSystem &&
@@ -122,6 +135,7 @@ public bool Equals(MedicalEntity other)
122135

123136
/// <inheritdoc/>
124137
public override int GetHashCode() => HashCode.Of(this.Type)
138+
.And(this.Code)
125139
.And(this.Guideline)
126140
.And(this.LegalStatus)
127141
.And(this.MedicineSystem)

Tools/Schema.NET.Tool/Models/SchemaClass.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ public class SchemaClass : SchemaObject
4343
.Traverse(this, x => x.SubClassOf)
4444
.Any(x => string.Equals(x.Layer, LayerName.Meta, StringComparison.OrdinalIgnoreCase));
4545

46-
public bool IsPending => EnumerableExtensions
47-
.Traverse(this, x => x.SubClassOf)
48-
.Any(x => string.Equals(x.Layer, LayerName.Pending, StringComparison.OrdinalIgnoreCase));
46+
public bool IsPending => string.Equals(this.Layer, LayerName.Pending, StringComparison.OrdinalIgnoreCase);
4947

5048
public bool IsPrimitive => PrimitiveTypes.Contains(this.Label);
5149

0 commit comments

Comments
 (0)