Skip to content

Commit 0cb4ccb

Browse files
committed
fix: adds missing null propagation operators for callback and header references
Signed-off-by: Vincent Biret <[email protected]>
1 parent aa80b19 commit 0cb4ccb

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ internal OpenApiCallbackReference(OpenApiCallback target, string referenceId)
8585
}
8686

8787
/// <inheritdoc/>
88-
public Dictionary<RuntimeExpression, OpenApiPathItem> PathItems { get => Target.PathItems; }
88+
public Dictionary<RuntimeExpression, OpenApiPathItem> PathItems { get => Target?.PathItems; }
8989

9090
/// <inheritdoc/>
91-
public IDictionary<string, IOpenApiExtension> Extensions { get => Target.Extensions; }
91+
public IDictionary<string, IOpenApiExtension> Extensions { get => Target?.Extensions; }
9292

9393
/// <inheritdoc/>
9494
public void SerializeAsV3(IOpenApiWriter writer)

src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,37 @@ public string Description
9797
}
9898

9999
/// <inheritdoc/>
100-
public bool Required { get => Target.Required; }
100+
public bool Required { get => Target?.Required ?? default; }
101101

102102
/// <inheritdoc/>
103-
public bool Deprecated { get => Target.Deprecated; }
103+
public bool Deprecated { get => Target?.Deprecated ?? default; }
104104

105105
/// <inheritdoc/>
106-
public bool AllowEmptyValue { get => Target.AllowEmptyValue; }
106+
public bool AllowEmptyValue { get => Target?.AllowEmptyValue ?? default; }
107107

108108
/// <inheritdoc/>
109-
public OpenApiSchema Schema { get => Target.Schema; }
109+
public OpenApiSchema Schema { get => Target?.Schema; }
110110

111111
/// <inheritdoc/>
112-
public ParameterStyle? Style { get => Target.Style; }
112+
public ParameterStyle? Style { get => Target?.Style; }
113113

114114
/// <inheritdoc/>
115-
public bool Explode { get => Target.Explode; }
115+
public bool Explode { get => Target?.Explode ?? default; }
116116

117117
/// <inheritdoc/>
118-
public bool AllowReserved { get => Target.AllowReserved; }
118+
public bool AllowReserved { get => Target?.AllowReserved ?? default; }
119119

120120
/// <inheritdoc/>
121-
public JsonNode Example { get => Target.Example; }
121+
public JsonNode Example { get => Target?.Example; }
122122

123123
/// <inheritdoc/>
124-
public IDictionary<string, IOpenApiExample> Examples { get => Target.Examples; }
124+
public IDictionary<string, IOpenApiExample> Examples { get => Target?.Examples; }
125125

126126
/// <inheritdoc/>
127-
public IDictionary<string, OpenApiMediaType> Content { get => Target.Content; }
127+
public IDictionary<string, OpenApiMediaType> Content { get => Target?.Content; }
128128

129129
/// <inheritdoc/>
130-
public IDictionary<string, IOpenApiExtension> Extensions { get => Target.Extensions; }
130+
public IDictionary<string, IOpenApiExtension> Extensions { get => Target?.Extensions; }
131131

132132
/// <inheritdoc/>
133133
public void SerializeAsV31(IOpenApiWriter writer)

0 commit comments

Comments
 (0)