diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs
index adb3a5162..5c4bb8ff0 100644
--- a/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs
+++ b/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs
@@ -116,7 +116,7 @@ internal OpenApiSchemaReference(OpenApiSchema target, string referenceId)
}
///
- public override string Title { get => string.IsNullOrEmpty(_title) ? Target.Title : _title; set => _title = value; }
+ public override string Title { get => string.IsNullOrEmpty(_title) ? Target?.Title : _title; set => _title = value; }
///
public override string Schema { get => string.IsNullOrEmpty(_schema) ? Target.Schema : _schema; set => _schema = value; }
///
@@ -124,13 +124,13 @@ internal OpenApiSchemaReference(OpenApiSchema target, string referenceId)
///
public override string Comment { get => string.IsNullOrEmpty(_comment) ? Target.Comment : _comment; set => _comment = value; }
///
- public override IDictionary Vocabulary { get => _vocabulary is not null ? _vocabulary : Target.Vocabulary; set => _vocabulary = value; }
+ public override IDictionary Vocabulary { get => _vocabulary is not null ? _vocabulary : Target?.Vocabulary; set => _vocabulary = value; }
///
public override string DynamicRef { get => string.IsNullOrEmpty(_dynamicRef) ? Target.DynamicRef : _dynamicRef; set => _dynamicRef = value; }
///
public override string DynamicAnchor { get => string.IsNullOrEmpty(_dynamicAnchor) ? Target.DynamicAnchor : _dynamicAnchor; set => _dynamicAnchor = value; }
///
- public override IDictionary Definitions { get => _definitions is not null ? _definitions : Target.Definitions; set => _definitions = value; }
+ public override IDictionary Definitions { get => _definitions is not null ? _definitions : Target?.Definitions; set => _definitions = value; }
///
public override decimal? V31ExclusiveMaximum { get => _v31ExclusiveMaximum is not null ? _v31ExclusiveMaximum.Value : Target.V31ExclusiveMaximum; set => _v31ExclusiveMaximum = value; }
///
@@ -176,15 +176,15 @@ public override JsonNode Default
///
public override bool WriteOnly { get => _writeOnly is not null ? _writeOnly.Value : Target.WriteOnly; set => _writeOnly = value; }
///
- public override IList AllOf { get => _allOf is not null ? _allOf : Target.AllOf; set => _allOf = value; }
+ public override IList AllOf { get => _allOf is not null ? _allOf : Target?.AllOf; set => _allOf = value; }
///
- public override IList OneOf { get => _oneOf is not null ? _oneOf : Target.OneOf; set => _oneOf = value; }
+ public override IList OneOf { get => _oneOf is not null ? _oneOf : Target?.OneOf; set => _oneOf = value; }
///
- public override IList AnyOf { get => _anyOf is not null ? _anyOf : Target.AnyOf; set => _anyOf = value; }
+ public override IList AnyOf { get => _anyOf is not null ? _anyOf : Target?.AnyOf; set => _anyOf = value; }
///
public override OpenApiSchema Not { get => _not is not null ? _not : Target.Not; set => _not = value; }
///
- public override ISet Required { get => _required is not null ? _required : Target.Required; set => _required = value; }
+ public override ISet Required { get => _required is not null ? _required : Target?.Required; set => _required = value; }
///
public override OpenApiSchema Items { get => _items is not null ? _items : Target.Items; set => _items = value; }
///
@@ -194,9 +194,9 @@ public override JsonNode Default
///
public override bool? UniqueItems { get => _uniqueItems is not null ? _uniqueItems : Target.UniqueItems; set => _uniqueItems = value; }
///
- public override IDictionary Properties { get => _properties is not null ? _properties : Target.Properties ; set => _properties = value; }
+ public override IDictionary Properties { get => _properties is not null ? _properties : Target?.Properties ; set => _properties = value; }
///
- public override IDictionary PatternProperties { get => _patternProperties is not null ? _patternProperties : Target.PatternProperties; set => _patternProperties = value; }
+ public override IDictionary PatternProperties { get => _patternProperties is not null ? _patternProperties : Target?.PatternProperties; set => _patternProperties = value; }
///
public override int? MaxProperties { get => _maxProperties is not null ? _maxProperties : Target.MaxProperties; set => _maxProperties = value; }
///
@@ -220,7 +220,7 @@ public override IList Examples
set => Target.Examples = value;
}
///
- public override IList Enum { get => _enum is not null ? _enum : Target.Enum; set => _enum = value; }
+ public override IList Enum { get => _enum is not null ? _enum : Target?.Enum; set => _enum = value; }
///
public override bool Nullable { get => _nullable is null ? Target.Nullable : _nullable.Value; set => _nullable = value; }
///
@@ -232,7 +232,7 @@ public override IList Examples
///
public override OpenApiXml Xml { get => _xml is not null ? _xml : Target.Xml; set => _xml = value; }
///
- public override IDictionary Extensions { get => _extensions is not null ? _extensions : Target.Extensions; set => _extensions = value; }
+ public override IDictionary Extensions { get => _extensions is not null ? _extensions : Target?.Extensions; set => _extensions = value; }
///
public override void SerializeAsV31(IOpenApiWriter writer)