@@ -66,6 +66,7 @@ public class Schema : SwaggerObject
66
66
67
67
private LinkedList < Schema > _visitedSchemas = new LinkedList < Schema > ( ) ;
68
68
69
+ /// <inheritdoc />
69
70
/// <summary>
70
71
/// Compare a modified document node (this) to a previous one and look for breaking as well as non-breaking changes.
71
72
/// </summary>
@@ -74,9 +75,7 @@ public class Schema : SwaggerObject
74
75
/// <returns>A list of messages from the comparison.</returns>
75
76
public override IEnumerable < ComparisonMessage > Compare ( ComparisonContext context , SwaggerBase previous )
76
77
{
77
- var priorSchema = previous as Schema ;
78
-
79
- if ( priorSchema == null )
78
+ if ( ! ( previous is Schema priorSchema ) )
80
79
{
81
80
throw new ArgumentNullException ( "priorVersion" ) ;
82
81
}
@@ -178,7 +177,7 @@ public override IEnumerable<ComparisonMessage> Compare(ComparisonContext context
178
177
/// <param name="priorSchema">Schema of the old model</param>
179
178
private void CompareRequired ( ComparisonContext context , Schema priorSchema )
180
179
{
181
- if ( Required == null && priorSchema . Required == null )
180
+ if ( Required == null )
182
181
{
183
182
return ;
184
183
}
@@ -232,8 +231,7 @@ private void CompareProperties(ComparisonContext context, Schema priorSchema)
232
231
{
233
232
foreach ( var def in priorSchema . Properties )
234
233
{
235
- Schema model = null ;
236
- if ( Properties == null || ! Properties . TryGetValue ( def . Key , out model ) )
234
+ if ( Properties == null || ! Properties . TryGetValue ( def . Key , out var model ) )
237
235
{
238
236
context . LogBreakingChange ( ComparisonMessages . RemovedProperty , def . Key ) ;
239
237
}
0 commit comments